From 142d5c985e691189ebfa341cb88f6bc4d22c532b Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 9 Nov 2013 23:21:17 +0100 Subject: af_lavrresample: reconfigure libavresample only on successful init If filter initialization fails anyway, we don't need to reconfigure libavresample. --- audio/filter/af_lavrresample.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'audio') diff --git a/audio/filter/af_lavrresample.c b/audio/filter/af_lavrresample.c index b94d9ffcd2..46428e1f76 100644 --- a/audio/filter/af_lavrresample.c +++ b/audio/filter/af_lavrresample.c @@ -250,14 +250,13 @@ static int control(struct af_instance *af, int cmd, void *arg) af->mul = (double) (out->rate * out->nch) / (in->rate * in->nch); af->delay = out->nch * s->opts.filter_size / FFMIN(af->mul, 1); - if (needs_lavrctx_reconfigure(s, in, out)) { - int r = configure_lavrr(af, in, out); - if (r != AF_OK) - return r; - } - return ((in->format == orig_in.format) && + int r = ((in->format == orig_in.format) && mp_chmap_equals(&in->channels, &orig_in.channels)) - ? AF_OK : AF_FALSE; + ? AF_OK : AF_FALSE; + + if (r == AF_OK && needs_lavrctx_reconfigure(s, in, out)) + r = configure_lavrr(af, in, out); + return r; } case AF_CONTROL_FORMAT_FMT | AF_CONTROL_SET: { if (af_to_avformat(*(int*)arg) == AV_SAMPLE_FMT_NONE) -- cgit v1.2.3