changeset 4885:4f351b1e02bc libavcodec

check for channels<=0 and print a reasonable error message
author alex
date Sun, 29 Apr 2007 13:25:32 +0000
parents b23051d2a676
children 7eba8b456a3f
files mpegaudio.c
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mpegaudio.c	Sun Apr 29 09:37:07 2007 +0000
+++ b/mpegaudio.c	Sun Apr 29 13:25:32 2007 +0000
@@ -70,8 +70,10 @@
     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;