Don't allow unsupported resampling configurations.
authorAlex Converse <aconverse@google.com>
Tue, 10 May 2011 22:10:31 +0000 (15:10 -0700)
committerAlex Converse <alex.converse@gmail.com>
Wed, 11 May 2011 03:07:15 +0000 (20:07 -0700)
libavcodec/resample.c

index 2185a11..9f0599f 100644 (file)
@@ -156,6 +156,11 @@ ReSampleContext *av_audio_resample_init(int output_channels, int input_channels,
         av_log(NULL, AV_LOG_ERROR, "Resampling with input channels greater than 2 unsupported.\n");
         return NULL;
       }
+    if (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 and 1, 2 or 6 for stereo input.\n");
+        return NULL;
+    }
 
     s = av_mallocz(sizeof(ReSampleContext));
     if (!s)