Browse Source

libobs: Rework checking Mac audio device capabilities

As of commit 2eb5a22, CoreAudio devices that use one device handle for
both input and output can no longer be used for audio monitoring. This
commit fixes that.

Tested with the built-in output, a Magewell XI100DUSB-HDMI which is
input only, and a MOTU UltraLite audio interface, which shows as
output/input capable.
Luke Yelavich 7 years ago
parent
commit
002696e795
1 changed files with 5 additions and 7 deletions
  1. 5 7
      libobs/audio-monitoring/osx/coreaudio-enum-devices.c

+ 5 - 7
libobs/audio-monitoring/osx/coreaudio-enum-devices.c

@@ -25,16 +25,14 @@ static bool obs_enum_audio_monitoring_device(obs_enum_audio_device_cb cb,
 
 	AudioObjectPropertyAddress addr = {
 		kAudioDevicePropertyStreams,
-		kAudioDevicePropertyScopeInput,
+		kAudioDevicePropertyScopeOutput,
 		kAudioObjectPropertyElementMaster
 	};
 
-	/* check to see if it's a mac input device */
-	if (!allow_inputs) {
-		AudioObjectGetPropertyDataSize(id, &addr, 0, NULL, &size);
-		if (size)
-			return true;
-	}
+	/* Check if the device is capable of audio output. */
+	AudioObjectGetPropertyDataSize(id, &addr, 0, NULL, &size);
+	if (!allow_inputs && !size)
+		return true;
 
 	size = sizeof(CFStringRef);