From 0f96f0d9968a767ead3aec823fcdfb78f26f7be7 Mon Sep 17 00:00:00 2001 From: Reimar Döffinger Date: Fri, 6 Apr 2012 15:25:05 +0200 Subject: aacenc: Fix issues with huge values of bit_rate. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Do not pointlessly call ff_alloc_packet 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 Signed-off-by: Derek Buitenhuis --- libavcodec/aaccoder.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'libavcodec/aaccoder.c') diff --git a/libavcodec/aaccoder.c b/libavcodec/aaccoder.c index 36a49a7538..c2b0e241a9 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]) { -- cgit v1.2.3