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.
This commit is contained in:
Wim Taymans 2024-12-09 10:34:11 +01:00
parent 1bead99daf
commit f0f9fbb009

View file

@ -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) { spa_list_for_each(node, &graph->node_list, link) {
desc = node->desc; desc = node->desc;
d = desc->desc; d = desc->desc;
@ -1515,12 +1515,22 @@ static int impl_activate(void *object, const struct spa_fraction *rate)
&port->control_data[i]); &port->control_data[i]);
d->connect_port(node->hndl[i], port->p, &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) if (d->activate)
d->activate(node->hndl[i]); d->activate(node->hndl[i]);
if (node->control_changed && d->control_changed) if (node->control_changed && d->control_changed)
d->control_changed(node->hndl[i]); d->control_changed(node->hndl[i]);
} }
} }
spa_filter_graph_emit_props_changed(&impl->hooks, SPA_DIRECTION_INPUT); spa_filter_graph_emit_props_changed(&impl->hooks, SPA_DIRECTION_INPUT);
return 0; return 0;
error: error: