[vlc-commits] auhal: do not check if device 0 is alive

David Fuhrmann git at videolan.org
Sat May 11 20:18:22 CEST 2013


vlc | branch: master | David Fuhrmann <david.fuhrmann at googlemail.com> | Sat May 11 20:14:48 2013 +0200| [cd5a89ae213c6a12a42399f9b2768ca7aa3a4eea] | committer: David Fuhrmann

auhal: do not check if device 0 is alive

It will fail in any way.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=cd5a89ae213c6a12a42399f9b2768ca7aa3a4eea
---

 modules/audio_output/auhal.c |   26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/modules/audio_output/auhal.c b/modules/audio_output/auhal.c
index 6634046..33ec18e 100644
--- a/modules/audio_output/auhal.c
+++ b/modules/audio_output/auhal.c
@@ -279,23 +279,23 @@ static int Start(audio_output_t *p_aout, audio_sample_format_t *restrict fmt)
 
     msg_Dbg(p_aout, "attempting to use device %i", p_sys->i_selected_dev);
 
-    /* Check if the desired device is alive and usable */
-    i_param_size = sizeof(b_alive);
-    AudioObjectPropertyAddress audioDeviceAliveAddress = { kAudioDevicePropertyDeviceIsAlive,
-                                              kAudioObjectPropertyScopeGlobal,
-                                              kAudioObjectPropertyElementMaster };
-    err = AudioObjectGetPropertyData(p_sys->i_selected_dev, &audioDeviceAliveAddress, 0, NULL, &i_param_size, &b_alive);
+    AudioObjectPropertyAddress audioDeviceAliveAddress = { kAudioDevicePropertyDeviceIsAlive, kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMaster };
+    if (p_sys->i_selected_dev > 0) {
+        /* Check if the desired device is alive and usable */
+        i_param_size = sizeof(b_alive);
+        err = AudioObjectGetPropertyData(p_sys->i_selected_dev, &audioDeviceAliveAddress, 0, NULL, &i_param_size, &b_alive);
+        if (err != noErr) {
+            /* Be tolerant, only give a warning here */
+            msg_Warn(p_aout, "could not check whether device [0x%x] is alive [%4.4s]",
+                     (unsigned int)p_sys->i_selected_dev, (char *)&err);
+            b_alive = false;
+        }
 
-    if (err != noErr) {
-        /* Be tolerant, only give a warning here */
-        msg_Warn(p_aout, "could not check whether device [0x%x] is alive [%4.4s]",
-                           (unsigned int)p_sys->i_selected_dev, (char *)&err);
-        b_alive = false;
+        if (!b_alive)
+            msg_Warn(p_aout, "selected audio device is not alive, switching to default device");
     }
 
     if (!b_alive || p_sys->i_selected_dev == 0) {
-        msg_Warn(p_aout, "selected audio device is not alive, switching to default device");
-
         AudioObjectID defaultDeviceID = 0;
         UInt32 propertySize = 0;
         AudioObjectPropertyAddress defaultDeviceAddress = { kAudioHardwarePropertyDefaultOutputDevice, kAudioDevicePropertyScopeOutput, kAudioObjectPropertyElementMaster };



More information about the vlc-commits mailing list