[vlc-commits] auhal: use own thread for notification loop
David Fuhrmann
git at videolan.org
Fri Nov 22 21:36:52 CET 2013
vlc/vlc-2.1 | branch: master | David Fuhrmann <david.fuhrmann at googlemail.com> | Fri Nov 22 18:49:42 2013 +0100| [cc6e30124319a7c59adab28ac442e4fc143d5054] | committer: David Fuhrmann
auhal: use own thread for notification loop
(cherry picked from commit 626174f3b9d86559db9c66ede56abd15a3d7ea5e)
Signed-off-by: David Fuhrmann <david.fuhrmann at googlemail.com>
> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.1.git/?a=commit;h=cc6e30124319a7c59adab28ac442e4fc143d5054
---
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 6fd20ba..a300aa3 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