af_lavrresample: don't unnecessarily print remix message

This message bloats verbose log output if e.g. audio speed is frequently
readjusted, such as when syncing audio to video. So don't print the
message if only speed is changed. (This case requires reconfiguration,
but can't change the input/output channel maps.)

Also do not print the message if no remixing is done at all.
This commit is contained in:
wm4 2015-07-19 22:50:08 +02:00
parent 2cf019ed70
commit 8749900b5f
1 changed files with 8 additions and 8 deletions

View File

@ -212,7 +212,7 @@ static void transpose_order(int *map, int num)
}
static int configure_lavrr(struct af_instance *af, struct mp_audio *in,
struct mp_audio *out)
struct mp_audio *out, bool verbose)
{
struct af_resample *s = af->priv;
@ -274,8 +274,10 @@ static int configure_lavrr(struct af_instance *af, struct mp_audio *in,
mp_chmap_from_lavc(&in_lavc, in_ch_layout);
mp_chmap_from_lavc(&out_lavc, out_ch_layout);
MP_VERBOSE(af, "Remix: %s -> %s\n", mp_chmap_to_str(&in_lavc),
mp_chmap_to_str(&out_lavc));
if (verbose && !mp_chmap_equals(&in_lavc, &out_lavc)) {
MP_VERBOSE(af, "Remix: %s -> %s\n", mp_chmap_to_str(&in_lavc),
mp_chmap_to_str(&out_lavc));
}
if (in_lavc.num != map_in.num) {
// For handling NA channels, we would have to add a planarization step.
@ -339,9 +341,7 @@ static int configure_lavrr(struct af_instance *af, struct mp_audio *in,
// * Also, the input channel layout must have already been set.
avresample_set_channel_mapping(s->avrctx, s->reorder_in);
if (avresample_open(s->avrctx) < 0 ||
avresample_open(s->avrctx_out) < 0)
{
if (avresample_open(s->avrctx) < 0 || avresample_open(s->avrctx_out) < 0) {
MP_ERR(af, "Cannot open Libavresample Context. \n");
goto error;
}
@ -385,7 +385,7 @@ static int control(struct af_instance *af, int cmd, void *arg)
? AF_OK : AF_FALSE;
if (r == AF_OK && needs_lavrctx_reconfigure(s, in, out))
r = configure_lavrr(af, in, out);
r = configure_lavrr(af, in, out, true);
return r;
}
case AF_CONTROL_SET_FORMAT: {
@ -411,7 +411,7 @@ static int control(struct af_instance *af, int cmd, void *arg)
// in the resampler.
af->filter_frame(af, NULL);
// Reinitialize resampler.
configure_lavrr(af, &af->fmt_in, &af->fmt_out);
configure_lavrr(af, &af->fmt_in, &af->fmt_out, false);
}
return AF_OK;
}