From: Andre Noll Date: Thu, 17 Apr 2014 23:52:14 +0000 (+0000) Subject: aacdec: Make frame_info local to ->post_select(). X-Git-Tag: v0.6.0~7^2~4 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=3013ef1f9e2dcd1426041837daf86f3d401acd94;hp=597de66c60f58d1e659630e40b3cf67033b8ce3d aacdec: Make frame_info local to ->post_select(). We don't need to preserve this value across multiple calls to ->post_select(). --- diff --git a/aacdec_filter.c b/aacdec_filter.c index 797e5b9c..5c1ea6d3 100644 --- a/aacdec_filter.c +++ b/aacdec_filter.c @@ -34,8 +34,6 @@ struct private_aacdec_data { /** the return value of aac_open */ NeAACDecHandle handle; - /** info about the currently decoded frame */ - NeAACDecFrameInfo frame_info; /** whether this instance of the aac decoder is already initialized */ int initialized; /** number of times the decoder returned an error */ @@ -99,6 +97,7 @@ static int aacdec_post_select(__a_unused struct sched *s, void *context) int i, ret; char *inbuf, *outbuf, *btrbuf; size_t len, consumed, loaded; + NeAACDecFrameInfo frame_info; next_buffer: ret = btr_node_status(btrn, fn->min_iqs, BTR_NT_INTERNAL); @@ -131,10 +130,10 @@ next_buffer: goto success; //PARA_CRIT_LOG("consumed: %zu (%zu + %zu), have: %zu\n", padd->consumed_total + consumed, // padd->consumed_total, consumed, len - consumed); - outbuf = NeAACDecDecode(padd->handle, &padd->frame_info, + outbuf = NeAACDecDecode(padd->handle, &frame_info, (unsigned char *)inbuf + consumed, len - consumed); - if (padd->frame_info.error) { - int err = padd->frame_info.error; + if (frame_info.error) { + int err = frame_info.error; ret = -E_AAC_DECODE; if (padd->error_count++ > MAX_ERRORS) goto err; @@ -143,18 +142,18 @@ next_buffer: PARA_NOTICE_LOG("consumed (total, buffer, frame): " "%zu, %zu, %lu\n", padd->consumed_total, consumed, - padd->frame_info.bytesconsumed); + frame_info.bytesconsumed); consumed++; /* just eat one byte and hope for the best */ goto success; } padd->error_count = 0; - //PARA_CRIT_LOG("decoder ate %lu\n", padd->frame_info.bytesconsumed); - consumed += padd->frame_info.bytesconsumed; - if (!padd->frame_info.samples) + //PARA_CRIT_LOG("decoder ate %lu\n", frame_info.bytesconsumed); + consumed += frame_info.bytesconsumed; + if (!frame_info.samples) goto success; - btrbuf = para_malloc(2 * padd->frame_info.samples); + btrbuf = para_malloc(2 * frame_info.samples); loaded = 0; - for (i = 0; i < padd->frame_info.samples; i++) { + for (i = 0; i < frame_info.samples; i++) { short sh = ((short *)outbuf)[i]; write_int16_host_endian(btrbuf + loaded, sh); loaded += 2;