Accepting request 1128889 from multimedia:libs

OBS-URL: https://build.opensuse.org/request/show/1128889
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/wireplumber?expand=0&rev=26
This commit is contained in:
Ana Guerrero 2023-11-27 21:42:35 +00:00 committed by Git OBS Bridge
commit cca1854d28
10 changed files with 61 additions and 210 deletions

View File

@ -1,36 +0,0 @@
From 5fc7e68d109b646c550e3fdeddebadc5047137a2 Mon Sep 17 00:00:00 2001
From: George Kiagiadakis <george.kiagiadakis@collabora.com>
Date: Mon, 23 Oct 2023 23:04:02 +0300
Subject: [PATCH] object-manager: reduce the amount of globals that initially
match the interest
With the previous check, any global matching either the type or the global
properties of the interest would be considered for inclusion in the object
manager and would be prepared only to fail the same check later.
The correct way to check is (variable & (X|Y) == (X|Y)), which is what
SPA_FLAG_IS_SET() expands to.
Fixes #517
---
lib/wp/object-manager.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/wp/object-manager.c b/lib/wp/object-manager.c
index 6f58653ba..dea7857e1 100644
--- a/lib/wp/object-manager.c
+++ b/lib/wp/object-manager.c
@@ -638,8 +638,8 @@ wp_object_manager_is_interested_in_global (WpObjectManager * self,
/* and consider the manager interested if the type and the globals match...
if pw_properties / g_properties fail, that's ok because they are not
known yet (the proxy is likely NULL and properties not yet retrieved) */
- if (match & (WP_INTEREST_MATCH_GTYPE |
- WP_INTEREST_MATCH_PW_GLOBAL_PROPERTIES)) {
+ if (SPA_FLAG_IS_SET (match, (WP_INTEREST_MATCH_GTYPE |
+ WP_INTEREST_MATCH_PW_GLOBAL_PROPERTIES))) {
gpointer ft = g_hash_table_lookup (self->features,
GSIZE_TO_POINTER (global->type));
*wanted_features = (WpObjectFeatures) GPOINTER_TO_UINT (ft);
--
GitLab

View File

@ -1,69 +0,0 @@
From 7a65d76a57a5a656a5d9385b0144d15b376ddc7d Mon Sep 17 00:00:00 2001
From: James Calligeros <jcalligeros99@gmail.com>
Date: Sun, 29 Oct 2023 11:03:36 +1000
Subject: [PATCH] policy-dsp: add ability to hide parent nodes
some hardware devices are never supposed to be accessed directly by
clients, and are designed under the assumption that they will be
front-loaded by some sort of DSP. add a hide_parent property
to policy-dsp and revoke all permissions to the bound node of a DSP
graph where this is set to prevent hardware misuse or damage by poorly
behaved/configured clients.
Signed-off-by: James Calligeros <jcalligeros99@gmail.com>
---
src/scripts/policy-dsp.lua | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/src/scripts/policy-dsp.lua b/src/scripts/policy-dsp.lua
index 55f86c68..ce23a67a 100644
--- a/src/scripts/policy-dsp.lua
+++ b/src/scripts/policy-dsp.lua
@@ -28,7 +28,12 @@ nodes_om = ObjectManager {
Interest { type = "node" },
}
+clients_om = ObjectManager {
+ Interest { type = "client" }
+}
+
filter_chains = {}
+hidden_nodes = {}
nodes_om:connect("object-added", function (om, node)
for _, r in ipairs(config.rules or {}) do
@@ -43,6 +48,17 @@ nodes_om:connect("object-added", function (om, node)
filter_chains[id] = LocalModule("libpipewire-module-filter-chain", r.filter_chain, {}, true)
end
end
+
+ if r.hide_parent then
+ Log.debug("Hiding node " .. node["bound-id"] .. " from clients")
+ for client in clients_om:iterate { type = "client" } do
+ if not client["properties"]["wireplumber.daemon"] then
+ client:update_permissions { [node["bound-id"]] = "-" }
+ end
+ end
+ hidden_nodes[node["bound-id"]] = id
+ end
+
end
end
end
@@ -58,4 +74,13 @@ nodes_om:connect("object-removed", function (om, node)
end
end)
+clients_om:connect("object-added", function (om, client)
+ for id, _ in pairs(hidden_nodes) do
+ if not client["properties"]["wireplumber.daemon"] then
+ client:update_permissions { [id] = "-" }
+ end
+ end
+end)
+
nodes_om:activate()
+clients_om:activate()
--
GitLab

View File

@ -1,88 +0,0 @@
From 23ba01970f2520fb30fddc4ee911d77cdda9ac22 Mon Sep 17 00:00:00 2001
From: George Kiagiadakis <george.kiagiadakis@collabora.com>
Date: Mon, 23 Oct 2023 23:08:45 +0300
Subject: [PATCH] object-manager: use an idle callback to expose tmp globals
instead of pw_core_sync
A core sync is not really necessary here because whatever objects the remote
pipewire daemon has to announce have already been sent to us on a message
and this message is already being processed at this point. This means, we are
not going to be returning to the main loop until all the new objects have been
announced and therefore placed into the tmp globals array. So, we can also use
an idle callback and achieve the same effect of slightly delaying until all
new globals have been announced.
With an idle callback, we can be more agile and add those new objects immediately
after the message has been processed instead of waiting for a pw_core_sync()
reply, which will come in the next message.
This fixes an odd failure of the si-standard-link test after applying the fix
for #517, which was caused by the fact that the test was previously relying on
a delay caused by some unrelated globals being prepared in the object manager
that tries to verify the graph state. After those globals were removed from the
internal preparation queue, the test would fail to detect the link objects
because they were stuck in the tmp_globals array for too long.
---
lib/wp/object-manager.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/lib/wp/object-manager.c b/lib/wp/object-manager.c
index dea7857e..816db6dc 100644
--- a/lib/wp/object-manager.c
+++ b/lib/wp/object-manager.c
@@ -1047,18 +1047,15 @@ wp_registry_detach (WpRegistry *self)
}
}
-static void
-expose_tmp_globals (WpCore *core, GAsyncResult *res, WpRegistry *self)
+static gboolean
+expose_tmp_globals (WpCore *core)
{
- g_autoptr (GError) error = NULL;
+ WpRegistry *self = wp_core_get_registry (core);
g_autoptr (GPtrArray) tmp_globals = NULL;
- if (!wp_core_sync_finish (core, res, &error))
- wp_warning_object (core, "core sync error: %s", error->message);
-
/* in case the registry was cleared in the meantime... */
if (G_UNLIKELY (!self->tmp_globals))
- return;
+ return G_SOURCE_REMOVE;
/* steal the tmp_globals list and replace it with an empty one */
tmp_globals = self->tmp_globals;
@@ -1082,8 +1079,8 @@ expose_tmp_globals (WpCore *core, GAsyncResult *res, WpRegistry *self)
wp_global_rm_flag (old_g, WP_GLOBAL_FLAG_OWNED_BY_PROXY);
}
- g_return_if_fail (self->globals->len <= g->id ||
- g_ptr_array_index (self->globals, g->id) == NULL);
+ g_return_val_if_fail (self->globals->len <= g->id ||
+ g_ptr_array_index (self->globals, g->id) == NULL, G_SOURCE_REMOVE);
/* set the registry, so that wp_global_rm_flag() can work full-scale */
g->registry = self;
@@ -1109,6 +1106,8 @@ expose_tmp_globals (WpCore *core, GAsyncResult *res, WpRegistry *self)
}
wp_object_manager_maybe_objects_changed (om);
}
+
+ return G_SOURCE_REMOVE;
}
/*
@@ -1159,7 +1158,8 @@ wp_registry_prepare_new_global (WpRegistry * self, guint32 id,
/* schedule exposing when adding the first global */
if (self->tmp_globals->len == 1) {
- wp_core_sync (core, NULL, (GAsyncReadyCallback) expose_tmp_globals, self);
+ wp_core_idle_add_closure (core, NULL,
+ g_cclosure_new_object (G_CALLBACK (expose_tmp_globals), G_OBJECT (core)));
}
} else {
/* store the most permissive permissions */
--
GitLab

View File

@ -3,7 +3,7 @@
<service name="obs_scm" mode="manual">
<param name="scm">git</param>
<param name="url">https://gitlab.freedesktop.org/pipewire/wireplumber.git</param>
<param name="revision">refs/tags/0.4.15</param>
<param name="revision">refs/tags/0.4.16</param>
<param name="versionformat">@PARENT_TAG@</param>
<!--
<param name="revision">master</param>

View File

@ -10,7 +10,7 @@ def sha256_from_data(data):
contents = open('90-enable-all.lua', 'r', encoding='utf-8').read()
sha256sum = sha256_from_data(contents.encode('utf-8'))
expected_sha256sum = 'cb9f05eb3b4959b84e94a67867645130f2bc0aa761eb864d227890aea310ab74'
expected_sha256sum = '86888e9d3fcc952c41e778ab4edae4a0eb1f9f51b62ae0772befa9f0fdef611d'
if sha256sum != expected_sha256sum:
print('The script has to be updated for new changes in 90-enable-all.lua')
@ -26,7 +26,8 @@ sections = ['enable-metadata',
'track-user-choices-devices',
'track-user-choices-streams',
'link-nodes-by-roles',
'suspend-idle-nodes']
'suspend-idle-nodes',
'allow-loading-objects-on-demand']
if len(content_sections) != len(sections):
print('The script has to be updated for new changes in 90-enable-all.lua')
@ -39,6 +40,8 @@ for i, (content, sec) in enumerate(zip(content_sections, sections)):
encoding='utf-8').write(lines[1])
open(f'90-{i}-2-enable-v4l2.lua', 'w',
encoding='utf-8').write(lines[2])
open(f'90-{i}-3-enable-libcamera.lua', 'w',
encoding='utf-8').write(lines[3])
continue
filename = f'90-{i}-{sec}.lua'

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:fafdd45a3bf1bc5765ee6b597590923bd530101d73a9ec8b591610b59ccbdb3b
size 2188300

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f35dcc4b0ce7313a748c3f8ba4280970f4eb90cb8e318ff1fe1cb9f5ba0bbf10
size 2200588

