path: root/audio
diff options
authorwm4 <wm4@nowhere>2016-11-08 17:06:00 +0100
committerwm4 <wm4@nowhere>2016-11-08 17:48:40 +0100
commit2e113a7391ce4286cab5ac9e1a82ee294dc5b8cb (patch)
tree5bc920ba7e85e275368f2d35cac79cdd3ae92998 /audio
parent2b71bef2ba865175497e2cc76d5d1ff2c2878271 (diff)
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.
Diffstat (limited to 'audio')
1 files changed, 7 insertions, 3 deletions
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;
+ }