]> git.sesse.net Git - ffmpeg/commitdiff
check for channels<=0 and print a reasonable error message
authorAlex Beregszaszi <alex@rtfs.hu>
Sun, 29 Apr 2007 13:25:32 +0000 (13:25 +0000)
committerAlex Beregszaszi <alex@rtfs.hu>
Sun, 29 Apr 2007 13:25:32 +0000 (13:25 +0000)
Originally committed as revision 8857 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavcodec/mpegaudio.c

index aa93442d57124fe981e528a3b38460925e158cc4..c8f25d114e6fd77af0aaa7cd0b6aa29ab8e5be10 100644 (file)
@@ -70,8 +70,10 @@ static int MPA_encode_init(AVCodecContext *avctx)
     int i, v, table;
     float a;
 
-    if (channels > 2)
+    if (channels <= 0 || channels > 2){
+        av_log(avctx, AV_LOG_ERROR, "encoding %d channel(s) is not allowed in mp2\n", channels);
         return -1;
+    }
     bitrate = bitrate / 1000;
     s->nb_channels = channels;
     s->freq = freq;