]> git.tue.mpg.de Git - paraslash.git/commitdiff
aacdec: Decode only one frame per iteration.
authorAndre Noll <maan@systemlinux.org>
Fri, 18 Apr 2014 00:13:08 +0000 (00:13 +0000)
committerAndre Noll <maan@tuebingen.mpg.de>
Sat, 25 Mar 2017 10:54:36 +0000 (11:54 +0100)
This improves latency and helps to avoid buffer underruns on slow
machines.

aacdec_filter.c

index 7e3ed80a700a13319b3790eeb4093a7db8f51a7e..e1cf802cb0e4c807e8684957424c7237eee787e4 100644 (file)
@@ -86,7 +86,7 @@ static int aacdec_post_select(__a_unused struct sched *s, void *context)
        struct private_aacdec_data *padd = fn->private_data;
        int i, ret;
        char *inbuf, *outbuf, *btrbuf;
-       size_t len, consumed, loaded;
+       size_t len, consumed, loaded = 0;
        NeAACDecFrameInfo frame_info;
 
 next_buffer:
@@ -142,7 +142,6 @@ next_buffer:
        if (!frame_info.samples)
                goto success;
        btrbuf = para_malloc(2 * frame_info.samples);
-       loaded = 0;
        for (i = 0; i < frame_info.samples; i++) {
                short sh = ((short *)outbuf)[i];
                write_int16_host_endian(btrbuf + loaded, sh);
@@ -152,7 +151,9 @@ next_buffer:
 success:
        btr_consume(btrn, consumed);
        padd->consumed_total += consumed;
-       goto next_buffer;
+       if (loaded == 0)
+               goto next_buffer;
+       return 1;
 err:
        assert(ret < 0);
        btr_remove_node(&fn->btrn);