From: Andre Noll Date: Tue, 27 Dec 2016 18:29:38 +0000 (+0100) Subject: resample: Simplify initialization(). X-Git-Tag: v0.5.7~7 X-Git-Url: http://git.tue.mpg.de/?a=commitdiff_plain;h=ee1015b8fbb06705fcddff926cb028ff61adaff6;p=paraslash.git resample: Simplify initialization(). In resample_init(), the first check removed in this commit was bogus because in case there is no parent buffer tree node, we must only abort if there is no input pending either. In resample_post_select(), we move up the check of the node status so that we now call resample_init() only after we know that there is input available. This makes the second check in resample_init() pointless as the condition can never be true. --- diff --git a/resample_filter.c b/resample_filter.c index 6a285ec3..1699ed2c 100644 --- a/resample_filter.c +++ b/resample_filter.c @@ -128,13 +128,7 @@ static int resample_init(struct filter_node *fn) int ret, converter; struct resample_context *ctx = fn->private_data; struct resample_filter_args_info *conf = fn->conf; - struct btr_node *btrn = fn->btrn; - ret = -E_RESAMPLE_EOF; - if (btr_no_parent(btrn)) - return ret; - if (btr_get_input_queue_size(btrn) == 0) - return 0; ret = resample_set_params(fn); if (ret < 0) return ret; @@ -216,14 +210,14 @@ static int resample_post_select(__a_unused struct sched *s, void *context) ret = check_wav_post_select(ctx->cwc); if (ret < 0) goto out; + ret = btr_node_status(btrn, fn->min_iqs, BTR_NT_INTERNAL); + if (ret <= 0) + goto out; if (!ctx->src_state) { ret = resample_init(fn); if (ret <= 0) goto out; } - ret = btr_node_status(btrn, fn->min_iqs, BTR_NT_INTERNAL); - if (ret <= 0) - goto out; if (ctx->source_sample_rate == conf->dest_sample_rate_arg) { /* * No resampling necessary. We do not splice ourselves out