From 2e113a7391ce4286cab5ac9e1a82ee294dc5b8cb Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 8 Nov 2016 17:06:00 +0100 Subject: ao_alsa: _really_ disable chmap API use in cases where we should set_chmap() skipped _setting_ the ALSA chmap if chmap use was requested to be disabled by setting dev_chmap.num=0 by the caller, but it still queried the current ALSA channel map. We don't trust it that much, so disable that as well. But we still query and log it, because that could be helpful for debugging. Otherwise we could skip the entire set_chmap() call in these cases. --- audio/out/ao_alsa.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'audio/out/ao_alsa.c') diff --git a/audio/out/ao_alsa.c b/audio/out/ao_alsa.c index de41954bd9..8706c0d30b 100644 --- a/audio/out/ao_alsa.c +++ b/audio/out/ao_alsa.c @@ -488,10 +488,14 @@ static int set_chmap(struct ao *ao, struct mp_chmap *dev_chmap, int num_channels } else if (chmap.num != num_channels) { MP_WARN(ao, "ALSA channel map conflicts with channel count!\n"); } else { - MP_VERBOSE(ao, "using the ALSA channel map.\n"); - if (mp_chmap_equals(&chmap, &ao->channels)) + if (mp_chmap_equals(&chmap, &ao->channels)) { MP_VERBOSE(ao, "which is what we requested.\n"); - ao->channels = chmap; + } else if (!mp_chmap_is_valid(dev_chmap)) { + MP_VERBOSE(ao, "ignoring the ALSA channel map.\n"); + } else { + MP_VERBOSE(ao, "using the ALSA channel map.\n"); + ao->channels = chmap; + } } free(alsa_chmap); -- cgit v1.2.3