View File

@ -1,3 +1,50 @@
-------------------------------------------------------------------
Sun Nov 26 11:02:03 UTC 2023 - Antonio Larrosa <alarrosa@suse.com>
- Update to version 0.4.16:
* Additions:
- Added a new "sm-objects" script that allows loading objects
on demand via metadata entries that describe the object to
load; this can be used to load pipewire modules, such as
filters or network sources/sinks, on demand
- Added a mechanism to override device profile priorities in
the configuration, mainly as a way to re-prioritize Bluetooth
codecs, but this also can be used for other devices
- Added a mechanism in the endpoints policy to allow connecting
filters between a certain endpoint's virtual sink and the
device sink; this is specifically intended to allow plugging
a filter-chain to act as equalizer on the Multimedia endpoint
- Added wp_core_get_own_bound_id() method in WpCore
* Changes:
- PipeWire 0.3.68 is now required
- policy-dsp now has the ability to hide hardware nodes behind
the DSP sink to prevent hardware misuse or damage
- JSON parsing in Lua now allows keys inside objects to be
without quotes
- Added optional argument in the Lua JSON parse() method to
limit recursions, making it possible to partially parse a
JSON object
- It is now possible to pass nil in Lua object constructors
that expect an optional properties object; previously,
omitting the argument was the only way to skip the properties
- The endpoints policy now marks the endpoint nodes as
"passive" instead of marking their links, adjusting for the
behavior change in PipeWire 0.3.68
- Removed the "passive" property from si-standard-link, since
only nodes are marked as passive now
* Fixes:
- Fixed the wpctl clear-default command to completely clear all
the default nodes state instead of only the last set default
- Reduced the amount of globals that initially match the
interest in the object manager
- Used an idle callback instead of pw_core_sync() in the object
manager to expose tmp globals
- Remove patches included upstream:
* 0001-object-manager-reduce-the-amount-of-globals-that-initially.patch
* 0002-object-manager-use-an-idle-callback-to-expose-tmp-globals.patch
* 0001-policy-dsp-add-ability-to-hide-parent-nodes.patch
- Update split-config-file.py
-------------------------------------------------------------------
Tue Oct 31 08:30:21 UTC 2023 - Antonio Larrosa <alarrosa@suse.com>

