[PATCH 6/9] Make wmaprodec.c:decode_init() return AVERROR_INVALIDDATA / AVERROR_PATCHWELCOME in case of invalid / unsupported number of channels specified, rather than return AVERROR_NOTSUPP.

Stefano Sabatini stefano.sabatini-lala
Sat Mar 13 21:40:37 CET 2010


---
 libavcodec/wmaprodec.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/libavcodec/wmaprodec.c b/libavcodec/wmaprodec.c
index 2a597b4..c5ae527 100644
--- a/libavcodec/wmaprodec.c
+++ b/libavcodec/wmaprodec.c
@@ -343,9 +343,13 @@ static av_cold int decode_init(AVCodecContext *avctx)
         }
     }
 
-    if (s->num_channels < 0 || s->num_channels > WMAPRO_MAX_CHANNELS) {
-        av_log_ask_for_sample(avctx, "invalid number of channels\n");
-        return AVERROR_NOTSUPP;
+    if (s->num_channels < 0) {
+        av_log(avctx, AV_LOG_ERROR, "invalid number of channels %i\n", s->num_channels);
+        return AVERROR_INVALIDDATA;
+    }
+    if (s->num_channels > WMAPRO_MAX_CHANNELS) {
+        av_log_ask_for_sample(avctx, "unsupported number of channels\n");
+        return AVERROR_PATCHWELCOME;
     }
 
     INIT_VLC_STATIC(&sf_vlc, SCALEVLCBITS, HUFF_SCALE_SIZE,
-- 
1.7.0


--zhXaljGHf11kAtnf--



More information about the ffmpeg-devel mailing list