mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-12 13:30:15 -05:00
context: rework state calculations
We can only call collect_nodes() once because it sets the visited state to true. So, move the unassigned nodes to the fallback driver but when they are passive (nothing is linked), move them back to the NULL driver. This fixes a case where when the fallback driver changes, only some nodes are moved to the new driver (because the other ones were already visited in the collect_nodes() check before).
This commit is contained in:
parent
4cc0082634
commit
182b3c8798
1 changed files with 12 additions and 13 deletions
|
|
@ -1191,24 +1191,23 @@ again:
|
|||
context, n, n->name, n->active, n->want_driver, target);
|
||||
|
||||
t = n->want_driver && n->active ? target : NULL;
|
||||
if (t != NULL && !n->always_process) {
|
||||
/* first do a check without moving the node to
|
||||
* the target driver to see if we are passive */
|
||||
collect_nodes(context, n);
|
||||
if (n->passive)
|
||||
t = NULL;
|
||||
}
|
||||
pw_impl_node_set_driver(n, t);
|
||||
if (t == NULL) {
|
||||
/* no driver, make sure the node stops */
|
||||
ensure_state(n, false);
|
||||
}
|
||||
else {
|
||||
if (t != NULL) {
|
||||
pw_impl_node_set_driver(n, t);
|
||||
/* we configured a driver, move all linked
|
||||
* nodes to it as well */
|
||||
if (n->always_process)
|
||||
t->passive = false;
|
||||
collect_nodes(context, n);
|
||||
if (!n->always_process && n->passive)
|
||||
/* nothing active and node doesn't need to be
|
||||
* scheduled, remove from driver again and
|
||||
* stop */
|
||||
t = NULL;
|
||||
}
|
||||
if (t == NULL) {
|
||||
/* no driver, make sure the node stops */
|
||||
pw_impl_node_set_driver(n, NULL);
|
||||
ensure_state(n, false);
|
||||
}
|
||||
}
|
||||
n->visited = false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue