context: always set unassigned node driver to NULL

When a node is unassigned and doesn't need a driver, set the driver
to NULL and the node to IDLE.
This commit is contained in:
Wim Taymans 2020-03-03 13:04:33 +01:00
parent fd262aa0f2
commit 913cf29dcd

View file

@ -829,19 +829,20 @@ int pw_context_recalc_graph(struct pw_context *context)
* to an active master */ * to an active master */
spa_list_for_each(n, &context->node_list, link) { spa_list_for_each(n, &context->node_list, link) {
if (!n->visited) { if (!n->visited) {
struct pw_impl_node *t;
pw_log_debug(NAME" %p: unassigned node %p: '%s' %d %d", context, pw_log_debug(NAME" %p: unassigned node %p: '%s' %d %d", context,
n, n->name, n->active, n->want_driver); n, n->name, n->active, n->want_driver);
if (!n->want_driver) t = n->want_driver ? target : NULL;
continue;
if (target != NULL) { if (t != NULL) {
if (n->quantum_size > 0 && n->quantum_size < target->quantum_current) if (n->quantum_size > 0 && n->quantum_size < t->quantum_current)
target->quantum_current = t->quantum_current =
SPA_MAX(context->defaults.clock_min_quantum, n->quantum_size); SPA_MAX(context->defaults.clock_min_quantum, n->quantum_size);
} }
pw_impl_node_set_driver(n, target); pw_impl_node_set_driver(n, t);
pw_impl_node_set_state(n, target && n->active ? pw_impl_node_set_state(n, t && n->active ?
PW_NODE_STATE_RUNNING : PW_NODE_STATE_IDLE); PW_NODE_STATE_RUNNING : PW_NODE_STATE_IDLE);
} }
n->visited = false; n->visited = false;