modules: limit the max amount of items in the protocol

For now, put a limit on the amount of items we can send and receive
over the native protocol. A more complex way of allocating and freeing
can be implemented later when we really need to raise the limits.

Fixes #2070
This commit is contained in:
Wim Taymans 2022-01-28 15:55:44 +01:00
parent 92198e4d0d
commit ead827d6cb
6 changed files with 70 additions and 2 deletions

View file

@ -755,6 +755,9 @@ do_port_use_buffers(struct impl *impl,
if (!CHECK_PORT(this, direction, port_id))
return n_buffers == 0 ? 0 : -EINVAL;
if (n_buffers > MAX_BUFFERS)
return -ENOSPC;
p = GET_PORT(this, direction, port_id);
spa_log_debug(this->log, "%p: %s port %d.%d use buffers %p %u flags:%08x", this,