oggdec: Decode only OGGDEC_OUTPUT_CHUNK_SIZE many bytes per iteration.
authorAndre Noll <maan@systemlinux.org>
Mon, 23 Dec 2013 19:15:39 +0000 (19:15 +0000)
committerAndre Noll <maan@systemlinux.org>
Sun, 9 Mar 2014 14:33:03 +0000 (15:33 +0100)
This avoids buffer underruns on slow hardware and simplifies
ogg_post_select() a bit.

oggdec_filter.c

index f41150f..fd06cd1 100644 (file)
@@ -236,13 +236,8 @@ static int ogg_post_select(__a_unused struct sched *s, struct task *t)
                        break;
                fn->min_iqs = 0;
                have += ret;
-               if (have < OGGDEC_OUTPUT_CHUNK_SIZE)
-                       continue;
-               if (btr_get_output_queue_size(btrn) > OGGDEC_MAX_OUTPUT_SIZE)
+               if (have >= OGGDEC_OUTPUT_CHUNK_SIZE)
                        break;
-               btr_add_output(buf, have, btrn);
-               buf = para_malloc(OGGDEC_OUTPUT_CHUNK_SIZE);
-               have = 0;
        }
        pod->have_more = (ret > 0);
        if (have > 0) {