From 253f6f1a9533a328908a6c97975583e7ec4dc5b2 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 19 Jul 2015 22:54:03 +0200 Subject: af_lavrresample: always reinit resampler on filter reinit This was a minor optimization to potentially avoid resampler reconfiguration when the filter is reinitialized. But filter reinitialization is a rare event, and the case when no reconfiguration is needed is even rarer. As such, this is an unnecessary micro- optimization and only adds potential for bugs. --- audio/filter/af_lavrresample.c | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) (limited to 'audio/filter') diff --git a/audio/filter/af_lavrresample.c b/audio/filter/af_lavrresample.c index e2c5ff95e1..bea3db3744 100644 --- a/audio/filter/af_lavrresample.c +++ b/audio/filter/af_lavrresample.c @@ -161,23 +161,6 @@ static int rate_from_speed(int rate, double speed) return lrint(rate * speed); } -static bool needs_lavrctx_reconfigure(struct af_resample *s, - struct mp_audio *in, - struct mp_audio *out) -{ - return s->ctx.in_rate_af != in->rate || - s->ctx.in_format != in->format || - !mp_chmap_equals(&s->ctx.in_channels, &in->channels) || - s->ctx.out_rate != out->rate || - s->ctx.out_format != out->format || - !mp_chmap_equals(&s->ctx.out_channels, &out->channels) || - s->ctx.filter_size != s->opts.filter_size || - s->ctx.phase_shift != s->opts.phase_shift || - s->ctx.linear != s->opts.linear || - s->ctx.cutoff != s->opts.cutoff; - -} - // Return the format libavresample should convert to, given the final output // format mp_format. In some cases (S24) we perform an extra conversion step, // and signal here what exactly libavresample should output. It will be the @@ -384,7 +367,7 @@ static int control(struct af_instance *af, int cmd, void *arg) mp_chmap_equals(&in->channels, &orig_in.channels)) ? AF_OK : AF_FALSE; - if (r == AF_OK && needs_lavrctx_reconfigure(s, in, out)) + if (r == AF_OK) r = configure_lavrr(af, in, out, true); return r; } -- cgit v1.2.3