From ae194b6fe7e52e334be91782b3dcf099c0991f4d Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 18 Apr 2022 15:59:26 +0200 Subject: [PATCH] context: don't move passive nodes to fallback driver Don't move passive nodes to the fallback driver when !always_process. When we have a fallback driver, check if the node we want to add to it is not a passive node (by doing collect_nodes), if it's passive and doesn't always need to be processed, remove it from the driver. This fixes the issue where nodes that are maked as want_driver are unconditionally moved to the fallback driver (and activated) even if there is nothing linked to them (passive). Fixes #2309 --- src/pipewire/context.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/pipewire/context.c b/src/pipewire/context.c index 976f00b33..55f3eba5a 100644 --- a/src/pipewire/context.c +++ b/src/pipewire/context.c @@ -1191,11 +1191,21 @@ 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) + if (t == NULL) { + /* no driver, make sure the node stops */ ensure_state(n, false); + } else { + /* we configured a driver, move all linked + * nodes to it as well */ if (n->always_process) t->passive = false; collect_nodes(context, n);