forked from pool/wireplumber
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
This commit is contained in:
parent
ee9013bfde
commit
6691718a40
@ -0,0 +1,116 @@
|
||||
From f8ced47a1a9595b32c59ece24b864bafbdcc74fe Mon Sep 17 00:00:00 2001
|
||||
From: George Kiagiadakis <george.kiagiadakis@collabora.com>
|
||||
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
|
||||
|
@ -1,3 +1,10 @@
|
||||
-------------------------------------------------------------------
|
||||
Tue Oct 19 10:59:25 UTC 2021 - Antonio Larrosa <alarrosa@suse.com>
|
||||
|
||||
- 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 <alarrosa@suse.com>
|
||||
|
||||
|
@ -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}
|
||||
|
Loading…
Reference in New Issue
Block a user