mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-01 22:58:50 -04:00
filter-chain: first create instances and then link port
First make instances of all the plugins and then try to link them up. Otherwise, depending on the order the plugins are defined in the config, a link will try to create port data and set it on the instance, which is still NULL and we crash.
This commit is contained in:
parent
7be69f38d8
commit
42b994204d
1 changed files with 16 additions and 8 deletions
|
|
@ -2433,19 +2433,12 @@ static int graph_instantiate(struct graph *graph)
|
|||
|
||||
graph->instantiated = true;
|
||||
|
||||
/* first make instances */
|
||||
spa_list_for_each(node, &graph->node_list, link) {
|
||||
|
||||
node_cleanup(node);
|
||||
|
||||
desc = node->desc;
|
||||
d = desc->desc;
|
||||
if (d->flags & FC_DESCRIPTOR_SUPPORTS_NULL_DATA) {
|
||||
sd = dd = NULL;
|
||||
}
|
||||
else {
|
||||
sd = impl->silence_data;
|
||||
dd = impl->discard_data;
|
||||
}
|
||||
|
||||
for (i = 0; i < node->n_hndl; i++) {
|
||||
pw_log_info("instantiate %s %s[%d] rate:%lu", d->name, node->name, i, impl->rate);
|
||||
|
|
@ -2455,6 +2448,21 @@ static int graph_instantiate(struct graph *graph)
|
|||
res = -errno;
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* then link ports and activate */
|
||||
spa_list_for_each(node, &graph->node_list, link) {
|
||||
desc = node->desc;
|
||||
d = desc->desc;
|
||||
if (d->flags & FC_DESCRIPTOR_SUPPORTS_NULL_DATA) {
|
||||
sd = dd = NULL;
|
||||
}
|
||||
else {
|
||||
sd = impl->silence_data;
|
||||
dd = impl->discard_data;
|
||||
}
|
||||
for (i = 0; i < node->n_hndl; i++) {
|
||||
for (j = 0; j < desc->n_input; j++) {
|
||||
port = &node->input_port[j];
|
||||
d->connect_port(node->hndl[i], port->p, sd);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue