[FFmpeg-cvslog] Improve channel count and bitrate error handling in wmav* encode_init()
Tomas Härdin
git at videolan.org
Thu Mar 24 15:18:58 CET 2011
ffmpeg | branch: master | Tomas Härdin <tomas.hardin at codemill.se> | Mon Mar 21 10:52:36 2011 +0100| [0cd138340e5d7c668eb392721fa0015e5732cb39] | committer: Michael Niedermayer
Improve channel count and bitrate error handling in wmav* encode_init()
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0cd138340e5d7c668eb392721fa0015e5732cb39
---
libavcodec/wmaenc.c | 16 +++++++++++-----
1 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/libavcodec/wmaenc.c b/libavcodec/wmaenc.c
index 9112918..0bafe1a 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;
More information about the ffmpeg-cvslog
mailing list