wireplumber/0003-policy-node-find-best-linkable-if-default-one-cannot.patch

47 lines
1.5 KiB
Diff
Raw Normal View History

From bee9827ae376b75feceea926b0afc727fecca51b Mon Sep 17 00:00:00 2001
From: Julian Bouzas <julian.bouzas@collabora.com>
Date: Fri, 7 Jan 2022 15:35:10 -0500
Subject: [PATCH 03/14] policy-node: find best linkable if default one cannot
be linked
Fixes issue with echo cancellation pipewire module.
---
src/scripts/policy-node.lua | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/src/scripts/policy-node.lua b/src/scripts/policy-node.lua
index c273c1f..9df5007 100644
--- a/src/scripts/policy-node.lua
+++ b/src/scripts/policy-node.lua
@@ -477,13 +477,22 @@ function findBestLinkable (si)
end
function findUndefinedTarget (si)
- -- Find the default linkable if the default nodes module is loaded, otherwise
- -- just find the best linkable based on priority and routes
- if default_nodes ~= nil then
- return findDefaultlinkable (si)
- else
+ -- Just find the best linkable if default nodes module is not loaded
+ if default_nodes == nil then
return findBestLinkable (si)
end
+
+ -- Otherwise find the default linkable. If the default linkabke cannot link,
+ -- we find the best one instead. We return nil if default does not exist.
+ local si_target, can_passthrough = findDefaultlinkable (si)
+ if si_target then
+ if canLink (si.properties, si_target) then
+ return si_target, can_passthrough
+ else
+ return findBestLinkable (si)
+ end
+ end
+ return nil, nil
end
function lookupLink (si_id, si_target_id)
--
2.34.1