From 6691718a40852f9ad91a55ce89c30cca33048553f25995b3f2152bbbe3d80a74 Mon Sep 17 00:00:00 2001 From: Antonio Larrosa Date: Wed, 20 Oct 2021 06:07:16 +0000 Subject: [PATCH] Accepting request 926454 from home:alarrosa:branches:multimedia:libs - Add patch from upstream to fix selection of capture ports instead of monitor ports: * 0002-policy-node-enforce-the-direction-of-the-target-when-linking-by-node-name.patch OBS-URL: https://build.opensuse.org/request/show/926454 OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/wireplumber?expand=0&rev=6 --- ...the-target-when-linking-by-node-name.patch | 116 ++++++++++++++++++ wireplumber.changes | 7 ++ wireplumber.spec | 2 + 3 files changed, 125 insertions(+) create mode 100644 0002-policy-node-enforce-the-direction-of-the-target-when-linking-by-node-name.patch diff --git a/0002-policy-node-enforce-the-direction-of-the-target-when-linking-by-node-name.patch b/0002-policy-node-enforce-the-direction-of-the-target-when-linking-by-node-name.patch new file mode 100644 index 0000000..da02c2d --- /dev/null +++ b/0002-policy-node-enforce-the-direction-of-the-target-when-linking-by-node-name.patch @@ -0,0 +1,116 @@ +From f8ced47a1a9595b32c59ece24b864bafbdcc74fe Mon Sep 17 00:00:00 2001 +From: George Kiagiadakis +Date: Tue, 19 Oct 2021 13:04:58 +0300 +Subject: [PATCH] policy-node: enforce the direction of the target when linking + by node name + +When node.target is set to contain a node's name, it is possible to run +into the situation where you have a sink and a source with the same name +(typically the case with module-loopback) and the sink has monitor ports, +so wireplumber may link the stream to the monitor of the sink instead of the +capture ports of the source + +With this policy, if a stream really wants to link to the monitor of the sink, +it has to have the "stream.capture.sink" property set or specify the +target by id. +--- + src/scripts/policy-node.lua | 76 +++++++++++++++++-------------------- + 1 file changed, 35 insertions(+), 41 deletions(-) + +diff --git a/src/scripts/policy-node.lua b/src/scripts/policy-node.lua +index 4c5c359b..e982a09d 100644 +--- a/src/scripts/policy-node.lua ++++ b/src/scripts/policy-node.lua +@@ -187,47 +187,6 @@ function canLink (properties, si_target) + return true + end + +--- Try to locate a valid target node that was explicitly defined by the user +--- Use the target.node metadata, if config.move is enabled, +--- then use the node.target property that was set on the node +--- `properties` must be the properties dictionary of the session item +--- that is currently being handled +-function findDefinedTarget (properties) +- local function findTargetByTargetNodeMetadata (properties) +- local node_id = properties["node.id"] +- local metadata = metadata_om:lookup() +- local target_id = metadata and metadata:find(node_id, "target.node") or nil +- if target_id and tonumber(target_id) > 0 then +- local si_target = linkables_om:lookup { +- Constraint { "node.id", "=", target_id }, +- } +- if si_target and canLink (properties, si_target) then +- return si_target +- end +- end +- return nil +- end +- +- local function findTargetByNodeTargetProperty (properties) +- local target_id = properties["node.target"] +- if target_id then +- for si_target in linkables_om:iterate() do +- local target_props = si_target.properties +- if (target_props["node.id"] == target_id or +- target_props["node.name"] == target_id or +- target_props["object.path"] == target_id) and +- canLink (properties, si_target) then +- return si_target +- end +- end +- end +- return nil +- end +- +- return (config.move and findTargetByTargetNodeMetadata (properties) or nil) +- or findTargetByNodeTargetProperty (properties) +-end +- + function getTargetDirection(properties) + local target_direction = nil + if properties["item.node.direction"] == "output" or +@@ -247,6 +206,41 @@ function getDefaultNode(properties, target_direction) + return default_nodes:call("get-default-node", target_media_class) + end + ++-- Try to locate a valid target node that was explicitly defined by the user ++-- Use the target.node metadata, if config.move is enabled, ++-- then use the node.target property that was set on the node ++-- `properties` must be the properties dictionary of the session item ++-- that is currently being handled ++function findDefinedTarget (properties) ++ local metadata = config.move and metadata_om:lookup() ++ local target_id = metadata ++ and metadata:find(properties["node.id"], "target.node") ++ or properties["node.target"] ++ local target_direction = getTargetDirection(properties) ++ ++ if target_id and tonumber(target_id) then ++ local si_target = linkables_om:lookup { ++ Constraint { "node.id", "=", target_id }, ++ } ++ if si_target and canLink (properties, si_target) then ++ return si_target ++ end ++ end ++ ++ if target_id then ++ for si_target in linkables_om:iterate() do ++ local target_props = si_target.properties ++ if (target_props["node.name"] == target_id or ++ target_props["object.path"] == target_id) and ++ target_props["item.node.direction"] == target_direction and ++ canLink (properties, si_target) then ++ return si_target ++ end ++ end ++ end ++ return nil ++end ++ + -- Try to locate a valid target node that was NOT explicitly defined by the user + -- `properties` must be the properties dictionary of the session item + -- that is currently being handled +-- +GitLab + diff --git a/wireplumber.changes b/wireplumber.changes index 80ecc31..f9b3204 100644 --- a/wireplumber.changes +++ b/wireplumber.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Tue Oct 19 10:59:25 UTC 2021 - Antonio Larrosa + +- Add patch from upstream to fix selection of capture ports instead + of monitor ports: + * 0002-policy-node-enforce-the-direction-of-the-target-when-linking-by-node-name.patch + ------------------------------------------------------------------- Tue Oct 19 07:25:22 UTC 2021 - Antonio Larrosa diff --git a/wireplumber.spec b/wireplumber.spec index 602b39b..6854c5e 100644 --- a/wireplumber.spec +++ b/wireplumber.spec @@ -29,6 +29,7 @@ Group: Development/Libraries/C and C++ URL: https://gitlab.freedesktop.org/pipewire/wireplumber Source0: wireplumber-%{version}.tar.xz Patch0: 0001-si-standard-link-fix-crash-after-returning-a-link-error.patch +Patch1: 0002-policy-node-enforce-the-direction-of-the-target-when-linking-by-node-name.patch BuildRequires: cmake BuildRequires: cpptoml-devel BuildRequires: doxygen @@ -129,6 +130,7 @@ the wireplumber shared library. %prep %setup -n wireplumber-%{version} %patch0 -p1 +%patch1 -p1 %build %if %{pkg_vcmp gcc < 8}