wireplumber: fix rescan loop resulting in high cpu usage
This commit is contained in:
parent
dd84136b51
commit
c2b1bcc5e3
|
@ -0,0 +1,54 @@
|
|||
From 37c839b9308cd3d6580bf01077db8cb29ec2aa2f Mon Sep 17 00:00:00 2001
|
||||
From: Pauli Virtanen <pav@iki.fi>
|
||||
Date: Tue, 19 Jul 2022 20:39:06 +0300
|
||||
Subject: [PATCH] policy-node: fix potential rescan loop
|
||||
|
||||
SiLink activation might be delayed indefinitely under some error
|
||||
conditions. Currently, policy-node schedules a rescan when it sees a
|
||||
non-activated link on a stream to be moved, which produces busy loop if
|
||||
the si-link doesn't activate.
|
||||
|
||||
Instead of rescheduling on non-active si-links, just remove and emit a
|
||||
warning. The si-link then gets removed once it gets activated.
|
||||
|
||||
Reproducer:
|
||||
|
||||
1. Play audio from Rhythmbox and pause.
|
||||
2. Switch default output with pactl between two different outputs
|
||||
3. Links from the paused stream stay at "init"
|
||||
---
|
||||
src/scripts/policy-node.lua | 17 ++++++++---------
|
||||
1 file changed, 8 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/src/scripts/policy-node.lua b/src/scripts/policy-node.lua
|
||||
index e6816723..43df701c 100644
|
||||
--- a/src/scripts/policy-node.lua
|
||||
+++ b/src/scripts/policy-node.lua
|
||||
@@ -694,16 +694,15 @@ function handleLinkable (si)
|
||||
local link = lookupLink (si_id, si_flags[si_id].peer_id)
|
||||
if reconnect then
|
||||
if link ~= nil then
|
||||
- -- remove old link if active, otherwise schedule rescan
|
||||
- if ((link:get_active_features() & Feature.SessionItem.ACTIVE) ~= 0) then
|
||||
- si_flags[si_id].peer_id = nil
|
||||
- link:remove ()
|
||||
- Log.info (si, "... moving to new target")
|
||||
- else
|
||||
- scheduleRescan()
|
||||
- Log.info (si, "... scheduled rescan")
|
||||
- return
|
||||
+ -- remove old link
|
||||
+ if ((link:get_active_features() & Feature.SessionItem.ACTIVE) == 0) then
|
||||
+ -- remove also not yet activated links: they might never become active,
|
||||
+ -- and we should not loop waiting for them
|
||||
+ Log.warning (link, "Link was not activated before removing")
|
||||
end
|
||||
+ si_flags[si_id].peer_id = nil
|
||||
+ link:remove ()
|
||||
+ Log.info (si, "... moving to new target")
|
||||
end
|
||||
else
|
||||
if link ~= nil then
|
||||
--
|
||||
GitLab
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
# Template file for 'wireplumber'
|
||||
pkgname=wireplumber
|
||||
version=0.4.11
|
||||
revision=1
|
||||
revision=2
|
||||
build_style=meson
|
||||
build_helper=gir
|
||||
configure_args="-Dintrospection=enabled -Dsystem-lua=true"
|
||||
|
|
Loading…
Reference in New Issue