wireplumber/0001-autoswitch-bluetooth-profile-switch-only-Bluetooth-devices.patch
Antonio Larrosa 4208d2399f - Update to version 0.5.7:
* Highlights:
    - Fixed an issue that would cause random profile switching when
      an application was trying to capture from non-Bluetooth
      devices (#715, #634, !669)
    - Fixed an issue that would cause strange profile selection
      issues [choices not being remembered or unavailable routes
      being selected] (#734)
    - Added a timer that delays switching Bluetooth headsets to the
      HSP/HFP profile, avoiding needless rapid switching when an
      application is trying to probe device capabilities instead of
      actually capturing audio (!664)
    - Improved libcamera/v4l2 device deduplication logic to work
      with more complex devices (!674, !675, #689, #708)
  * Fixes:
    - Fixed two memory leaks in module-mixer-api and
      module-dbus-connection (!672, !673)
    - Fixed a crash that could occur in module-reserve-device
      (!680, #742)
    - Fixed an issue that would cause the warning
      "[string "alsa.lua"]:182: attempt to concatenate a nil value
      (local 'node_name')" to appear in the logs when an ALSA
      device was busy, breaking node name deduplication (!681)
    - Fixed an issue that could make find-preferred-profile.lua
      crash instead of properly applying profile priority rules
      (#751)
- Remove patches that are already included in 0.5.7:
  * 0001-autoswitch-bluetooth-profile-switch-only-Bluetooth-devices.patch
  * 0002-autoswitch-bluetooth-profile-Switch-to-HSP_HFP-on-timeout.patch
  * 0003-m-mixer-api-Fix-memory-in-leak-wp_mixer_api_set_volume.patch

OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/wireplumber?expand=0&rev=89
2024-12-04 11:44:23 +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