diff options
author | dec05eba <dec05eba@protonmail.com> | 2024-12-05 19:13:55 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2024-12-05 19:14:00 +0100 |
commit | 1b409478847dd825683b8ac1f1cae613b3155bd9 (patch) | |
tree | 52667cd71541f6a4242b730d242dcecbb4b27c36 | |
parent | 8941e12c6191aece93fca4ce2a39f56edf2a0826 (diff) |
Add error output when reaching max ports/stream nodes/links
-rw-r--r-- | include/pipewire_audio.h | 2 | ||||
-rw-r--r-- | src/pipewire_audio.c | 8 |
2 files changed, 8 insertions, 2 deletions
diff --git a/include/pipewire_audio.h b/include/pipewire_audio.h index 1854914..33fc9eb 100644 --- a/include/pipewire_audio.h +++ b/include/pipewire_audio.h @@ -8,7 +8,7 @@ #include <stdbool.h> -#define GSR_PIPEWIRE_AUDIO_MAX_STREAM_NODES 256 +#define GSR_PIPEWIRE_AUDIO_MAX_STREAM_NODES 128 #define GSR_PIPEWIRE_AUDIO_MAX_PORTS 256 #define GSR_PIPEWIRE_AUDIO_MAX_REQUESTED_LINKS 32 diff --git a/src/pipewire_audio.c b/src/pipewire_audio.c index 4af41e4..0af96bb 100644 --- a/src/pipewire_audio.c +++ b/src/pipewire_audio.c @@ -186,6 +186,8 @@ static void registry_event_global(void *data, uint32_t id, uint32_t permissions, gsr_pipewire_audio_create_links(self); } + } else if(self->num_stream_nodes >= GSR_PIPEWIRE_AUDIO_MAX_STREAM_NODES) { + fprintf(stderr, "gsr error: reached the maximum amount of audio stream nodes\n"); } } else if(strcmp(type, PW_TYPE_INTERFACE_Port) == 0) { const char *port_name = spa_dict_lookup(props, PW_KEY_PORT_NAME); @@ -212,6 +214,8 @@ static void registry_event_global(void *data, uint32_t id, uint32_t permissions, gsr_pipewire_audio_create_links(self); } + } else if(self->num_ports >= GSR_PIPEWIRE_AUDIO_MAX_PORTS) { + fprintf(stderr, "gsr error: reached the maximum amount of audio ports\n"); } } } @@ -370,8 +374,10 @@ static bool string_remove_suffix(char *str, const char *suffix) { } static bool gsr_pipewire_audio_add_link_from_apps_to_output(gsr_pipewire_audio *self, const char **output_names, int num_output_names, const char *input_name, gsr_pipewire_audio_node_type output_type, gsr_pipewire_audio_link_input_type input_type, bool inverted) { - if(self->num_requested_links >= GSR_PIPEWIRE_AUDIO_MAX_REQUESTED_LINKS) + if(self->num_requested_links >= GSR_PIPEWIRE_AUDIO_MAX_REQUESTED_LINKS) { + fprintf(stderr, "gsr error: reached the maximum amount of audio links\n"); return false; + } char **output_names_copy = calloc(num_output_names, sizeof(char*)); if(!output_names_copy) |