commit:     26754e7d4280639fb756a8340e0de7d29b8de78a
Author:     Niklāvs Koļesņikovs <89q1r14hd <AT> relay <DOT> firefox <DOT> com>
AuthorDate: Tue Jan  4 06:38:20 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Jan  6 20:53:31 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=26754e7d

media-video/wireplumber: add fix to stop stream move on HDMI suspend

The patch looks like it might fix other things too but the best known
issue it should be resolving is that without it having a display
suspend or enter power off state would make audio streams be moved
to the next highest priority device. Such behavior might be
PulseAudio default but for PipeWire it's considered undesirable and
a bug to fix.

Bug: https://gitlab.freedesktop.org/pipewire/wireplumber/-/issues/94

Signed-off-by: Niklāvs Koļesņikovs <89q1r14hd <AT> relay.firefox.com>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 ...tes.lua-reevaluate-current-profile-only-f.patch | 81 ++++++++++++++++++++++
 ...0.4.5-r3.ebuild => wireplumber-0.4.5-r4.ebuild} |  1 +
 2 files changed, 82 insertions(+)

diff --git 
a/media-video/wireplumber/files/wireplumber-0.4.5-default-routes.lua-reevaluate-current-profile-only-f.patch
 
b/media-video/wireplumber/files/wireplumber-0.4.5-default-routes.lua-reevaluate-current-profile-only-f.patch
new file mode 100644
index 000000000000..423a1fcb6139
--- /dev/null
+++ 
b/media-video/wireplumber/files/wireplumber-0.4.5-default-routes.lua-reevaluate-current-profile-only-f.patch
@@ -0,0 +1,81 @@
+https://gitlab.freedesktop.org/pipewire/wireplumber/-/commit/22fd4292ab35786b09561508778ab49cc6488dc6
+
+From 22fd4292ab35786b09561508778ab49cc6488dc6 Mon Sep 17 00:00:00 2001
+From: Julian Bouzas <[email protected]>
+Date: Tue, 7 Dec 2021 14:10:32 -0500
+Subject: [PATCH] default-routes.lua: reevaluate current profile only for its
+ own routes
+
+Only check the current active profile when some routes changed that are part of
+the profile. If some other route changed, just ignore it.
+---
+ src/scripts/default-routes.lua | 39 +++++++++++++++++++---------------
+ 1 file changed, 22 insertions(+), 17 deletions(-)
+
+diff --git a/src/scripts/default-routes.lua b/src/scripts/default-routes.lua
+index 1840989f..953cba33 100644
+--- a/src/scripts/default-routes.lua
++++ b/src/scripts/default-routes.lua
+@@ -352,6 +352,12 @@ function handleDevice(device)
+   local dev_info = dev_infos[device["bound-id"]]
+   local new_route_infos = {}
+   local avail_routes_changed = false
++  local profile = nil
++
++  -- get current profile
++  for p in device:iterate_params("Profile") do
++    profile = parseParam(p, "Profile")
++  end
+ 
+   -- look at all the routes and update/reset cached information
+   for p in device:iterate_params("EnumRoute") do
+@@ -370,7 +376,9 @@ function handleDevice(device)
+       Log.info(device, "route " .. route.name .. " available changed " ..
+                        route_info.available .. " -> " .. route.available)
+       route_info.available = route.available
+-      avail_routes_changed = true
++      if profile and arrayContains(route.profiles, profile.index) then
++        avail_routes_changed = true
++      end
+     end
+     route_info.prev_active = route_info.active
+     route_info.active = false
+@@ -419,23 +427,20 @@ function handleDevice(device)
+     ::skip_route::
+   end
+ 
+-  -- now get the profile and restore routes for it
+-  for p in device:iterate_params("Profile") do
+-    local profile = parseParam(p, "Profile")
+-    if profile then
+-      local profile_changed = (dev_info.active_profile ~= profile.index)
+-
+-      -- if the profile changed, restore routes for that profile
+-      -- if any of the routes of the current profile changed in availability,
+-      -- then try to select a new "best" route for each device and ignore
+-      -- what was stored
+-      if profile_changed or avail_routes_changed then
+-        dev_info.active_profile = profile.index
+-        restoreProfileRoutes(device, dev_info, profile, profile_changed)
+-      end
+-
+-      saveProfile(dev_info, profile.name)
++  -- restore routes for profile
++  if profile then
++    local profile_changed = (dev_info.active_profile ~= profile.index)
++
++    -- if the profile changed, restore routes for that profile
++    -- if any of the routes of the current profile changed in availability,
++    -- then try to select a new "best" route for each device and ignore
++    -- what was stored
++    if profile_changed or avail_routes_changed then
++      dev_info.active_profile = profile.index
++      restoreProfileRoutes(device, dev_info, profile, profile_changed)
+     end
++
++    saveProfile(dev_info, profile.name)
+   end
+ end
+ 
+-- 
+GitLab

diff --git a/media-video/wireplumber/wireplumber-0.4.5-r3.ebuild 
b/media-video/wireplumber/wireplumber-0.4.5-r4.ebuild
similarity index 97%
rename from media-video/wireplumber/wireplumber-0.4.5-r3.ebuild
rename to media-video/wireplumber/wireplumber-0.4.5-r4.ebuild
index e39673240df7..faf7c563e19f 100644
--- a/media-video/wireplumber/wireplumber-0.4.5-r3.ebuild
+++ b/media-video/wireplumber/wireplumber-0.4.5-r4.ebuild
@@ -64,6 +64,7 @@ PATCHES=(
        
"${FILESDIR}"/${P}-lib-don-t-read-hidden-files-from-the-config-director.patch
        "${FILESDIR}"/${P}-alsa-handle-the-release-requested-signal.patch
        "${FILESDIR}"/${P}-access-config-add-restricted-access-permissions.patch
+       
"${FILESDIR}"/${P}-default-routes.lua-reevaluate-current-profile-only-f.patch
        "${WORKDIR}"/${P}-endianness-fixes.patch
 )
 

Reply via email to