fix use_buffers checks

We can set 0 buffers even if there is no format.
Return -ENOSPC when too many buffers are set.
This commit is contained in:
Wim Taymans 2023-01-10 12:30:25 +01:00
parent 9f3237b74e
commit 97aafe2234
31 changed files with 146 additions and 88 deletions

View file

@ -2049,13 +2049,16 @@ impl_node_port_use_buffers(void *object,
port = GET_PORT(this, direction, port_id);
spa_return_val_if_fail(port->have_format, -EIO);
spa_log_debug(this->log, "%p: use buffers %d on port %d:%d",
this, n_buffers, direction, port_id);
clear_buffers(this, port);
if (n_buffers > 0 && !port->have_format)
return -EIO;
if (n_buffers > MAX_BUFFERS)
return -ENOSPC;
maxsize = this->quantum_limit * sizeof(float);
for (i = 0; i < n_buffers; i++) {