resample: reject unhandled conversions
authorJanne Grunau <janne-libav@jannau.net>
Sat, 22 Oct 2011 22:31:16 +0000 (00:31 +0200)
committerJanne Grunau <janne-libav@jannau.net>
Tue, 25 Oct 2011 10:06:48 +0000 (12:06 +0200)
audio_resample can not reduce the number of channels

libavcodec/resample.c

index fce6272..ba8ce89 100644 (file)
@@ -162,9 +162,10 @@ ReSampleContext *av_audio_resample_init(int output_channels, int input_channels,
                MAX_CHANNELS);
         return NULL;
     }
-    if (output_channels > 2 &&
-        !(output_channels == 6 && input_channels == 2) &&
-        output_channels != input_channels) {
+    if (output_channels != input_channels &&
+        (input_channels  > 2 ||
+         output_channels > 2 &&
+         !(output_channels == 6 && input_channels == 2))) {
         av_log(NULL, AV_LOG_ERROR,
                "Resampling output channel count must be 1 or 2 for mono input; 1, 2 or 6 for stereo input; or N for N channel input.\n");
         return NULL;