From 16613e53706ee70b5a4b83fbe27e78e9438255f0f6ec01dc9c49171de6f62e80 Mon Sep 17 00:00:00 2001 From: Antonio Larrosa Date: Wed, 24 Nov 2021 16:19:21 +0000 Subject: [PATCH] Accepting request 933504 from home:alarrosa:branches:multimedia:libs - Add patches from upstream to fix wireplumber breaking when udevadm trigger is run: * 0001-m-reserve-device-replace-the-hash-table-key-on-new-insert.patch - And another patch to fix an issue where there is only 1 sink available and the card profile is toggeled between pro and stereo: * 0002-policy-node-wait-for-nodes-when-we-become-unlinked.patch OBS-URL: https://build.opensuse.org/request/show/933504 OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/wireplumber?expand=0&rev=9 --- ...ace-the-hash-table-key-on-new-insert.patch | 46 +++++++++++++++++++ ...it-for-nodes-when-we-become-unlinked.patch | 34 ++++++++++++++ wireplumber.changes | 11 +++++ wireplumber.spec | 4 ++ 4 files changed, 95 insertions(+) create mode 100644 0001-m-reserve-device-replace-the-hash-table-key-on-new-insert.patch create mode 100644 0002-policy-node-wait-for-nodes-when-we-become-unlinked.patch diff --git a/0001-m-reserve-device-replace-the-hash-table-key-on-new-insert.patch b/0001-m-reserve-device-replace-the-hash-table-key-on-new-insert.patch new file mode 100644 index 0000000..106c504 --- /dev/null +++ b/0001-m-reserve-device-replace-the-hash-table-key-on-new-insert.patch @@ -0,0 +1,46 @@ +From f4546a18e871537be698916178b40091a4a0b377 Mon Sep 17 00:00:00 2001 +From: Peter Hutterer +Date: Fri, 12 Nov 2021 11:19:54 +1000 +Subject: [PATCH] m-reserve-device: replace the hash table key on new insert + +We're using the WpReserveDevice's name as key in the hash table, so we +must update the key as well when we replace an item in the hashtable - +the old device (and its name) will be released. + +The side-effect of this is that the *third* device with an identical +name will no longer replace the previous device. This results in the +following sequence: + +- dev1 added: name Audio0 + - dev1 requests name owner Audio0 +- dev2 added: name Audio0 + - replace dev1 in the hashtable + - dev1 emits "release" signal + - dev1 unowns the Audio0 name + - dev2 requests name owner Audio0 +- dev3 added: name Audio0 + - adds to the hashtable because the existing key is now undefined + - dev3 requests name owner Audio0 + - error, you cannot request ownership for the same name twice + +Fixes #93 +--- + modules/module-reserve-device/plugin.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/modules/module-reserve-device/plugin.c b/modules/module-reserve-device/plugin.c +index d8e4e092..68df6ee8 100644 +--- a/modules/module-reserve-device/plugin.c ++++ b/modules/module-reserve-device/plugin.c +@@ -221,7 +221,7 @@ wp_reserve_device_plugin_create_reservation (WpReserveDevicePlugin *self, + NULL); + + /* use rd->name to avoid copying @em name again */ +- g_hash_table_insert (self->reserve_devices, rd->name, rd); ++ g_hash_table_replace (self->reserve_devices, rd->name, rd); + + return g_object_ref (rd); + } +-- +GitLab + diff --git a/0002-policy-node-wait-for-nodes-when-we-become-unlinked.patch b/0002-policy-node-wait-for-nodes-when-we-become-unlinked.patch new file mode 100644 index 0000000..05358e5 --- /dev/null +++ b/0002-policy-node-wait-for-nodes-when-we-become-unlinked.patch @@ -0,0 +1,34 @@ +From 83041b0ce277c95afaf1824f525ea0bec516f03f Mon Sep 17 00:00:00 2001 +From: Wim Taymans +Date: Thu, 18 Nov 2021 15:23:23 +0100 +Subject: [PATCH] policy-node: wait for nodes when we become unlinked + +If we were linked before but our node is removed, wait until a new node +becomes available instead of failing. + +This fixes an issue where there is only 1 sink available and the card +profile is toggeled between pro and stereo. After the profile is +toggled, the sink is removed and the node would be killed with an error +because there is no fallback sink. The fix is similar to the +pipewire-media-session logic. +--- + src/scripts/policy-node.lua | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/src/scripts/policy-node.lua b/src/scripts/policy-node.lua +index 5029d1b3..445b1a7b 100644 +--- a/src/scripts/policy-node.lua ++++ b/src/scripts/policy-node.lua +@@ -493,6 +493,9 @@ function handleLinkable (si) + if not reconnect then + Log.info (si, "... destroy node") + node:request_destroy() ++ elseif si_flags[si.id].was_handled then ++ Log.info (si, "... waiting reconnect") ++ return + end + + local client_id = node.properties["client.id"] +-- +GitLab + diff --git a/wireplumber.changes b/wireplumber.changes index 58b457d..6cf51df 100644 --- a/wireplumber.changes +++ b/wireplumber.changes @@ -1,3 +1,14 @@ +------------------------------------------------------------------- +Wed Nov 24 16:09:52 UTC 2021 - Antonio Larrosa + +- Add patches from upstream to fix wireplumber breaking when + udevadm trigger is run: + * 0001-m-reserve-device-replace-the-hash-table-key-on-new-insert.patch +- And another patch to fix an issue where there is only 1 sink + available and the card profile is toggeled between pro and + stereo: + * 0002-policy-node-wait-for-nodes-when-we-become-unlinked.patch + ------------------------------------------------------------------- Thu Nov 11 13:25:33 UTC 2021 - alarrosa@suse.com diff --git a/wireplumber.spec b/wireplumber.spec index 8daecae..43fd65a 100644 --- a/wireplumber.spec +++ b/wireplumber.spec @@ -28,6 +28,8 @@ License: MIT Group: Development/Libraries/C and C++ URL: https://gitlab.freedesktop.org/pipewire/wireplumber Source0: wireplumber-%{version}.tar.xz +Patch0: 0001-m-reserve-device-replace-the-hash-table-key-on-new-insert.patch +Patch1: 0002-policy-node-wait-for-nodes-when-we-become-unlinked.patch Patch100: reduce-meson-required-version.patch BuildRequires: cmake BuildRequires: doxygen @@ -127,6 +129,8 @@ the wireplumber shared library. %prep %setup -n wireplumber-%{version} +%patch0 -p1 +%patch1 -p1 %if %{pkg_vcmp meson < 0.56.0} %patch100 -p1 %endif