From d7f72444e863fb5aae145d4e720cd71dc03578b0 Mon Sep 17 00:00:00 2001 From: Andre Date: Sat, 10 Jun 2006 03:29:27 +0200 Subject: [PATCH] aacdec: Introduce error_count and abort after 20 consecutive errors. --- aacdec.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/aacdec.c b/aacdec.c index e1841d98..edbe2637 100644 --- a/aacdec.c +++ b/aacdec.c @@ -34,6 +34,8 @@ /** the output buffer size */ #define AAC_OUTBUF_SIZE (32 * 1024) +#define MAX_ERRORS 20 + /** * data specific to the aacdec filter * @@ -45,6 +47,7 @@ struct private_aacdec_data { int initialized; int decoder_length; + unsigned error_count; size_t consumed_total; size_t entry; }; @@ -119,8 +122,10 @@ static ssize_t aacdec(char *input_buffer, size_t len, struct filter_node *fn) p = inbuf + consumed; outbuffer = NeAACDecDecode(padd->handle, &padd->frame_info, p, len - consumed); - ret = -E_AAC_DECODE; if (padd->frame_info.error) { + ret = -E_AAC_DECODE; + if (padd->error_count++ > MAX_ERRORS) + goto out; PARA_ERROR_LOG("frame_error: %d, consumed: %zu + %zd + %lu\n", padd->frame_info.error, padd->consumed_total, consumed, padd->frame_info.bytesconsumed); @@ -129,6 +134,7 @@ static ssize_t aacdec(char *input_buffer, size_t len, struct filter_node *fn) consumed++; /* catch 21 */ goto success; } + padd->error_count = 0; consumed += padd->frame_info.bytesconsumed; ret = consumed; if (!padd->frame_info.samples) -- 2.39.5