From ee81e76db119c4ac4f52404d9d826969975aa77f Mon Sep 17 00:00:00 2001 From: Tomas Härdin Date: Mon, 21 Mar 2011 10:52:36 +0100 Subject: wmaenc: improve channel count and bitrate error handling in encode_init() Signed-off-by: Michael Niedermayer Signed-off-by: Anton Khirnov --- libavcodec/wmaenc.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'libavcodec/wmaenc.c') diff --git a/libavcodec/wmaenc.c b/libavcodec/wmaenc.c index d2e811fd49..3cdb4a0b9b 100644 --- a/libavcodec/wmaenc.c +++ b/libavcodec/wmaenc.c @@ -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; -- cgit v1.2.3