[vlc-devel] [PATCH 4/6] aout: reflect channel count from requested stereo-mode

Thomas Guillem thomas at gllm.fr
Thu Jul 16 14:25:33 CEST 2020


This will fix weird case when the user request a mono/stereo/headphone mode but
the output is configured for > stereo channels.
---
 src/audio_output/output.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/audio_output/output.c b/src/audio_output/output.c
index 750139f4ad3..cbcabf881a2 100644
--- a/src/audio_output/output.c
+++ b/src/audio_output/output.c
@@ -485,20 +485,26 @@ static void aout_UpdateStereoMode(audio_output_t *aout, int mode,
         case AOUT_VAR_CHAN_RSTEREO:
             filters_cfg->remap[AOUT_CHANIDX_LEFT] = AOUT_CHANIDX_RIGHT;
             filters_cfg->remap[AOUT_CHANIDX_RIGHT] = AOUT_CHANIDX_LEFT;
+            fmt->i_physical_channels = AOUT_CHANS_STEREO;
             break;
         case AOUT_VAR_CHAN_STEREO:
+            fmt->i_physical_channels = AOUT_CHANS_STEREO;
             break;
         case AOUT_VAR_CHAN_LEFT:
             filters_cfg->remap[AOUT_CHANIDX_RIGHT] = AOUT_CHANIDX_DISABLE;
+            fmt->i_physical_channels = AOUT_CHAN_CENTER;
             break;
         case AOUT_VAR_CHAN_RIGHT:
             filters_cfg->remap[AOUT_CHANIDX_LEFT] = AOUT_CHANIDX_DISABLE;
+            fmt->i_physical_channels = AOUT_CHAN_CENTER;
             break;
         case AOUT_VAR_CHAN_DOLBYS:
             fmt->i_chan_mode = AOUT_CHANMODE_DOLBYSTEREO;
+            fmt->i_physical_channels = AOUT_CHANS_STEREO;
             break;
         case AOUT_VAR_CHAN_HEADPHONES:
             filters_cfg->headphones = true;
+            fmt->i_physical_channels = AOUT_CHANS_STEREO;
             break;
         case AOUT_VAR_CHAN_MONO:
             /* Remix all channels into one */
@@ -561,11 +567,6 @@ int aout_OutputNew (audio_output_t *aout)
         fmt->i_format = (fmt->i_bitspersample > 16) ? VLC_CODEC_FL32
                                                     : VLC_CODEC_S16N;
 
-        if (fmt->i_physical_channels == AOUT_CHANS_STEREO
-         && (owner->requested_stereo_mode == AOUT_VAR_CHAN_LEFT
-          || owner->requested_stereo_mode == AOUT_VAR_CHAN_RIGHT))
-            fmt->i_physical_channels = AOUT_CHAN_CENTER;
-
         if (i_nb_input_channels != 1)
         {
             int default_stereo_mode =
-- 
2.20.1



More information about the vlc-devel mailing list