diff --git a/src/pipewire/context.c b/src/pipewire/context.c index d5494560b..838a5ed1d 100644 --- a/src/pipewire/context.c +++ b/src/pipewire/context.c @@ -935,14 +935,15 @@ static int collect_nodes(struct pw_context *context, struct pw_impl_node *driver } /* now go through all the followers of this driver and add the * nodes that have the same group and that are not yet visited */ - if (n->group_id == SPA_ID_INVALID) + if (n->group[0] == '\0') continue; spa_list_for_each(t, &context->node_list, link) { if (t->exported || t == n || !t->active || t->visited) continue; - if (t->group_id != n->group_id) + if (strcmp(t->group, n->group) != 0) continue; + pw_log_debug("%p join group %s: '%s'", t, t->group, n->group); t->visited = true; spa_list_append(&queue, &t->sort_link); } diff --git a/src/pipewire/impl-node.c b/src/pipewire/impl-node.c index 16e587834..f9e4fffc4 100644 --- a/src/pipewire/impl-node.c +++ b/src/pipewire/impl-node.c @@ -817,25 +817,12 @@ static void check_properties(struct pw_impl_node *node) struct pw_context *context = node->context; const char *str, *recalc_reason = NULL; bool driver; - uint32_t group_id; if ((str = pw_properties_get(node->properties, PW_KEY_PRIORITY_DRIVER))) { node->priority_driver = pw_properties_parse_int(str); pw_log_debug(NAME" %p: priority driver %d", node, node->priority_driver); } - /* group_id defines what nodes are scheduled together */ - if ((str = pw_properties_get(node->properties, PW_KEY_NODE_GROUP))) - group_id = pw_properties_parse_int(str); - else - group_id = SPA_ID_INVALID; - - if (group_id != node->group_id) { - pw_log_debug(NAME" %p: group %u->%u", node, node->group_id, group_id); - node->group_id = group_id; - recalc_reason = "group changed"; - } - if ((str = pw_properties_get(node->properties, PW_KEY_NODE_NAME)) && (node->name == NULL || strcmp(node->name, str) != 0)) { free(node->name); @@ -870,6 +857,16 @@ static void check_properties(struct pw_impl_node *node) recalc_reason = "driver changed"; } + /* group defines what nodes are scheduled together */ + if ((str = pw_properties_get(node->properties, PW_KEY_NODE_GROUP)) == NULL) + str = ""; + + if (strcmp(str, node->group) != 0) { + pw_log_info(NAME" %p: group '%s'->'%s'", node, node->group, str); + snprintf(node->group, sizeof(node->group), "%s", str); + recalc_reason = "group changed"; + } + if ((str = pw_properties_get(node->properties, PW_KEY_NODE_ALWAYS_PROCESS))) node->want_driver = pw_properties_parse_bool(str); else @@ -914,7 +911,6 @@ static void check_properties(struct pw_impl_node *node) context->defaults.clock_rate); node->max_quantum_size = max_quantum_size; recalc_reason = "max quantum changed"; - } } } @@ -922,7 +918,7 @@ static void check_properties(struct pw_impl_node *node) pw_log_debug(NAME" %p: driver:%d recalc:%s active:%d", node, node->driver, recalc_reason, node->active); - if (recalc_reason && node->active) + if (recalc_reason != NULL && node->active) pw_context_recalc_graph(context, recalc_reason); } @@ -1146,7 +1142,6 @@ struct pw_impl_node *pw_context_create_node(struct pw_context *context, this = &impl->this; this->context = context; this->name = strdup("node"); - this->group_id = SPA_ID_INVALID; if (user_data_size > 0) this->user_data = SPA_PTROFF(impl, sizeof(struct impl), void); diff --git a/src/pipewire/private.h b/src/pipewire/private.h index 37c129599..c5a774901 100644 --- a/src/pipewire/private.h +++ b/src/pipewire/private.h @@ -622,7 +622,7 @@ struct pw_impl_node { char *name; /** for debug */ uint32_t priority_driver; /** priority for being driver */ - uint32_t group_id; /** group to schedule this node in */ + char group[128]; /** group to schedule this node in */ uint64_t spa_flags; unsigned int registered:1;