wireplumber/0002-policy-node-find-best-linkable-if-default-one-cannot-be-linked.patch

46 lines
1.5 KiB
Diff

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] policy-node: find best linkable if default one cannot be
linked
Fixes issue with echo cancellation pipewire module.
---
src/scripts/policy-node.lua | 21 +++++++++++++++------
1 file changed, 15 insertions(+), 6 deletions(-)
diff --git a/src/scripts/policy-node.lua b/src/scripts/policy-node.lua
index 8ca5a695..3210f579 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
- return findBestlinkable (si)
+ -- 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)
--