]> git.sesse.net Git - ffmpeg/commitdiff
Improve channel count and bitrate error handling in wmav* encode_init()
authorTomas Härdin <tomas.hardin@codemill.se>
Mon, 21 Mar 2011 09:52:36 +0000 (10:52 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Thu, 24 Mar 2011 14:00:28 +0000 (15:00 +0100)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/wmaenc.c

index 911291838284632ef4ab3ba25d6c8aae8ce3ee82..0bafe1a64d109149514bb6907ce4cb3ca5453d1e 100644 (file)
@@ -33,11 +33,17 @@ static int encode_init(AVCodecContext * avctx){
 
     s->avctx = avctx;
 
-    if(avctx->channels > MAX_CHANNELS)
-        return -1;
+    if(avctx->channels > MAX_CHANNELS) {
+        av_log(avctx, AV_LOG_ERROR, "too many channels: got %i, need %i or fewer",
+               avctx->channels, MAX_CHANNELS);
+        return AVERROR(EINVAL);
+    }
 
-    if(avctx->bit_rate < 24*1000)
-        return -1;
+    if(avctx->bit_rate < 24*1000) {
+        av_log(avctx, AV_LOG_ERROR, "bitrate too low: got %i, need 24000 or higher\n",
+               avctx->bit_rate);
+        return AVERROR(EINVAL);
+    }
 
     /* extract flag infos */
     flags1 = 0;