View File

@ -1,4 +1,4 @@
name: wireplumber
version: 0.4.15
mtime: 1697127866
commit: d67b48e595cb4612fd7fd47f97df6b8883ef7f60
version: 0.4.16
mtime: 1700662802
commit: 0d249b8a13d7168fe54fa6eb1db1c4a5fcc8d3f8

View File

@ -16,13 +16,13 @@
#
%define pipewire_minimum_version 0.3.52
%define pipewire_minimum_version 0.3.68
%define apiver 0.4
%define apiver_str 0_4
%define sover 0
%define libwireplumber libwireplumber-%{apiver_str}-%{sover}
Name: wireplumber
Version: 0.4.15
Version: 0.4.16
Release: 0
Summary: Session / policy manager implementation for PipeWire
License: MIT
@ -30,12 +30,6 @@ Group: Development/Libraries/C and C++
URL: https://gitlab.freedesktop.org/pipewire/wireplumber
Source0: wireplumber-%{version}.tar.xz
Source1: split-config-file.py
# PATCH-FIX-UPSTREAM
Patch0: 0001-object-manager-reduce-the-amount-of-globals-that-initially.patch
# PATCH-FIX-UPSTREAM
Patch1: 0002-object-manager-use-an-idle-callback-to-expose-tmp-globals.patch
# PATCH-FIX-UPSTREAM
Patch2: 0001-policy-dsp-add-ability-to-hide-parent-nodes.patch
# docs
BuildRequires: doxygen
BuildRequires: graphviz