浏览代码

linux-alsa: Display the "Custom" entry once only

The "Custom" device entry was added inside the loop that runs for each
device; this causes "Custom" to be added once for each device detected,
or not at all if no device was detected. Moving this outside the loop
(as would appear to have been the original intent, judging by the
indentation) fixes this by adding the entry only after all devices have
been processed.
Sophie Hamilton 8 年之前
父节点
当前提交
3feea66d16
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      plugins/linux-alsa/alsa-input.c

+ 2 - 2
plugins/linux-alsa/alsa-input.c

@@ -312,8 +312,6 @@ obs_properties_t * alsa_get_properties(void *unused)
 
 		obs_property_list_add_string(devices, descr, name);
 
-	obs_property_list_add_string(devices, "Custom", "__custom__");
-
 	next:
 		if (name != NULL)
 			free(name), name = NULL;
@@ -326,6 +324,8 @@ obs_properties_t * alsa_get_properties(void *unused)
 
 		++hint;
 	}
+	obs_property_list_add_string(devices, "Custom", "__custom__");
+
 	snd_device_name_free_hint(hints);
 
 	return props;