X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=aacdec_filter.c;h=95c13305519e39a86eff3cbe5cdf06b280ef8d04;hp=79c8bb660a9a94708b1d540d00d35b4795e0ba24;hb=8aa0f575bcca12ab63ab53141c2144448c457478;hpb=d4d37bb32a8d6219f9f52aa2ee3de55eb7e099c8 diff --git a/aacdec_filter.c b/aacdec_filter.c index 79c8bb66..95c13305 100644 --- a/aacdec_filter.c +++ b/aacdec_filter.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006-2010 Andre Noll + * Copyright (C) 2006-2011 Andre Noll * * Licensed under the GPL v2. For licencing details see COPYING. */ @@ -60,19 +60,7 @@ static int aacdec_execute(struct btr_node *btrn, const char *cmd, char **result) struct filter_node *fn = btr_context(btrn); struct private_aacdec_data *padd = fn->private_data; - if (!strcmp(cmd, "sample_rate")) { - if (padd->sample_rate == 0) - return -E_BTR_NAVAIL; - *result = make_message("%u", padd->sample_rate); - return 1; - } - if (!strcmp(cmd, "channels")) { - if (padd->channels == 0) - return -E_BTR_NAVAIL; - *result = make_message("%u", padd->channels); - return 1; - } - return -ERRNO_TO_PARA_ERROR(ENOTSUP); + return decoder_execute(cmd, padd->sample_rate, padd->channels, result); } static void aacdec_open(struct filter_node *fn) @@ -101,7 +89,7 @@ static void aacdec_post_select(__a_unused struct sched *s, struct task *t) int i, ret; unsigned char *p, *inbuf, *outbuffer; char *btr_buf; - size_t len, skip, consumed, loaded, iqs; + size_t len, skip, consumed, loaded; next_buffer: t->error = 0; @@ -112,9 +100,8 @@ next_buffer: return; btr_merge(btrn, fn->min_iqs); len = btr_next_buffer(btrn, (char **)&inbuf); - len = PARA_MAX(len, (size_t)8192); + len = PARA_MIN(len, (size_t)8192); consumed = 0; - iqs = btr_get_input_queue_size(btrn); if (!padd->initialized) { unsigned long rate = 0; unsigned char channels = 0; @@ -180,13 +167,17 @@ next_buffer: ret = -E_AAC_DECODE; if (padd->error_count++ > MAX_ERRORS) goto err; - PARA_ERROR_LOG("frame_error: %d (%s), consumed: %zu + %zd + %lu\n", - err, NeAACDecGetErrorMessage(padd->frame_info.error), + /* Suppress non-fatal bitstream error message at BOF/EOF */ + if (len < fn->min_iqs || padd->consumed_total == 0) { + consumed = len; + goto success; + } + PARA_ERROR_LOG("%s\n", NeAACDecGetErrorMessage(err)); + PARA_ERROR_LOG("consumed: %zu + %zd + %lu\n", padd->consumed_total, consumed, padd->frame_info.bytesconsumed); - PARA_ERROR_LOG("%s\n", NeAACDecGetErrorMessage( - padd->frame_info.error)); - consumed++; /* catch 21 */ + if (consumed < len) + consumed++; /* catch 21 */ goto success; } padd->error_count = 0;