mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-06 13:30:01 -05:00
filter-chain: be more carefull with buffer sizes
Take the min of the input buffer size as the output size. Make sure we don't process more than the output buffer maxsize as well.
This commit is contained in:
parent
7a76e55c36
commit
b2bb2fe028
1 changed files with 5 additions and 1 deletions
|
|
@ -613,16 +613,20 @@ static void capture_process(void *d)
|
||||||
port->desc->connect_port(port->hndl, port->port,
|
port->desc->connect_port(port->hndl, port->port,
|
||||||
SPA_PTROFF(ds->data, offs, void));
|
SPA_PTROFF(ds->data, offs, void));
|
||||||
|
|
||||||
outsize = SPA_MAX(outsize, size);
|
outsize = i == 0 ? size : SPA_MIN(outsize, size);
|
||||||
stride = SPA_MAX(stride, ds->chunk->stride);
|
stride = SPA_MAX(stride, ds->chunk->stride);
|
||||||
}
|
}
|
||||||
for (i = 0; i < out->buffer->n_datas; i++) {
|
for (i = 0; i < out->buffer->n_datas; i++) {
|
||||||
struct spa_data *dd = &out->buffer->datas[i];
|
struct spa_data *dd = &out->buffer->datas[i];
|
||||||
struct graph_port *port = &graph->output[i];
|
struct graph_port *port = &graph->output[i];
|
||||||
|
|
||||||
|
outsize = SPA_MIN(outsize, dd->maxsize);
|
||||||
|
|
||||||
if (port->desc)
|
if (port->desc)
|
||||||
port->desc->connect_port(port->hndl, port->port, dd->data);
|
port->desc->connect_port(port->hndl, port->port, dd->data);
|
||||||
else
|
else
|
||||||
memset(dd->data, 0, outsize);
|
memset(dd->data, 0, outsize);
|
||||||
|
|
||||||
dd->chunk->offset = 0;
|
dd->chunk->offset = 0;
|
||||||
dd->chunk->size = outsize;
|
dd->chunk->size = outsize;
|
||||||
dd->chunk->stride = stride;
|
dd->chunk->stride = stride;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue