Commit 626174f3 authored by David Fuhrmann's avatar David Fuhrmann

auhal: use own thread for notification loop

parent 2f5891bd
...@@ -202,6 +202,19 @@ static int Open(vlc_object_t *obj) ...@@ -202,6 +202,19 @@ static int Open(vlc_object_t *obj)
p_aout->device_select = SwitchAudioDevice; p_aout->device_select = SwitchAudioDevice;
p_sys->device_list = CFArrayCreate(kCFAllocatorDefault, NULL, 0, NULL); p_sys->device_list = CFArrayCreate(kCFAllocatorDefault, NULL, 0, NULL);
/*
* Force an own run loop for callbacks.
*
* According to rtaudio, this is absolutely necessary since 10.6 to get correct notifications.
* It might fix issues when using the module as a library where a proper loop is not setup already.
*/
CFRunLoopRef theRunLoop = NULL;
AudioObjectPropertyAddress property = { kAudioHardwarePropertyRunLoop, kAudioObjectPropertyScopeGlobal,kAudioObjectPropertyElementMaster };
err = AudioObjectSetPropertyData(kAudioObjectSystemObject, &property, 0, NULL, sizeof(CFRunLoopRef), &theRunLoop);
if (err != noErr) {
msg_Err(p_aout, "failed to set the run loop property [%4.4s]", (char *)&err);
}
/* Attach a listener so that we are notified of a change in the device setup */ /* Attach a listener so that we are notified of a change in the device setup */
AudioObjectPropertyAddress audioDevicesAddress = { kAudioHardwarePropertyDevices, kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMaster }; AudioObjectPropertyAddress audioDevicesAddress = { kAudioHardwarePropertyDevices, kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMaster };
err = AudioObjectAddPropertyListener(kAudioObjectSystemObject, &audioDevicesAddress, DevicesListener, (void *)p_aout); err = AudioObjectAddPropertyListener(kAudioObjectSystemObject, &audioDevicesAddress, DevicesListener, (void *)p_aout);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment