context: Fix node collect with groups and sync enabled

When checking for the nodes to collect with a driver, don't just skip
checking the other nodes when the driver is not in the sync group.
Instead collect all nodes that have the same group and link group as
the driver first and then check the sync groups.

Fixes export in ardour8

Fixes #4083
This commit is contained in:
Wim Taymans 2024-07-01 14:50:34 +02:00
parent dc5f441909
commit 070bcea63b

View file

@ -1181,18 +1181,18 @@ static int collect_nodes(struct pw_context *context, struct pw_impl_node *node,
/* now follow all the links from the nodes in the queue
* and add the peers to the queue. */
spa_list_consume(n, &queue, sort_link) {
bool in_sync;
spa_list_remove(&n->sort_link);
spa_list_append(collect, &n->sort_link);
pw_log_debug(" next node %p: '%s' runnable:%u", n, n->name, n->runnable);
pw_log_debug(" next node %p: '%s' runnable:%u active:%d",
n, n->name, n->runnable, n->active);
if (!n->active)
continue;
if (sync[0] != NULL) {
if (pw_strv_find_common(n->sync_groups, sync) < 0)
continue;
}
in_sync = pw_strv_find_common(n->sync_groups, sync) >= 0;
spa_list_for_each(p, &n->input_ports, link) {
spa_list_for_each(l, &p->links, input_link) {
@ -1242,9 +1242,11 @@ static int collect_nodes(struct pw_context *context, struct pw_impl_node *node,
spa_list_for_each(t, &context->node_list, link) {
if (t->exported || !t->active || t->visited)
continue;
/* the other node will be scheduled with this one if it's in
* the same group or link group */
if (pw_strv_find_common(t->groups, n->groups) < 0 &&
pw_strv_find_common(t->link_groups, n->link_groups) < 0 &&
pw_strv_find_common(t->sync_groups, sync) < 0)
(!in_sync || pw_strv_find_common(t->sync_groups, sync) < 0))
continue;
pw_log_debug("%p: %s join group of %s",
@ -1253,7 +1255,8 @@ static int collect_nodes(struct pw_context *context, struct pw_impl_node *node,
spa_list_append(&queue, &t->sort_link);
}
}
pw_log_debug(" next node %p: '%s' runnable:%u", n, n->name, n->runnable);
pw_log_debug(" next node %p: '%s' runnable:%u %p %p %p", n, n->name, n->runnable,
n->groups, n->link_groups, sync);
}
spa_list_for_each(n, collect, sort_link)
if (!n->driving && n->runnable) {