diff options
author | dec05eba <dec05eba@protonmail.com> | 2022-09-30 21:14:12 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2022-09-30 21:14:12 +0200 |
commit | 09ad7a1eb5ff4a1d00776396c4582252e4bd83fc (patch) | |
tree | 7e0254baf15e7f4f6a03e9a802aa87c0c47546ee /src | |
parent | 912515303b6e7a6dee586a70d5eb02e4129ce22c (diff) |
Give each audio input a seperate node by giving them an unique context name
Diffstat (limited to 'src')
-rw-r--r-- | src/sound.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/sound.cpp b/src/sound.cpp index 9978e6f..abd2e65 100644 --- a/src/sound.cpp +++ b/src/sound.cpp @@ -43,8 +43,6 @@ } \ } while(false); -static int sound_device_index = 0; - static double clock_get_monotonic_seconds() { struct timespec ts; ts.tv_sec = 0; @@ -274,11 +272,10 @@ int sound_device_get_by_name(SoundDevice *device, const char *name, unsigned int buffer_attr.fragsize = buffer_attr.maxlength; // We want a unique stream name for every device which allows each input to be a different box in pipewire graph software - char stream_name[64]; - snprintf(stream_name, sizeof(stream_name), "record-%d", sound_device_index); - ++sound_device_index; + char stream_name[1024]; + snprintf(stream_name, sizeof(stream_name), "gpu-screen-recorder-%s", name); - pa_handle *handle = pa_sound_device_new(nullptr, "gpu-screen-recorder", name, stream_name, &ss, &buffer_attr, &error); + pa_handle *handle = pa_sound_device_new(nullptr, stream_name, name, stream_name, &ss, &buffer_attr, &error); if(!handle) { fprintf(stderr, "pa_simple_new() failed: %s. Audio input device %s might not be valid\n", pa_strerror(error), name); return -1; |