summaryrefslogtreecommitdiff
path: root/libavcodec/aacenc.c
diff options
context:
space:
mode:
authorReimar Döffinger <Reimar.Doeffinger@gmx.de>2012-04-06 15:25:05 +0200
committerReimar Döffinger <Reimar.Doeffinger@gmx.de>2012-04-07 11:48:20 +0200
commitecd7455e9626cdc38e7471ce938a8640bab688fa (patch)
tree038f301c8f849e3e9310d93a67dfcc45245e970c /libavcodec/aacenc.c
parent76e8b336cd12f49ebbf510609b323c6f25acd415 (diff)
downloadffmpeg-ecd7455e9626cdc38e7471ce938a8640bab688fa.tar.gz
aacenc: Fix issues with huge values of bit_rate.
Do not pointlessly call ff_alloc_packet2 multiple times, and fix an infinite loop by clamping the maximum number of bits to target in the algorithm that does not use lambda. Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
Diffstat (limited to 'libavcodec/aacenc.c')
-rw-r--r--libavcodec/aacenc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c
index 3ac2ad890d..76e4e8753e 100644
--- a/libavcodec/aacenc.c
+++ b/libavcodec/aacenc.c
@@ -571,11 +571,11 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
}
start_ch += chans;
}
+ if ((ret = ff_alloc_packet2(avctx, avpkt, 768 * s->channels)))
+ return ret;
do {
int frame_bits;
- if ((ret = ff_alloc_packet2(avctx, avpkt, 768 * s->channels)))
- return ret;
init_put_bits(&s->pb, avpkt->data, avpkt->size);
if ((avctx->frame_number & 0xFF)==1 && !(avctx->flags & CODEC_FLAG_BITEXACT))