From: Andre Date: Sat, 10 Jun 2006 01:29:27 +0000 (+0200) Subject: aacdec: Introduce error_count X-Git-Tag: v0.2.14~63^2~9 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=d7f72444e863fb5aae145d4e720cd71dc03578b0;ds=sidebyside aacdec: Introduce error_count and abort after 20 consecutive errors. --- 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)