Avoid enumerating multiple devices with the same name
This commit is contained in:
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user