Accepting request 1179668 from multimedia:libs

OBS-URL: https://build.opensuse.org/request/show/1179668
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/wireplumber?expand=0&rev=38
This commit is contained in:
Ana Guerrero 2024-06-11 16:27:14 +00:00 committed by Git OBS Bridge
commit 821058301c
13 changed files with 65 additions and 417 deletions

View File

@ -1,34 +0,0 @@
From 709eecb21f30a157b9a4aa8ab45a4c1ec608d628 Mon Sep 17 00:00:00 2001
From: Stefan Ursella <stefan.ursella@wolfvision.net>
Date: Fri, 26 Apr 2024 07:27:31 +0200
Subject: [PATCH] lua: json: fix error ouput
---
modules/module-lua-scripting/api/json.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/modules/module-lua-scripting/api/json.c b/modules/module-lua-scripting/api/json.c
index 242f0e410..5afa5c914 100644
--- a/modules/module-lua-scripting/api/json.c
+++ b/modules/module-lua-scripting/api/json.c
@@ -281,7 +281,7 @@ spa_json_array_new (lua_State *L)
break;
}
default:
- luaL_error (L, "Json does not support lua type ",
+ luaL_error (L, "Json does not support lua type %s",
lua_typename(L, lua_type(L, -1)));
break;
}
@@ -327,7 +327,7 @@ spa_json_object_new (lua_State *L)
break;
}
default:
- luaL_error (L, "Json does not support lua type ",
+ luaL_error (L, "Json does not support lua type %s",
lua_typename(L, lua_type(L, -1)));
break;
}
--
GitLab

View File

