From: Andre Noll Date: Mon, 23 Dec 2013 19:15:39 +0000 (+0000) Subject: oggdec: Decode only OGGDEC_OUTPUT_CHUNK_SIZE many bytes per iteration. X-Git-Tag: v0.5.2~1^2 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=a54566f16cf09d6a1e5bbd0da200f66f553556db;ds=sidebyside oggdec: Decode only OGGDEC_OUTPUT_CHUNK_SIZE many bytes per iteration. This avoids buffer underruns on slow hardware and simplifies ogg_post_select() a bit. --- diff --git a/oggdec_filter.c b/oggdec_filter.c index f41150f2..fd06cd16 100644 --- a/oggdec_filter.c +++ b/oggdec_filter.c @@ -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) {