From 3589ac6334c1281a9b2bee10ea8e549a5bc29cb5 Mon Sep 17 00:00:00 2001 From: Reinhard Tartler Date: Wed, 19 May 2010 11:38:30 +0000 Subject: Error out when too many bits per frame are requested. backport r23036 by alexc Originally committed as revision 23183 to svn://svn.ffmpeg.org/ffmpeg/branches/0.6 --- libavcodec/aacenc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c index ff68f84e7b..72e93a40c8 100644 --- a/libavcodec/aacenc.c +++ b/libavcodec/aacenc.c @@ -174,6 +174,10 @@ static av_cold int aac_encode_init(AVCodecContext *avctx) av_log(avctx, AV_LOG_ERROR, "Unsupported profile %d\n", avctx->profile); return -1; } + if (1024.0 * avctx->bit_rate / avctx->sample_rate > 6144 * avctx->channels) { + av_log(avctx, AV_LOG_ERROR, "Too many bits per frame requested\n"); + return -1; + } s->samplerate_index = i; dsputil_init(&s->dsp, avctx); -- cgit v1.2.3