aacdec: Make frame_info local to ->post_select().
authorAndre Noll <maan@systemlinux.org>
Thu, 17 Apr 2014 23:52:14 +0000 (23:52 +0000)
committerAndre Noll <maan@tuebingen.mpg.de>
Sat, 25 Mar 2017 10:54:36 +0000 (11:54 +0100)
We don't need to preserve this value across multiple calls to
->post_select().

aacdec_filter.c

index 797e5b9cb168745087eb0b1303f7f0aba62b67bf..5c1ea6d395347810ab9216707fd36aaf1b78a365 100644 (file)
@@ -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;