[vlc-commits] auhal: don't Stop AudioUnit(PCM) and AudioDevice (S/PDIF)

Thomas Guillem git at videolan.org
Thu Mar 2 18:16:53 CET 2017


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Mar  2 13:12:53 2017 +0100| [1be694a510bebb9a7abe1fc57397dc1175a253e7] | committer: Thomas Guillem

auhal: don't Stop AudioUnit(PCM) and AudioDevice (S/PDIF)

Either au_unit is valid and we were playing PCM or b_digital is true and we
were playing S/PDIF.

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

 modules/audio_output/auhal.c | 37 +++++++++++++++++++------------------
 1 file changed, 19 insertions(+), 18 deletions(-)

diff --git a/modules/audio_output/auhal.c b/modules/audio_output/auhal.c
index 3f7212e..28e6eb9 100644
--- a/modules/audio_output/auhal.c
+++ b/modules/audio_output/auhal.c
@@ -1302,9 +1302,10 @@ Stop(audio_output_t *p_aout)
         au_Uninitialize(p_aout, p_sys->au_unit);
         AudioComponentInstanceDispose(p_sys->au_unit);
     }
-
-    if (p_sys->b_digital)
+    else
     {
+        assert(p_sys->b_digital);
+
         /* Stop device */
         err = AudioDeviceStop(p_sys->i_selected_dev,
                                p_sys->i_procID);
@@ -1350,30 +1351,30 @@ Stop(audio_output_t *p_aout)
                         (const char *)&err);
         }
         ca_Uninitialize(p_aout);
-    }
 
-    if (p_sys->i_hog_pid == getpid())
-    {
-        p_sys->i_hog_pid = -1;
+        if (p_sys->i_hog_pid == getpid())
+        {
+            p_sys->i_hog_pid = -1;
+
+            /*
+             * HACK: On 10.6, auhal will trigger the streams changed callback
+             * when calling below line, directly in the same thread. This call
+             * needs to be ignored to avoid endless restarting.
+             */
+            p_sys->b_ignore_streams_changed_callback = true;
+            AO_SETPROP(p_sys->i_selected_dev, sizeof(p_sys->i_hog_pid),
+                       &p_sys->i_hog_pid, kAudioDevicePropertyHogMode,
+                       kAudioObjectPropertyScopeOutput);
+            p_sys->b_ignore_streams_changed_callback = false;
+        }
 
-        /*
-         * HACK: On 10.6, auhal will trigger the streams changed callback when
-         * calling below line, directly in the same thread. This call needs to
-         * be ignored to avoid endless restarting.
-         */
-        p_sys->b_ignore_streams_changed_callback = true;
-        AO_SETPROP(p_sys->i_selected_dev, sizeof(p_sys->i_hog_pid),
-                   &p_sys->i_hog_pid, kAudioDevicePropertyHogMode,
-                   kAudioObjectPropertyScopeOutput);
-        p_sys->b_ignore_streams_changed_callback = false;
+        p_sys->b_digital = false;
     }
 
     /* remove audio device alive callback */
     AO_UPDATELISTENER(p_sys->i_selected_dev, false, DeviceAliveListener, p_aout,
                       kAudioDevicePropertyDeviceIsAlive,
                       kAudioObjectPropertyScopeGlobal);
-
-    p_sys->b_digital = false;
 }
 
 static int



More information about the vlc-commits mailing list