diff options
author | Reimar Döffinger <Reimar.Doeffinger@gmx.de> | 2012-04-06 15:25:05 +0200 |
---|---|---|
committer | Reimar Döffinger <Reimar.Doeffinger@gmx.de> | 2012-04-07 11:48:20 +0200 |
commit | ecd7455e9626cdc38e7471ce938a8640bab688fa (patch) | |
tree | 038f301c8f849e3e9310d93a67dfcc45245e970c /libavcodec/aaccoder.c | |
parent | 76e8b336cd12f49ebbf510609b323c6f25acd415 (diff) | |
download | ffmpeg-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/aaccoder.c')
-rw-r--r-- | libavcodec/aaccoder.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/libavcodec/aaccoder.c b/libavcodec/aaccoder.c index 25187b7c87..b6fefd3e62 100644 --- a/libavcodec/aaccoder.c +++ b/libavcodec/aaccoder.c @@ -721,6 +721,9 @@ static void search_for_quantizers_twoloop(AVCodecContext *avctx, int allz = 0; float minthr = INFINITY; + // for values above this the decoder might end up in an endless loop + // due to always having more bits than what can be encoded. + destbits = FFMIN(destbits, 5800); //XXX: some heuristic to determine initial quantizers will reduce search time //determine zero bands and upper limits for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) { |