[vlc-commits] auhal: do passthrough only when requested

Thomas Guillem git at videolan.org
Fri Mar 9 11:23:50 CET 2018


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Fri Mar  9 10:24:21 2018 +0100| [733612862b0b4ce624b9398a4f2ffc3281df9b75] | committer: Thomas Guillem

auhal: do passthrough only when requested

This module should do passthrough only when requested by the user (by choosing
the (Encoded Output) audio device).

This fixes a regression since 2.2.x

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

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

diff --git a/modules/audio_output/auhal.c b/modules/audio_output/auhal.c
index 8d392c00f9..ec80c95257 100644
--- a/modules/audio_output/auhal.c
+++ b/modules/audio_output/auhal.c
@@ -886,7 +886,7 @@ SwitchAudioDevice(audio_output_t *p_aout, const char *name)
     else
         p_sys->i_new_selected_dev = 0;
 
-    p_sys->i_new_selected_dev = p_sys->i_new_selected_dev & ~AOUT_VAR_SPDIF_FLAG;
+    p_sys->i_new_selected_dev = p_sys->i_new_selected_dev;
 
     aout_DeviceReport(p_aout, name);
     aout_RestartRequest(p_aout, AOUT_RESTART_OUTPUT);
@@ -1452,7 +1452,20 @@ Start(audio_output_t *p_aout, audio_sample_format_t *restrict fmt)
     p_sys->b_changed_mixing = false;
 
     vlc_mutex_lock(&p_sys->selected_device_lock);
-    p_sys->i_selected_dev = p_sys->i_new_selected_dev;
+    bool do_spdif;
+    if (AOUT_FMT_SPDIF (fmt))
+    {
+        if (!(p_sys->i_new_selected_dev & AOUT_VAR_SPDIF_FLAG))
+        {
+            vlc_mutex_unlock(&p_sys->selected_device_lock);
+            return VLC_EGENERIC;
+        }
+        do_spdif = true;
+    }
+    else
+        do_spdif = false;
+
+    p_sys->i_selected_dev = p_sys->i_new_selected_dev & ~AOUT_VAR_SPDIF_FLAG;
 
     aout_FormatPrint(p_aout, "VLC is looking for:", fmt);
 
@@ -1527,7 +1540,7 @@ Start(audio_output_t *p_aout, audio_sample_format_t *restrict fmt)
     mtime_t i_latency_us = i_latency_samples * CLOCK_FREQ / fmt->i_rate;
 
     /* Check for Digital mode or Analog output mode */
-    if (AOUT_FMT_SPDIF (fmt))
+    if (do_spdif)
     {
         if (StartSPDIF (p_aout, fmt, i_latency_us) == VLC_SUCCESS)
         {



More information about the vlc-commits mailing list