diff --git a/src/pipewire/context.c b/src/pipewire/context.c index 03bf0f251..8be6c1d74 100644 --- a/src/pipewire/context.c +++ b/src/pipewire/context.c @@ -798,6 +798,7 @@ static int collect_nodes(struct pw_impl_node *driver) spa_list_init(&queue); spa_list_append(&queue, &driver->sort_link); driver->visited = true; + driver->passive = true; spa_list_consume(n, &queue, sort_link) { spa_list_remove(&n->sort_link); @@ -806,6 +807,8 @@ static int collect_nodes(struct pw_impl_node *driver) spa_list_for_each(p, &n->input_ports, link) { spa_list_for_each(l, &p->links, input_link) { t = l->output->node; + if (!l->passive) + driver->passive = false; if (l->prepared && !t->visited && t->active) { t->visited = true; spa_list_append(&queue, &t->sort_link); @@ -815,6 +818,8 @@ static int collect_nodes(struct pw_impl_node *driver) spa_list_for_each(p, &n->output_ports, link) { spa_list_for_each(l, &p->links, output_link) { t = l->input->node; + if (!l->passive) + driver->passive = false; if (l->prepared && !t->visited && t->active) { t->visited = true; spa_list_append(&queue, &t->sort_link); @@ -852,7 +857,7 @@ int pw_context_recalc_graph(struct pw_context *context, const char *reason) /* from now on we are only interested in active master nodes. * We're going to see if there are active followers. */ - if (!n->master || !n->active) + if (!n->master || !n->active || n->passive) continue; /* first active master node is fallback */ @@ -912,7 +917,7 @@ int pw_context_recalc_graph(struct pw_context *context, const char *reason) if (s == n) continue; if (s->active) - running = true; + running = !n->passive; if (s->quantum_size > 0) { if (min_quantum == 0 || s->quantum_size < min_quantum) min_quantum = s->quantum_size; @@ -935,8 +940,8 @@ int pw_context_recalc_graph(struct pw_context *context, const char *reason) n->rt.position->clock.duration = quantum; } - pw_log_debug(NAME" %p: master %p running:%d quantum:%u '%s'", context, n, - running, quantum, n->name); + pw_log_debug(NAME" %p: master %p running:%d passive:%d quantum:%u '%s'", context, n, + running, n->passive, quantum, n->name); spa_list_for_each(s, &n->follower_list, follower_link) { if (s == n) diff --git a/src/pipewire/impl-link.c b/src/pipewire/impl-link.c index 99a9bb084..bc6317e11 100644 --- a/src/pipewire/impl-link.c +++ b/src/pipewire/impl-link.c @@ -995,6 +995,7 @@ struct pw_impl_link *pw_context_create_link(struct pw_context *context, struct impl *impl; struct pw_impl_link *this; struct pw_impl_node *input_node, *output_node; + const char *str; int res; if (output == input) @@ -1038,6 +1039,10 @@ struct pw_impl_link *pw_context_create_link(struct pw_context *context, this->output = output; this->input = input; + /* passive means that this link does not make the nodes active */ + if ((str = pw_properties_get(properties, PW_KEY_LINK_PASSIVE)) != NULL) + this->passive = pw_properties_parse_bool(str); + spa_hook_list_init(&this->listener_list); impl->format_filter = format_filter; diff --git a/src/pipewire/private.h b/src/pipewire/private.h index e2bf55365..386fe7399 100644 --- a/src/pipewire/private.h +++ b/src/pipewire/private.h @@ -548,6 +548,7 @@ struct pw_impl_node { * is selected to drive the graph */ unsigned int visited:1; /**< for sorting */ unsigned int want_driver:1; /**< this node wants to be assigned to a driver */ + unsigned int passive:1; /**< driver graph only has passive links */ uint32_t port_user_data_size; /**< extra size for port user data */ @@ -753,6 +754,7 @@ struct pw_impl_link { unsigned int feedback:1; unsigned int preparing:1; unsigned int prepared:1; + unsigned int passive:1; }; #define pw_resource_emit(o,m,v,...) spa_hook_list_call(&o->listener_list, struct pw_resource_events, m, v, ##__VA_ARGS__)