mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-06 13:30:01 -05:00
impl-node: make the group a string
We are currently using strings for the node group so actually store this as a string or else all strings will end up in group 0.
This commit is contained in:
parent
cc4324cd30
commit
fab199d5b9
3 changed files with 15 additions and 19 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue