From 6ee90dc5d46a327c2edfc93bb4c308ccf0ce22cf Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Wed, 27 May 2026 16:31:50 +0200 Subject: [PATCH] context: run nodes in the same node.group When one of the nodes from a group is running, all the other nodes in the group should run as well. The link group is only for the session manager to avoid linking the same link group to avoid loops. We can then remove the node.link-group from the driver nodes so that the session manager can link a loopback between them when asked. See #5210 --- spa/plugins/alsa/acp/acp.c | 2 -- src/modules/module-ffado-driver.c | 2 -- src/modules/module-netjack2-manager.c | 2 -- src/pipewire/context.c | 12 +++++------- 4 files changed, 5 insertions(+), 13 deletions(-) diff --git a/spa/plugins/alsa/acp/acp.c b/spa/plugins/alsa/acp/acp.c index ab166749a..98c60ac2c 100644 --- a/spa/plugins/alsa/acp/acp.c +++ b/spa/plugins/alsa/acp/acp.c @@ -463,13 +463,11 @@ static int add_pro_profile(pa_card *impl, uint32_t index) if ((n_capture == 1 && n_playback == 1) || is_firewire) { PA_IDXSET_FOREACH(m, ap->output_mappings, idx) { pa_proplist_setf(m->output_proplist, "node.group", "pro-audio-%u", index); - pa_proplist_setf(m->output_proplist, "node.link-group", "pro-audio-%u", index); pa_proplist_setf(m->output_proplist, "api.alsa.auto-link", "true"); pa_proplist_setf(m->output_proplist, "api.alsa.disable-tsched", "true"); } PA_IDXSET_FOREACH(m, ap->input_mappings, idx) { pa_proplist_setf(m->input_proplist, "node.group", "pro-audio-%u", index); - pa_proplist_setf(m->input_proplist, "node.link-group", "pro-audio-%u", index); pa_proplist_setf(m->input_proplist, "api.alsa.auto-link", "true"); pa_proplist_setf(m->input_proplist, "api.alsa.disable-tsched", "true"); } diff --git a/src/modules/module-ffado-driver.c b/src/modules/module-ffado-driver.c index 1c9c7c590..25c66c366 100644 --- a/src/modules/module-ffado-driver.c +++ b/src/modules/module-ffado-driver.c @@ -1547,8 +1547,6 @@ int pipewire__module_init(struct pw_impl_module *module, const char *args) pw_properties_set(props, PW_KEY_NODE_VIRTUAL, "true"); if (pw_properties_get(props, PW_KEY_NODE_GROUP) == NULL) pw_properties_set(props, PW_KEY_NODE_GROUP, "ffado-group"); - if (pw_properties_get(props, PW_KEY_NODE_LINK_GROUP) == NULL) - pw_properties_set(props, PW_KEY_NODE_LINK_GROUP, "ffado-group"); if (pw_properties_get(props, PW_KEY_NODE_PAUSE_ON_IDLE) == NULL) pw_properties_set(props, PW_KEY_NODE_PAUSE_ON_IDLE, "false"); diff --git a/src/modules/module-netjack2-manager.c b/src/modules/module-netjack2-manager.c index fe482fd94..ddea0e507 100644 --- a/src/modules/module-netjack2-manager.c +++ b/src/modules/module-netjack2-manager.c @@ -1389,8 +1389,6 @@ int pipewire__module_init(struct pw_impl_module *module, const char *args) pw_properties_set(props, PW_KEY_NODE_VIRTUAL, "true"); if (pw_properties_get(props, PW_KEY_NODE_NETWORK) == NULL) pw_properties_set(props, PW_KEY_NODE_NETWORK, "true"); - if (pw_properties_get(props, PW_KEY_NODE_LINK_GROUP) == NULL) - pw_properties_set(props, PW_KEY_NODE_LINK_GROUP, "jack-group"); if (pw_properties_get(props, PW_KEY_NODE_ALWAYS_PROCESS) == NULL) pw_properties_set(props, PW_KEY_NODE_ALWAYS_PROCESS, "true"); if (pw_properties_get(props, PW_KEY_NODE_LOCK_QUANTUM) == NULL) diff --git a/src/pipewire/context.c b/src/pipewire/context.c index 9789efa53..b47b0e04a 100644 --- a/src/pipewire/context.c +++ b/src/pipewire/context.c @@ -1148,17 +1148,15 @@ static inline int run_nodes(struct pw_context *context, struct pw_impl_node *nod } } } - /* now go through all the nodes that have the same link group and - * that are not yet visited. Note how nodes with the same group - * don't get included here. They were added to the same driver but - * need to otherwise stay idle unless some non-passive link activates - * them. */ - if (node->link_groups != NULL) { + /* now go through all the nodes that share groups and link_groups + * that are not yet visited */ + if (node->groups != NULL || node->link_groups != NULL) { spa_list_for_each(t, nodes, sort_link) { if (t->exported || !t->active || SPA_FLAG_IS_SET(t->checked, 1u<link_groups, node->link_groups) < 0) + if (pw_strv_find_common(t->groups, node->groups) < 0 && + pw_strv_find_common(t->link_groups, node->link_groups) < 0) continue; pw_log_debug(" group %p: '%s'", t, t->name);