wireplumber/0001-autoswitch-bluetooth-profile-switch-only-Bluetooth-devices.patch
Antonio Larrosa 56aeee93ab - Update to version 0.5.8:
* Additions & Enhancements:
    - Added support for handling UCM SplitPCM nodes in the ALSA
      monitor, which allows native PipeWire channel remapping using
      loopbacks for devices that use this feature (!685)
    - Introduced new functions to mark WpSpaDevice child objects as
      pending. This allows properly associating asynchronously
      created loopback nodes with their parent WpSpaDevice without
      losing ObjectConfig events (!687, !689)
    - Improved the node name deduplication logic in the ALSA
      monitor to prevent node names with .2, .3, etc appended to
      them in some more cases (!688)
    - Added a new script to populate session.services. This is a
      step towards implementing detection of features that PipeWire
      can service (!686)
  * Fixes:
    - Fixed an issue that was causing duplicate Bluetooth SCO
      (HSP/HFP) source nodes to be shown in UIs (#701, !683)
    - In the BlueZ monitor, marked the source loopback node as
      non-virtual, addressing how it appears on UIs (#729)
    - Disabled stream-restore for device loopback nodes to
      prevent unwanted property changes (!691)
    - Fixed wp_lua_log_topic_copy() to correctly copy topic names
      (#757)
    - Updated script tests to handle differences in object
      identifiers (object.serial vs node.id), ensuring proper test
      behavior (#761)

OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/wireplumber?expand=0&rev=90
2025-02-10 16:37:19 +00:00

68 lines
3.0 KiB
Diff

From b68a6794cd5c3702a2144be60c41a9ca982c416b Mon Sep 17 00:00:00 2001
From: Pauli Virtanen <pav@iki.fi>
Date: Sun, 8 Sep 2024 20:22:41 +0300
Subject: [PATCH] autoswitch-bluetooth-profile: switch only Bluetooth devices
Handle only devices associated with Bluetooth loopback nodes.
Make sure the node.link-group iteration cannot get stuck if there is a
loop in the link graph.
---
.../device/autoswitch-bluetooth-profile.lua | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/src/scripts/device/autoswitch-bluetooth-profile.lua b/src/scripts/device/autoswitch-bluetooth-profile.lua
index d4f3529f..70e27601 100644
--- a/src/scripts/device/autoswitch-bluetooth-profile.lua
+++ b/src/scripts/device/autoswitch-bluetooth-profile.lua
@@ -301,13 +301,14 @@ end
-- We consider a Stream of interest if it is linked to a bluetooth loopback
-- source filter
-local function checkStreamStatus (stream, node_om)
+local function checkStreamStatus (stream, node_om, visited_link_groups)
-- check if the stream is linked to a bluetooth loopback source
local stream_id = tonumber(stream["bound-id"])
local peer_id = lutils.getNodePeerId (stream_id)
if peer_id ~= nil then
local bt_node = node_om:lookup {
- Constraint { "bound-id", "=", peer_id, type = "gobject" }
+ Constraint { "bound-id", "=", peer_id, type = "gobject" },
+ Constraint { "bluez5.loopback", "=", "true", type = "pw" }
}
if bt_node ~= nil then
local dev_id = bt_node.properties["device.id"]
@@ -325,18 +326,27 @@ local function checkStreamStatus (stream, node_om)
else
-- Check if it is linked to a filter main node, and recursively advance if so
local filter_main_node = node_om:lookup {
- Constraint { "bound-id", "=", peer_id, type = "gobject" }
+ Constraint { "bound-id", "=", peer_id, type = "gobject" },
+ Constraint { "node.link-group", "+", type = "pw" }
}
if filter_main_node ~= nil then
-- Now check all stream nodes for this filter
local filter_link_group = filter_main_node.properties ["node.link-group"]
+ if visited_link_groups == nil then
+ visited_link_groups = {}
+ end
+ if visited_link_groups [filter_link_group] then
+ return nil
+ else
+ visited_link_groups [filter_link_group] = true
+ end
for filter_stream_node in node_om:iterate {
Constraint { "media.class", "matches", "Stream/Input/Audio", type = "pw-global" },
Constraint { "stream.monitor", "!", "true", type = "pw" },
Constraint { "bluez5.loopback", "!", "true", type = "pw" },
Constraint { "node.link-group", "=", filter_link_group, type = "pw" }
} do
- local dev_id = checkStreamStatus (filter_stream_node, node_om)
+ local dev_id = checkStreamStatus (filter_stream_node, node_om, visited_link_groups)
if dev_id ~= nil then
return dev_id
end
--
GitLab