[vlc-devel] [RFC PATCH] aout: fix aout_CheckChannelExtraction return value

Thomas Guillem thomas at gllm.fr
Mon Jul 27 17:42:12 CEST 2015

This function returns true if channel extraction is needed.

If layouts are the same, channel extraction should be needed only if the number
of channels is different.

I'm working on MediaCodec for audio, and use aout_CheckChannelExtraction to
extract channels like avcodec does. I noticed that aout_CheckChannelExtraction
returned true with stereo and mono samples. If I understand this function well,
it should not return true for that case since the audio layout and number of
channels are the same.

 src/audio_output/common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/audio_output/common.c b/src/audio_output/common.c
index 9c05ac5..3de1f6a 100644
--- a/src/audio_output/common.c
+++ b/src/audio_output/common.c
@@ -511,7 +511,7 @@ bool aout_CheckChannelExtraction( int *pi_selection,
         if( pi_selection[i] != i )
             return true;
-    return i_out == i_channels;
+    return i_out != i_channels;
 /* Return the order in which filters should be inserted */

More information about the vlc-devel mailing list