From: Andre Noll Date: Wed, 11 Apr 2012 21:16:00 +0000 (+0200) Subject: oggdec: Do not decode more than necessary. X-Git-Tag: v0.4.11~13^2~5 X-Git-Url: http://git.tue.mpg.de/?a=commitdiff_plain;h=634e759f12fed8c6005526bc55a27c1f6562fecb;p=paraslash.git oggdec: Do not decode more than necessary. 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. --- diff --git a/oggdec_filter.c b/oggdec_filter.c index 79716a36..77356f32 100644 --- a/oggdec_filter.c +++ b/oggdec_filter.c @@ -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;