summaryrefslogtreecommitdiff
path: root/libavcodec/wmaenc.c
diff options
context:
space:
mode:
authorTomas Härdin <tomas.hardin@codemill.se>2011-03-21 10:52:36 +0100
committerMichael Niedermayer <michaelni@gmx.at>2011-03-24 15:00:28 +0100
commit0cd138340e5d7c668eb392721fa0015e5732cb39 (patch)
tree8de8054812647e826a06ead849f807d2ce107f20 /libavcodec/wmaenc.c
parent2fd41c9067fc67b40f80e9cbd4787018009040db (diff)
Improve channel count and bitrate error handling in wmav* encode_init()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/wmaenc.c')
-rw-r--r--libavcodec/wmaenc.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/libavcodec/wmaenc.c b/libavcodec/wmaenc.c
index 9112918382..0bafe1a64d 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;