Ignore unnamed audio devices on enumeration

This was crashing trying to assign a nil CFStringRef from mystery audio
devices to the NSString passed to the enumerate block function, which
was predictably crashing. Ignore such devices instead.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
main
Christopher Snowhill 2022-10-16 15:23:06 -07:00
parent ab512e5086
commit 54f46d6380
1 changed files with 3 additions and 0 deletions

View File

@ -68,6 +68,9 @@
propsize = sizeof(name);
theAddress.mSelector = kAudioDevicePropertyDeviceNameCFString;
__Verify_noErr(AudioObjectGetPropertyData(devids[i], &theAddress, 0, NULL, &propsize, &name));
if(!name) {
continue;
}
propsize = 0;
theAddress.mSelector = kAudioDevicePropertyStreamConfiguration;