From: Andre Noll Date: Sun, 3 Jan 2010 02:23:03 +0000 (+0100) Subject: Introduce filter_node->min_iqs. X-Git-Tag: v0.4.2~214 X-Git-Url: http://git.tue.mpg.de/?a=commitdiff_plain;h=4bd379f56960bddd9623f78b80f40b1dc9337a99;p=paraslash.git Introduce filter_node->min_iqs. --- diff --git a/aacdec_filter.c b/aacdec_filter.c index f41fe8b1..b9149ef2 100644 --- a/aacdec_filter.c +++ b/aacdec_filter.c @@ -209,6 +209,7 @@ static void aacdec_open(struct filter_node *fn) fn->private_data = padd; fn->bufsize = AAC_OUTBUF_SIZE; fn->buf = para_calloc(fn->bufsize); + fn->min_iqs = 2048; padd->handle = aac_open(); } @@ -235,7 +236,7 @@ static void aacdec_post_select(__a_unused struct sched *s, struct task *t) next_buffer: t->error = 0; - ret = prepare_filter_node(btrn, 2048); + ret = prepare_filter_node(btrn, fn->min_iqs); if (ret < 0) goto err; if (ret == 0) diff --git a/filter.h b/filter.h index ec8631f8..8ef0f27f 100644 --- a/filter.h +++ b/filter.h @@ -34,6 +34,7 @@ struct filter_node { void *conf; struct btr_node *btrn; struct task task; + size_t min_iqs; }; /** Describes one running instance of a chain of filters */ diff --git a/mp3dec_filter.c b/mp3dec_filter.c index dfec0c4c..c3f21f12 100644 --- a/mp3dec_filter.c +++ b/mp3dec_filter.c @@ -101,10 +101,9 @@ static void mp3dec_pre_select(struct sched *s, struct task *t) { struct filter_node *fn = container_of(t, struct filter_node, task); size_t iqs = btr_get_input_queue_size(fn->btrn); - struct private_mp3dec_data *pmd = fn->private_data; t->error = 0; - if (iqs <= pmd->input_len_barrier) + if (iqs <= fn->min_iqs) return; if (btr_bytes_pending(fn->btrn) > MP3DEC_MAX_PENDING) return; /* FIXME, should use reasonable bound on timeout */ @@ -216,7 +215,7 @@ next_buffer: iqs = btr_get_input_queue_size(btrn); if (need_bad_data_delay(pmd, iqs)) return; - ret = prepare_filter_node(btrn, pmd->input_len_barrier); + ret = prepare_filter_node(btrn, fn->min_iqs); if (ret < 0) goto err; if (ret == 0) @@ -233,14 +232,14 @@ next_frame: ret = -E_MP3DEC_EOF; goto err; } - pmd->input_len_barrier += 100; + fn->min_iqs += 100; goto next_buffer; } else if (pmd->stream.error != MAD_ERROR_LOSTSYNC) PARA_DEBUG_LOG("header decode: %s\n", mad_stream_errorstr(&pmd->stream)); goto next_buffer; } - pmd->input_len_barrier = 0; + fn->min_iqs = 0; pmd->samplerate = pmd->frame.header.samplerate; pmd->channels = MAD_NCHANNELS(&pmd->frame.header); ret = mad_frame_decode(&pmd->frame, &pmd->stream); diff --git a/oggdec_filter.c b/oggdec_filter.c index f968bf14..274d0c2a 100644 --- a/oggdec_filter.c +++ b/oggdec_filter.c @@ -43,7 +43,6 @@ struct private_oggdec_data { unsigned int channels; /** Current sample rate in Hz. */ unsigned int samplerate; - size_t min_iqs; }; static size_t cb_read_nobtr(void *buf, size_t size, size_t nmemb, void *datasource) @@ -208,7 +207,7 @@ static void ogg_post_select(__a_unused struct sched *s, struct task *t) char *in; t->error = 0; - ret = prepare_filter_node(btrn, pod->min_iqs); + ret = prepare_filter_node(btrn, fn->min_iqs); if (ret < 0) goto err; if (ret == 0) @@ -229,7 +228,7 @@ static void ogg_post_select(__a_unused struct sched *s, struct task *t) if (!btr_no_parent(btrn)) { free(pod->vf); pod->vf = NULL; - pod->min_iqs = iqs + 1; + fn->min_iqs = iqs + 1; return; } ret = (oret == OV_ENOTVORBIS)? diff --git a/wmadec_filter.c b/wmadec_filter.c index 7681a762..87de6b44 100644 --- a/wmadec_filter.c +++ b/wmadec_filter.c @@ -1249,29 +1249,29 @@ static void wmadec_post_select(__a_unused struct sched *s, struct task *t) int ret, converted = 0; struct private_wmadec_data *pwd = fn->private_data; struct btr_node *btrn = fn->btrn; - size_t len, min_len; + size_t len; char *in; - min_len = pwd? WMA_FRAME_SKIP + pwd->ahi.block_align : 8192; next_buffer: t->error = 0; - ret = prepare_filter_node(btrn, min_len); + ret = prepare_filter_node(btrn, fn->min_iqs); if (ret < 0) goto err; if (ret == 0) return; len = btr_next_buffer(btrn, (char **)&in); ret = -E_WMADEC_EOF; - if (len < min_len) + if (len < fn->min_iqs) goto err; if (!pwd) { ret = wma_decode_init(in, len, &pwd); if (ret < 0) goto err; if (ret == 0) { - min_len += 4096; + fn->min_iqs += 4096; goto next_buffer; } + fn->min_iqs = WMA_FRAME_SKIP + pwd->ahi.block_align; fn->private_data = pwd; converted = pwd->ahi.header_len; goto success; @@ -1343,6 +1343,7 @@ static void wmadec_open(struct filter_node *fn) fn->buf = para_malloc(fn->bufsize); fn->private_data = NULL; fn->loaded = 0; + fn->min_iqs = 4096; } /**