@ -1,77 +0,0 @@
From fd7a1af7ffec4be04348b4807a4a8f95777e2515 Mon Sep 17 00:00:00 2001
From: Stefan Ursella <stefan.ursella@wolfvision.net>
Date: Fri, 26 Apr 2024 07:26:52 +0200
Subject: [PATCH] lua: json: add method to merge json containers
---
modules/module-lua-scripting/api/json.c | 15 +++++++++++++++
tests/wplua/scripts/json.lua | 23 +++++++++++++++++++++++
2 files changed, 38 insertions(+)
diff --git a/modules/module-lua-scripting/api/json.c b/modules/module-lua-scripting/api/json.c
index 39f6b10f0..242f0e410 100644
--- a/modules/module-lua-scripting/api/json.c
+++ b/modules/module-lua-scripting/api/json.c
@@ -167,6 +167,20 @@ push_luajson (lua_State *L, WpSpaJson *json, gint n_recursions)
}
}
+static int
+spa_json_merge (lua_State *L)
+{
+ WpSpaJson *a = wplua_checkboxed (L, 1, WP_TYPE_SPA_JSON);
+ WpSpaJson *b = wplua_checkboxed (L, 2, WP_TYPE_SPA_JSON);
+
+ WpSpaJson *merge = wp_json_utils_merge_containers(a, b);
+ if(!merge)
+ luaL_error (L, "only Json container merge supported");
+
+ wplua_pushboxed (L, WP_TYPE_SPA_JSON, merge);
+ return 1;
+}
+
static int
spa_json_parse (lua_State *L)
{
@@ -340,6 +354,7 @@ static const luaL_Reg spa_json_methods[] = {
{ "is_array", spa_json_is_array },
{ "is_object", spa_json_is_object },
{ "parse", spa_json_parse },
+ { "merge", spa_json_merge },
{ NULL, NULL }
};
diff --git a/tests/wplua/scripts/json.lua b/tests/wplua/scripts/json.lua
index 52a8a3823..03e14ba6d 100644
--- a/tests/wplua/scripts/json.lua
+++ b/tests/wplua/scripts/json.lua
@@ -240,3 +240,26 @@ assert (type (val.args) == "table")
assert (type (val.args.test) == "table")
assert (val.args.test[1] == 0)
assert (val.args.test[2] == 1)
+
+json = Json.Array { "foo" }
+json2 = Json.Array { "bar" }
+json = json:merge(json2)
+assert (json:is_array())
+val = json:parse ()
+assert (val[1] == "foo")
+assert (val[2] == "bar")
+
+table = {}
+table["1"] = 1
+table["2"] = 2
+json = Json.Object (table)
+table = {}
+table["3"] = 3
+table["4"] = 4
+json2 = Json.Object (table)
+json = json:merge(json2)
+val = json:parse ()
+assert (val["1"] == 1)
+assert (val["2"] == 2)
+assert (val["3"] == 3)
+assert (val["4"] == 4)
--
GitLab

View File

@ -1,58 +0,0 @@
From e6a70db254585b2cd9f3265fdafc884a48c3682d Mon Sep 17 00:00:00 2001
From: George Kiagiadakis <george.kiagiadakis@collabora.com>
Date: Fri, 3 May 2024 15:54:37 +0300
Subject: [PATCH] json-utils: fix overriding of non-container values when
merging
Non-container values should always be overriden
Fixes: #653
---
lib/wp/json-utils.c | 4 ++--
tests/wplua/scripts/json.lua | 7 +++++++
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/lib/wp/json-utils.c b/lib/wp/json-utils.c
index 53d1b2b1b..936ad449e 100644
--- a/lib/wp/json-utils.c
+++ b/lib/wp/json-utils.c
@@ -211,12 +211,12 @@ merge_json_objects (WpSpaJson *a, WpSpaJson *b)
g_return_val_if_fail (wp_iterator_next (it, &item), NULL);
val = g_value_dup_boxed (&item);
- if (!override &&
+ if (!override && wp_spa_json_is_container (val) &&
(wp_spa_json_object_get (a, key_str, "J", &j, NULL) ||
wp_spa_json_object_get (a, override_key_str, "J", &j, NULL))) {
g_autoptr (WpSpaJson) merged = wp_json_utils_merge_containers (j, val);
if (!merged) {
- wp_warning ("skipping merge of %s as JSON values are not compatible",
+ wp_warning ("skipping merge of %s as JSON values are not compatible containers",
key_str);
continue;
}
diff --git a/tests/wplua/scripts/json.lua b/tests/wplua/scripts/json.lua
index 03e14ba6d..5489bab23 100644
--- a/tests/wplua/scripts/json.lua
+++ b/tests/wplua/scripts/json.lua
@@ -241,6 +241,7 @@ assert (type (val.args.test) == "table")
assert (val.args.test[1] == 0)
assert (val.args.test[2] == 1)
+-- merge
json = Json.Array { "foo" }
json2 = Json.Array { "bar" }
json = json:merge(json2)
@@ -263,3 +264,9 @@ assert (val["1"] == 1)
assert (val["2"] == 2)
assert (val["3"] == 3)
assert (val["4"] == 4)
+
+json = Json.Object { ["a"] = "foo" }
+json2 = Json.Object { ["a"] = "bar" }
+json = json:merge(json2)
+val = json:parse ()
+assert (val["a"] == "bar")
--
GitLab

View File

@ -1,25 +0,0 @@
From 1ddfbc532c87fb0ad18e128d574e5c3b72089416 Mon Sep 17 00:00:00 2001
From: Barnabas Pocze <pobrn@protonmail.com>
Date: Sat, 18 May 2024 00:46:58 +0200
Subject: [PATCH 4/7] transition: fix memory leak when error is already set
Fixes: 18377fbf829ff2 ("transition: don't allow _return_error() to be called recursively")
---
lib/wp/transition.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/lib/wp/transition.c b/lib/wp/transition.c
index 547f555f0..0538208f4 100644
--- a/lib/wp/transition.c
+++ b/lib/wp/transition.c
@@ -493,6 +493,7 @@ wp_transition_return_error (WpTransition * self, GError * error)
if (G_UNLIKELY (priv->error)) {
wp_warning_object (self, "transition bailing out multiple times; "
"new error is: %s", error->message);
+ g_error_free (error);
return;
}
--
2.45.1

View File

@ -1,131 +0,0 @@
From 89b6766cd6a64c8d52512ae2c091de3f5aae034f Mon Sep 17 00:00:00 2001
From: Barnabas Pocze <pobrn@protonmail.com>
Date: Sat, 18 May 2024 00:53:33 +0200
Subject: [PATCH 5/7] transition: ensure single completion and finish
At the moment, the same transition can be completed multiple times
(assuming sufficiently high reference count):
return_error()
finish()
return_error()
The consequence of that is that the transition closure will be
invoked multiple times. This is unexpected.
Add some guards against completing a transition or calling finish()
multiple times.
Fixes #628
---
lib/wp/transition.c | 34 ++++++++++++++++++++++++++++------
1 file changed, 28 insertions(+), 6 deletions(-)
diff --git a/lib/wp/transition.c b/lib/wp/transition.c
index 0538208f4..1e8bba2f5 100644
--- a/lib/wp/transition.c
+++ b/lib/wp/transition.c
@@ -66,6 +66,8 @@ struct _WpTransitionPrivate
/* state machine */
gboolean started;
+ gboolean completed;
+ gboolean finished;
guint step;
GError *error;
};
@@ -348,8 +350,7 @@ wp_transition_get_completed (WpTransition * self)
g_return_val_if_fail (WP_IS_TRANSITION (self), FALSE);
WpTransitionPrivate *priv = wp_transition_get_instance_private (self);
- return (priv->step == WP_TRANSITION_STEP_NONE && priv->started) ||
- priv->step == WP_TRANSITION_STEP_ERROR;
+ return priv->completed;
}
/*!
@@ -370,6 +371,8 @@ wp_transition_had_error (WpTransition * self)
static void
wp_transition_return (WpTransition * self, WpTransitionPrivate *priv)
{
+ g_assert (priv->completed);
+
if (priv->closure) {
GValue values[2] = { G_VALUE_INIT, G_VALUE_INIT };
g_value_init (&values[0], G_TYPE_OBJECT);
@@ -427,6 +430,11 @@ wp_transition_advance (WpTransition * self)
guint next_step;
GError *error = NULL;
+ if (priv->completed) {
+ wp_warning_object (priv->source_object, "tried to advance completed transition");
+ return;
+ }
+
priv->started = TRUE;
if (g_cancellable_set_error_if_cancelled (priv->cancellable, &error)) {
@@ -442,17 +450,20 @@ wp_transition_advance (WpTransition * self)
if (next_step == WP_TRANSITION_STEP_ERROR) {
/* return error if the callback didn't do it already */
- if (G_UNLIKELY (!priv->error)) {
+ if (G_UNLIKELY (!priv->completed)) {
wp_transition_return_error (self, g_error_new (WP_DOMAIN_LIBRARY,
WP_LIBRARY_ERROR_INVARIANT, "state machine error"));
}
return;
}
+ g_assert (!priv->completed);
+
/* if we reached STEP_NONE again, that means we reached the next state */
if (next_step == WP_TRANSITION_STEP_NONE) {
/* complete the transition */
priv->step = next_step;
+ priv->completed = TRUE;
wp_transition_return (self, priv);
return;
}
@@ -490,15 +501,16 @@ wp_transition_return_error (WpTransition * self, GError * error)
/* don't allow _return_error() to be called multiple times,
as it is dangerous to recurse in execute_step() */
- if (G_UNLIKELY (priv->error)) {
- wp_warning_object (self, "transition bailing out multiple times; "
- "new error is: %s", error->message);
+ if (G_UNLIKELY (priv->completed)) {
+ wp_warning_object (priv->source_object,
+ "tried to set error on completed transition: %s", error->message);
g_error_free (error);
return;
}
priv->step = WP_TRANSITION_STEP_ERROR;
priv->error = error;
+ priv->completed = TRUE;
/* allow the implementation to rollback changes */
if (WP_TRANSITION_GET_CLASS (self)->execute_step)
@@ -535,8 +547,18 @@ wp_transition_finish (GAsyncResult * res, GError ** error)
priv->step = WP_TRANSITION_STEP_ERROR;
g_propagate_error (error, g_error_new (WP_DOMAIN_LIBRARY,
WP_LIBRARY_ERROR_INVARIANT, "finished before starting"));
+ } else if (!priv->completed) {
+ priv->step = WP_TRANSITION_STEP_ERROR;
+ g_propagate_error (error, g_error_new (WP_DOMAIN_LIBRARY,
+ WP_LIBRARY_ERROR_INVARIANT, "finished before completion"));
+ } else if (priv->finished) {
+ priv->step = WP_TRANSITION_STEP_ERROR;
+ g_propagate_error (error, g_error_new (WP_DOMAIN_LIBRARY,
+ WP_LIBRARY_ERROR_INVARIANT, "finished multiple times"));
}
+ priv->finished = TRUE;
+
wp_trace_object (priv->source_object, "transition: finished %s",
(priv->step == WP_TRANSITION_STEP_NONE) ? "ok" : "with error");
--
2.45.1

View File

@ -1,28 +0,0 @@
From 4ed51791e03b63adbaf792564aa201a6d71a1050 Mon Sep 17 00:00:00 2001
From: Barnabas Pocze <pobrn@protonmail.com>
Date: Sat, 18 May 2024 01:04:42 +0200
Subject: [PATCH 6/7] linking: return after aborting transition
Avoid calling return_error() on the same transition multiple times.
Fixes: 4b153ec55354da ("link-target.lua: change into a async hook")
See #628
---
src/scripts/linking/link-target.lua | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/scripts/linking/link-target.lua b/src/scripts/linking/link-target.lua
index 62be86cec..f49bf513f 100644
--- a/src/scripts/linking/link-target.lua
+++ b/src/scripts/linking/link-target.lua
@@ -50,6 +50,7 @@ AsyncEventHook {
si_flags.failed_count > 5 then
transition:return_error ("tried to link on last rescan, not retrying "
.. tostring (si_link))
+ return
end
if si_props ["item.factory.name"] == "si-audio-virtual" then
--
2.45.1

View File

@ -1,48 +0,0 @@
From df8bc12464c6b582fc1a5f46e4a3a025557bc58b Mon Sep 17 00:00:00 2001
From: George Kiagiadakis <george.kiagiadakis@collabora.com>
Date: Fri, 24 May 2024 20:36:28 +0300
Subject: [PATCH 7/7] state-stream: fix using the default volume
When there was no previous state stored, the default volume was
also not applied because the code would return from the hook early
Fixes: #655
---
src/scripts/node/state-stream.lua | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/scripts/node/state-stream.lua b/src/scripts/node/state-stream.lua
index f5ac95d54..e2fc7efee 100644
--- a/src/scripts/node/state-stream.lua
+++ b/src/scripts/node/state-stream.lua
@@ -52,10 +52,7 @@ restore_stream_hook = SimpleEventHook {
return
end
- local stored_values = getStoredStreamProps (key)
- if not stored_values then
- return
- end
+ local stored_values = getStoredStreamProps (key) or {}
-- restore node Props (volumes, channelMap, etc...)
if Settings.get_boolean ("node.stream.restore-props") and stream_props ["state.restore-props"] ~= "false"
@@ -356,11 +353,14 @@ function buildDefaultChannelVolumes (node)
end
end
+ log:info (node, "using default volume: " .. tostring(def_vol) ..
+ ", channels: " .. tostring(channels))
+
while (#res < channels) do
table.insert(res, def_vol)
end
- return res;
+ return res
end
function getStoredStreamProps (key)
--
2.45.1

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">0.5.2</param>
<param name="revision">0.5.3</param>
<param name="versionformat">@PARENT_TAG@</param>
<!--
<param name="revision">master</param>

View File

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

View File

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

View File

@ -1,3 +1,59 @@
-------------------------------------------------------------------
Tue Jun 4 22:08:54 UTC 2024 - Alexei Sorokin <sor.alexei@meowr.ru>
- Update to version 0.5.3:
* Fixes:
- Fix a long standing issue that would cause many device nodes
to have inconsistent naming, with a '.N' suffix (where N is
a number >= 2) being appended at seemingly random times.
- Fix an issue that would cause unavailable device profiles to
be selected if they were previously stored in the state file,
sometimes requiring users to manually remove the state file
to get things working again.
- Fix an occasional crash that could sometimes be triggered by
hovering the volume icon on the KDE taskbar, and possibly
other similar actions.
- Fix camera device deduplication logic when the same device
is available through both V4L2 and libcamera, and the
libcamera one groups multiple V4L2 devices together.
- Fix applying the default volume on streams that have no
volume previously stored in the state file.
- Fix an issue that would prevent some camera nodes,
in some cases, from being destroyed when the camera device
is removed.
- Fix an issue that would cause video stream nodes to be
linked with audio smart filters, if smart audio filters were
configured.
- Fix an issue that would cause WP to re-activate device
profiles even though they were already active.
- Configuration files in standard JSON format (starting with a
'{', among other things) are now correctly parsed.
- Fix overriding non-container values when merging JSON
objects.
- Functions marked with WP_PRIVATE_API are now also marked as
non-introspectable in the gobject-introspection metadata.
* Improvements:
- Logging on the systemd journal now includes the log topic
and also the log level and location directly on the message
string when the log level is high enough, which is useful
for gathering additional context in logs submitted by users.
- Add a video-only profile in wireplumber.conf, for systems
where only camera & screensharing are to be used.
- Improve seat state monitoring so that Bluetooth devices are
only enabled when the user is active on a local seat,
instead of allowing remote users as well.
- Improve how main filter nodes are detected for the smart
filters.
- Add Lua method to merge JSON containers.
- Remove patch already included upstream:
* 0001-lua-json-fix-error-ouput.patch
* 0002-lua-json-add-method-to-merge-json-containers.patch
* 0003-json-utils-fix-overriding-of-non-container-values-when.patch
* 0004-transition-fix-memleak-when-error-set.patch
* 0005-transition-ensure-single-completion-and-finish.patch
* 0006-linking-return-after-aborting-transition.patch
* 0007-state-stream-fix-using-default-volume.patch
-------------------------------------------------------------------
Sat May 25 13:28:01 UTC 2024 - Alexei Sorokin <sor.alexei@meowr.ru>

View File

@ -1,4 +1,4 @@
name: wireplumber
version: 0.5.2
mtime: 1713795587
commit: b302ebd6ab66fd538191d22db4ebe02bcef87a91
version: 0.5.3
mtime: 1717242816
commit: 65e4ae83b994616401fc5859e00d5051b72518ba

View File

@ -22,7 +22,7 @@
%define sover 0
%define libwireplumber libwireplumber-%{apiver_str}-%{sover}
Name: wireplumber
Version: 0.5.2
Version: 0.5.3
Release: 0
Summary: Session / policy manager implementation for PipeWire
License: MIT
@ -30,13 +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
Patch0: 0001-lua-json-fix-error-ouput.patch
Patch1: 0002-lua-json-add-method-to-merge-json-containers.patch
Patch2: 0003-json-utils-fix-overriding-of-non-container-values-when.patch
Patch3: 0004-transition-fix-memleak-when-error-set.patch
Patch4: 0005-transition-ensure-single-completion-and-finish.patch
Patch5: 0006-linking-return-after-aborting-transition.patch
Patch6: 0007-state-stream-fix-using-default-volume.patch
# docs
BuildRequires: doxygen
BuildRequires: graphviz
@ -72,7 +65,7 @@ Provides: pipewire-session-manager
BuildRequires: gcc9
BuildRequires: gcc9-c++
%else
BuildRequires: gcc-c++
BuildRequires: c++_compiler
%endif
%{?systemd_ordering}