diff options
author | Chris Robinson <[email protected]> | 2012-02-29 23:20:37 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2012-02-29 23:21:38 -0800 |
commit | ea4f458c1db73c21db887c00cd0074d6d2b049a6 (patch) | |
tree | f803dff596ef10df07343769ccb43262d4bad81d /Alc | |
parent | 394c76d64f8129020328bb4cdc5e2974b14b037e (diff) |
Avoid enumerating multiple devices with the same name
Diffstat (limited to 'Alc')
-rw-r--r-- | Alc/backends/pulseaudio.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Alc/backends/pulseaudio.c b/Alc/backends/pulseaudio.c index e80ee0bd..a4be58e2 100644 --- a/Alc/backends/pulseaudio.c +++ b/Alc/backends/pulseaudio.c @@ -525,6 +525,7 @@ static void sink_device_callback(pa_context *context, const pa_sink_info *info, { pa_threaded_mainloop *loop = pdata; void *temp; + ALuint i; (void)context; @@ -534,6 +535,12 @@ static void sink_device_callback(pa_context *context, const pa_sink_info *info, return; } + for(i = 0;i < numDevNames;i++) + { + if(strcmp(info->name, allDevNameMap[i].device_name) == 0) + return; + } + TRACE("Got device \"%s\", \"%s\"\n", info->description, info->name); temp = realloc(allDevNameMap, (numDevNames+1) * sizeof(*allDevNameMap)); @@ -550,6 +557,7 @@ static void source_device_callback(pa_context *context, const pa_source_info *in { pa_threaded_mainloop *loop = pdata; void *temp; + ALuint i; (void)context; @@ -559,6 +567,12 @@ static void source_device_callback(pa_context *context, const pa_source_info *in return; } + for(i = 0;i < numCaptureDevNames;i++) + { + if(strcmp(info->name, allCaptureDevNameMap[i].device_name) == 0) + return; + } + TRACE("Got device \"%s\", \"%s\"\n", info->description, info->name); temp = realloc(allCaptureDevNameMap, (numCaptureDevNames+1) * sizeof(*allCaptureDevNameMap)); |