]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
oggdec: Do not decode more than necessary.
authorAndre Noll <maan@systemlinux.org>
Wed, 11 Apr 2012 21:16:00 +0000 (23:16 +0200)
committerAndre Noll <maan@systemlinux.org>
Sat, 19 May 2012 09:48:43 +0000 (11:48 +0200)
Currently the ogg vorbis decoder decodes at least one buffer per
scheduler iteration and checks only then if its output queue is already
full. This is bad for several reasons, increased memory footprint is
one of them.

This patch adds an additional check at the beginning of
ogg_post_select() that causes the function to return early if the
output queue is full.

oggdec_filter.c

index 79716a36c2e1c5a2f94e30b1212bfa58c3e75ed8..77356f320414a5c3be009a017612a2a3bbd21b33 100644 (file)
@@ -212,6 +212,8 @@ static void ogg_post_select(__a_unused struct sched *s, struct task *t)
                goto out;
        if (ret <= 0 && !pod->have_more) /* nothing to do */
                goto out;
+       if (btr_get_output_queue_size(btrn) > OGGDEC_MAX_OUTPUT_SIZE)
+               return;
        if (!pod->vf) {
                if (ret <= 0)
                        goto out;