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

@ -41,7 +41,8 @@
#include "pipewire/extensions/protocol-native.h"
#include "pipewire/extensions/client-node.h"
#define MAX_MIX 4096
#define MAX_BUFFERS 64
#define MAX_MIX 4096
PW_LOG_TOPIC_EXTERN(mod_topic);
#define PW_LOG_TOPIC_DEFAULT mod_topic
@ -629,6 +630,9 @@ client_node_port_use_buffers(void *object,
goto error_exit;
}
if (n_buffers > MAX_BUFFERS)
return -ENOSPC;
prot = PW_MEMMAP_FLAG_READWRITE;
/* clear previous buffers */