From f0f9fbb00918ed1be1bd4f02b8d6b99e9ea7d901 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 9 Dec 2024 10:34:11 +0100 Subject: [PATCH] filter-graph: activate nodes after linking Don't activate the nodes while linking but make a last stage where all the nodes are activated. This makes it possible to better set up the nodes based on the port data. --- spa/plugins/filter-graph/filter-graph.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/spa/plugins/filter-graph/filter-graph.c b/spa/plugins/filter-graph/filter-graph.c index edd3b5364..d50f22617 100644 --- a/spa/plugins/filter-graph/filter-graph.c +++ b/spa/plugins/filter-graph/filter-graph.c @@ -1462,7 +1462,7 @@ static int impl_activate(void *object, const struct spa_fraction *rate) } } - /* then link ports and activate */ + /* then link ports */ spa_list_for_each(node, &graph->node_list, link) { desc = node->desc; d = desc->desc; @@ -1515,12 +1515,22 @@ static int impl_activate(void *object, const struct spa_fraction *rate) &port->control_data[i]); d->connect_port(node->hndl[i], port->p, &port->control_data[i]); } + } + } + + /* now activate */ + spa_list_for_each(node, &graph->node_list, link) { + desc = node->desc; + d = desc->desc; + + for (i = 0; i < node->n_hndl; i++) { if (d->activate) d->activate(node->hndl[i]); if (node->control_changed && d->control_changed) d->control_changed(node->hndl[i]); } } + spa_filter_graph_emit_props_changed(&impl->hooks, SPA_DIRECTION_INPUT); return 0; error: