mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-02-09 10:06:25 -05:00
filter-graph: handle NULL in and out
We need to pass exactly n_inputs and n_outputs pointers to the process function but make it possible to set some to NULL so that the data is ignored.
This commit is contained in:
parent
49f48a5fda
commit
3cf9ccf4a7
2 changed files with 14 additions and 2 deletions
|
|
@ -246,17 +246,20 @@ static int impl_process(void *object,
|
|||
for (i = 0, j = 0; i < impl->info.n_inputs; i++) {
|
||||
while (j < graph->n_input) {
|
||||
port = &graph->input[j++];
|
||||
if (port->desc)
|
||||
if (port->desc && in[i])
|
||||
port->desc->connect_port(*port->hndl, port->port, (float*)in[i]);
|
||||
if (!port->next)
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (i = 0; i < impl->info.n_outputs; i++) {
|
||||
if (out[i] == NULL)
|
||||
continue;
|
||||
|
||||
port = i < graph->n_output ? &graph->output[i] : NULL;
|
||||
|
||||
if (port && port->desc)
|
||||
port->desc->connect_port(*port->hndl, port->port, (float*)out[i]);
|
||||
port->desc->connect_port(*port->hndl, port->port, out[i]);
|
||||
else
|
||||
memset(out[i], 0, n_samples * sizeof(float));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue