[vlc-commits] auhal: use own thread for notification loop
David Fuhrmann
git at videolan.org
Fri Nov 22 21:30:09 CET 2013
vlc | branch: master | David Fuhrmann <david.fuhrmann at googlemail.com> | Fri Nov 22 18:49:42 2013 +0100| [626174f3b9d86559db9c66ede56abd15a3d7ea5e] | committer: David Fuhrmann
auhal: use own thread for notification loop
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=626174f3b9d86559db9c66ede56abd15a3d7ea5e
---
modules/audio_output/auhal.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/modules/audio_output/auhal.c b/modules/audio_output/auhal.c
index f50ff53..50f5411 100644
--- a/modules/audio_output/auhal.c
+++ b/modules/audio_output/auhal.c
@@ -202,6 +202,19 @@ static int Open(vlc_object_t *obj)
p_aout->device_select = SwitchAudioDevice;
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 */
AudioObjectPropertyAddress audioDevicesAddress = { kAudioHardwarePropertyDevices, kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMaster };
err = AudioObjectAddPropertyListener(kAudioObjectSystemObject, &audioDevicesAddress, DevicesListener, (void *)p_aout);
More information about the vlc-commits
mailing list