output/osx: silently ignore some errors in osx_output_set_device()

This commit is contained in:
Max Kellermann 2020-05-28 15:02:14 +02:00
parent 1112d779be
commit 8d540737b9
1 changed files with 3 additions and 9 deletions

View File

@ -673,20 +673,14 @@ osx_output_set_device(OSXOutput *oo)
status = AudioObjectGetPropertyData(deviceids[i], &aopa_name, status = AudioObjectGetPropertyData(deviceids[i], &aopa_name,
0, nullptr, 0, nullptr,
&size, &cfname); &size, &cfname);
if (status != noErr) { if (status != noErr)
char errormsg[1024]; continue;
osx_os_status_to_cstring(status, errormsg, sizeof(errormsg));
throw FormatRuntimeError("Unable to determine OS X device name "
"(device %u): %s",
(unsigned int) deviceids[i],
errormsg);
}
const Apple::StringRef cfname_(cfname); const Apple::StringRef cfname_(cfname);
char name[256]; char name[256];
if (!cfname_.GetCString(name, sizeof(name))) if (!cfname_.GetCString(name, sizeof(name)))
throw std::runtime_error("Unable to convert device name from CFStringRef to char*"); continue;
if (StringIsEqual(oo->device_name, name)) { if (StringIsEqual(oo->device_name, name)) {
FormatDebug(osx_output_domain, FormatDebug(osx_output_domain,