From 8dc79b365be76580ed4585f16ed2cec4e0fc1cdf9fe4c8af4ecdd3962e84200e Mon Sep 17 00:00:00 2001 From: Antonio Larrosa Date: Fri, 18 Aug 2023 12:20:35 +0000 Subject: [PATCH] Accepting request 1104671 from home:alarrosa:branches:multimedia:libs - Fix from upstream to ensure effect and sink nodes are set to running: * 0001-context-Dont-stop-setting-runnable-when-meeting-the-driving.patch - Fix from upstream to prevent a crash when stopping a device provider: * 0001-gst-Prevent-a-crash-when-stopping-device-provider.patch - Fix from upstream to fix a regression that makes plugins/effects disappear in Carla Patchbay when there's no playback: * 0001-jack-ports-become-visible-when-the-registration-is-queued.patch * 0002-jack-handle-node.always-process-=-false-jack-nodes.patch - Fix from upstream to fix pavucontrol and plasma-pa showing duplicated sinks after resume or switching audio device profiles (boo#1214374): * 0001-pulse-server-set-all-change_mask-flags-when-removing.patch OBS-URL: https://build.opensuse.org/request/show/1104671 OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/pipewire?expand=0&rev=148 --- ...ng-runnable-when-meeting-the-driving.patch | 117 ++++++++++++++++++ ...-crash-when-stopping-device-provider.patch | 38 ++++++ ...ible-when-the-registration-is-queued.patch | 54 ++++++++ ...-all-change_mask-flags-when-removing.patch | 32 +++++ ...de.always-process-=-false-jack-nodes.patch | 44 +++++++ pipewire.changes | 21 ++++ pipewire.spec | 11 ++ 7 files changed, 317 insertions(+) create mode 100644 0001-context-Dont-stop-setting-runnable-when-meeting-the-driving.patch create mode 100644 0001-gst-Prevent-a-crash-when-stopping-device-provider.patch create mode 100644 0001-jack-ports-become-visible-when-the-registration-is-queued.patch create mode 100644 0001-pulse-server-set-all-change_mask-flags-when-removing.patch create mode 100644 0002-jack-handle-node.always-process-=-false-jack-nodes.patch diff --git a/0001-context-Dont-stop-setting-runnable-when-meeting-the-driving.patch b/0001-context-Dont-stop-setting-runnable-when-meeting-the-driving.patch new file mode 100644 index 0000000..d9edcfc --- /dev/null +++ b/0001-context-Dont-stop-setting-runnable-when-meeting-the-driving.patch @@ -0,0 +1,117 @@ +From 1daae4c369f464c8677696890e2eeb431c0f72a1 Mon Sep 17 00:00:00 2001 +From: Wim Taymans +Date: Fri, 4 Aug 2023 17:42:04 +0200 +Subject: [PATCH] context: Don't stop setting runnable when meeting the driving + node + +Start scanning from a non-driving runnable node in one direction and set +all linked intermedia nodes runnable as well. + +This ensure that play -> driving_sink -> effect -> sink also sets the +effect and sink nodes to running. + +Fixes #3405 +--- + src/pipewire/context.c | 60 ++++++++++++++++++++++-------------------- + 1 file changed, 31 insertions(+), 29 deletions(-) + +diff --git a/src/pipewire/context.c b/src/pipewire/context.c +index 8f9745b3f..9d9b629ae 100644 +--- a/src/pipewire/context.c ++++ b/src/pipewire/context.c +@@ -787,44 +787,44 @@ static int ensure_state(struct pw_impl_node *node, bool running) + return pw_impl_node_set_state(node, state); + } + +-/* From a node (that is runnable) follow all prepared links and groups to +- * active nodes up to the driver and make them recursively runnable as well. +- * +- * We stop at driver nodes so that other paths linked to the driver will stay +- * unrunnable when no other runnable path exists. ++/* From a node (that is runnable) follow all prepared links in the given direction ++ * and groups to active nodes and make them recursively runnable as well. + */ +-static inline int run_nodes(struct pw_context *context, struct pw_impl_node *node, struct spa_list *nodes) ++static inline int run_nodes(struct pw_context *context, struct pw_impl_node *node, ++ struct spa_list *nodes, enum pw_direction direction) + { + struct pw_impl_node *t; + struct pw_impl_port *p; + struct pw_impl_link *l; + +- pw_log_debug("node %p: '%s'", node, node->name); ++ pw_log_debug("node %p: '%s' direction:%s", node, node->name, ++ pw_direction_as_string(direction)); + +- spa_list_for_each(p, &node->input_ports, link) { +- spa_list_for_each(l, &p->links, input_link) { +- t = l->output->node; ++ if (direction == PW_DIRECTION_INPUT) { ++ spa_list_for_each(p, &node->input_ports, link) { ++ spa_list_for_each(l, &p->links, input_link) { ++ t = l->output->node; + +- if (!t->active || !l->prepared || t->runnable) +- continue; ++ if (!t->active || !l->prepared || (!t->driving && t->runnable)) ++ continue; + +- pw_log_debug(" peer %p: '%s'", t, t->name); +- t->runnable = true; +- if (!t->driving) +- run_nodes(context, t, nodes); ++ pw_log_debug(" peer %p: '%s'", t, t->name); ++ t->runnable = true; ++ run_nodes(context, t, nodes, direction); ++ } + } +- } +- spa_list_for_each(p, &node->output_ports, link) { +- spa_list_for_each(l, &p->links, output_link) { +- t = l->input->node; ++ } else { ++ spa_list_for_each(p, &node->output_ports, link) { ++ spa_list_for_each(l, &p->links, output_link) { ++ t = l->input->node; + +- if (!t->active || !l->prepared || t->runnable) +- continue; ++ if (!t->active || !l->prepared || (!t->driving && t->runnable)) ++ continue; + +- pw_log_debug(" peer %p: '%s'", t, t->name); +- t->runnable = true; +- if (!t->driving) +- run_nodes(context, t, nodes); ++ pw_log_debug(" peer %p: '%s'", t, t->name); ++ t->runnable = true; ++ run_nodes(context, t, nodes, direction); ++ } + } + } + /* now go through all the nodes that have the same link group and +@@ -842,7 +842,7 @@ static inline int run_nodes(struct pw_context *context, struct pw_impl_node *nod + pw_log_debug(" group %p: '%s'", t, t->name); + t->runnable = true; + if (!t->driving) +- run_nodes(context, t, nodes); ++ run_nodes(context, t, nodes, direction); + } + } + return 0; +@@ -944,8 +944,10 @@ static int collect_nodes(struct pw_context *context, struct pw_impl_node *node, + pw_log_debug(" next node %p: '%s' runnable:%u", n, n->name, n->runnable); + } + spa_list_for_each(n, collect, sort_link) +- if (!n->driving && n->runnable) +- run_nodes(context, n, collect); ++ if (!n->driving && n->runnable) { ++ run_nodes(context, n, collect, PW_DIRECTION_OUTPUT); ++ run_nodes(context, n, collect, PW_DIRECTION_INPUT); ++ } + + return 0; + } +-- +GitLab + diff --git a/0001-gst-Prevent-a-crash-when-stopping-device-provider.patch b/0001-gst-Prevent-a-crash-when-stopping-device-provider.patch new file mode 100644 index 0000000..4992754 --- /dev/null +++ b/0001-gst-Prevent-a-crash-when-stopping-device-provider.patch @@ -0,0 +1,38 @@ +From 140374d2071e6204fded4ca65645d4e9a3dd053e Mon Sep 17 00:00:00 2001 +From: Philippe Normand +Date: Fri, 4 Aug 2023 10:01:07 +0100 +Subject: [PATCH] gst: Prevent a crash when stopping device provider + +The provider might fail to connect to the PipeWire core when starting up, so +when stopping we need to check the core is valid before attempting to acquire a +mutex on its loop. +--- + src/gst/gstpipewiredeviceprovider.c | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +diff --git a/src/gst/gstpipewiredeviceprovider.c b/src/gst/gstpipewiredeviceprovider.c +index a9d8dd8b2..9f82507b3 100644 +--- a/src/gst/gstpipewiredeviceprovider.c ++++ b/src/gst/gstpipewiredeviceprovider.c +@@ -665,11 +665,16 @@ gst_pipewire_device_provider_stop (GstDeviceProvider * provider) + { + GstPipeWireDeviceProvider *self = GST_PIPEWIRE_DEVICE_PROVIDER (provider); + +- pw_thread_loop_lock (self->core->loop); ++ /* core might be NULL if we failed to connect in _start. */ ++ if (self->core != NULL) { ++ pw_thread_loop_lock (self->core->loop); ++ } + GST_DEBUG_OBJECT (self, "stopping provider"); + + g_clear_pointer ((struct pw_proxy**)&self->registry, pw_proxy_destroy); +- pw_thread_loop_unlock (self->core->loop); ++ if (self->core != NULL) { ++ pw_thread_loop_unlock (self->core->loop); ++ } + g_clear_pointer (&self->core, gst_pipewire_core_release); + } + +-- +GitLab + diff --git a/0001-jack-ports-become-visible-when-the-registration-is-queued.patch b/0001-jack-ports-become-visible-when-the-registration-is-queued.patch new file mode 100644 index 0000000..17d1958 --- /dev/null +++ b/0001-jack-ports-become-visible-when-the-registration-is-queued.patch @@ -0,0 +1,54 @@ +From 31f91ce9f4302cea55244ab741022e40bbd4e716 Mon Sep 17 00:00:00 2001 +From: Wim Taymans +Date: Mon, 7 Aug 2023 19:57:01 +0200 +Subject: [PATCH] jack: ports become visible when the registration is queued + +As soon as the port registration is queued (but not yet emited) the port +becomes visible. + +See #3416 +--- + pipewire-jack/src/pipewire-jack.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/pipewire-jack/src/pipewire-jack.c b/pipewire-jack/src/pipewire-jack.c +index 3d71f67be..7547d6ffb 100644 +--- a/pipewire-jack/src/pipewire-jack.c ++++ b/pipewire-jack/src/pipewire-jack.c +@@ -171,6 +171,7 @@ struct object { + struct spa_hook proxy_listener; + struct spa_hook object_listener; + int registered; ++ unsigned int visible; + unsigned int removing:1; + unsigned int removed:1; + }; +@@ -723,7 +724,7 @@ static struct object *find_port_by_name(struct client *c, const char *name) + struct object *o; + + spa_list_for_each(o, &c->context.objects, link) { +- if (o->type != INTERFACE_Port || o->removed) ++ if (o->type != INTERFACE_Port || o->removed || !o->visible) + continue; + if (spa_streq(o->port.name, name) || + spa_streq(o->port.alias1, name) || +@@ -1056,6 +1057,7 @@ static int queue_notify(struct client *c, int type, struct object *o, int arg1, + break; + case NOTIFY_TYPE_PORTREGISTRATION: + emit = c->portregistration_callback != NULL && o != NULL; ++ o->visible = arg1; + break; + case NOTIFY_TYPE_CONNECT: + emit = c->connect_callback != NULL && o != NULL; +@@ -5989,7 +5991,7 @@ const char ** jack_get_ports (jack_client_t *client, + count = 0; + + spa_list_for_each(o, &c->context.objects, link) { +- if (o->type != INTERFACE_Port || o->removed) ++ if (o->type != INTERFACE_Port || o->removed || !o->visible) + continue; + pw_log_debug("%p: check port type:%d flags:%08lx name:\"%s\"", c, + o->port.type_id, o->port.flags, o->port.name); +-- +GitLab + diff --git a/0001-pulse-server-set-all-change_mask-flags-when-removing.patch b/0001-pulse-server-set-all-change_mask-flags-when-removing.patch new file mode 100644 index 0000000..49338cf --- /dev/null +++ b/0001-pulse-server-set-all-change_mask-flags-when-removing.patch @@ -0,0 +1,32 @@ +From 820ca90705ae78124958f1b96de3bdc7889c2d1e Mon Sep 17 00:00:00 2001 +From: Wim Taymans +Date: Tue, 8 Aug 2023 13:01:30 +0200 +Subject: [PATCH] pulse-server: set all change_mask flags when removing + +So that the logic to emit events will select sink and source objects. + +Fixes #3414 +--- + src/modules/module-protocol-pulse/manager.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/src/modules/module-protocol-pulse/manager.c b/src/modules/module-protocol-pulse/manager.c +index 91594ce62..76517f112 100644 +--- a/src/modules/module-protocol-pulse/manager.c ++++ b/src/modules/module-protocol-pulse/manager.c +@@ -641,9 +641,10 @@ static void registry_event_global_remove(void *data, uint32_t id) + + o->this.removing = true; + +- if (!o->this.creating) ++ if (!o->this.creating) { ++ o->this.change_mask = ~0; + manager_emit_removed(m, &o->this); +- ++ } + object_destroy(o); + } + +-- +GitLab + diff --git a/0002-jack-handle-node.always-process-=-false-jack-nodes.patch b/0002-jack-handle-node.always-process-=-false-jack-nodes.patch new file mode 100644 index 0000000..e6d493a --- /dev/null +++ b/0002-jack-handle-node.always-process-=-false-jack-nodes.patch @@ -0,0 +1,44 @@ +From cbf97d4b00e8fb9d46eb4c53bf64073871d7ce87 Mon Sep 17 00:00:00 2001 +From: Wim Taymans +Date: Mon, 7 Aug 2023 19:58:20 +0200 +Subject: [PATCH] jack: handle node.always-process = false jack nodes + +Node that have the node.always-process = false property do not conform +to the jack API because they will be suspended even when they don't +inactivate themselves. Don't hide the ports for those clients when +inactive. + +Fixes #3416 +--- + pipewire-jack/src/pipewire-jack.c | 13 ++++++++++--- + 1 file changed, 10 insertions(+), 3 deletions(-) + +diff --git a/pipewire-jack/src/pipewire-jack.c b/pipewire-jack/src/pipewire-jack.c +index 7547d6ffb..051eb1675 100644 +--- a/pipewire-jack/src/pipewire-jack.c ++++ b/pipewire-jack/src/pipewire-jack.c +@@ -3075,11 +3075,18 @@ static void node_info(void *data, const struct pw_node_info *info) + { + struct object *n = data; + struct client *c = n->client; ++ const char *str; ++ ++ if (info->change_mask & PW_NODE_CHANGE_MASK_PROPS) { ++ str = spa_dict_lookup(info->props, PW_KEY_NODE_ALWAYS_PROCESS); ++ n->node.is_jack = str ? spa_atob(str) : false; ++ } + +- pw_log_info("DSP node %d state change %s", info->id, +- pw_node_state_as_string(info->state)); ++ n->node.is_running = !n->node.is_jack || (info->state == PW_NODE_STATE_RUNNING); + +- n->node.is_running = (info->state == PW_NODE_STATE_RUNNING); ++ pw_log_debug("DSP node %d %08"PRIx64" jack:%u state change %s running:%d", info->id, ++ info->change_mask, n->node.is_jack, ++ pw_node_state_as_string(info->state), n->node.is_running); + + if (info->change_mask & PW_NODE_CHANGE_MASK_STATE) { + struct object *p; +-- +GitLab + diff --git a/pipewire.changes b/pipewire.changes index e1e2a6c..6912ffb 100644 --- a/pipewire.changes +++ b/pipewire.changes @@ -1,3 +1,24 @@ +------------------------------------------------------------------- +Fri Aug 18 12:01:36 UTC 2023 - Antonio Larrosa + +- Fix from upstream to ensure effect and sink nodes are set to + running: + * 0001-context-Dont-stop-setting-runnable-when-meeting-the-driving.patch + +- Fix from upstream to prevent a crash when stopping a device + provider: + * 0001-gst-Prevent-a-crash-when-stopping-device-provider.patch + +- Fix from upstream to fix a regression that makes plugins/effects + disappear in Carla Patchbay when there's no playback: + * 0001-jack-ports-become-visible-when-the-registration-is-queued.patch + * 0002-jack-handle-node.always-process-=-false-jack-nodes.patch + +- Fix from upstream to fix pavucontrol and plasma-pa showing + duplicated sinks after resume or switching audio device profiles + (boo#1214374): + * 0001-pulse-server-set-all-change_mask-flags-when-removing.patch + ------------------------------------------------------------------- Sat Aug 5 12:23:12 UTC 2023 - Alexei Sorokin diff --git a/pipewire.spec b/pipewire.spec index ad4cdbe..a2add53 100644 --- a/pipewire.spec +++ b/pipewire.spec @@ -70,6 +70,12 @@ Source0: %{name}-%{version}.tar.xz Source99: baselibs.conf # PATCH-FIX-OPENSUSE reduce-meson-dependency.patch Patch0: reduce-meson-dependency.patch +Patch1: 0001-context-Dont-stop-setting-runnable-when-meeting-the-driving.patch +Patch2: 0001-gst-Prevent-a-crash-when-stopping-device-provider.patch +Patch3: 0001-jack-ports-become-visible-when-the-registration-is-queued.patch +Patch4: 0002-jack-handle-node.always-process-=-false-jack-nodes.patch +Patch5: 0001-pulse-server-set-all-change_mask-flags-when-removing.patch + BuildRequires: docutils BuildRequires: doxygen BuildRequires: fdupes @@ -382,6 +388,11 @@ JACK libraries. sed -ie "s/version : '0.3.72'/version : '%{version}'/" %{P:0} %patch0 -p1 %endif +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 +%patch5 -p1 %build %if %{pkg_vcmp gcc < 8}