summaryrefslogtreecommitdiffstats
path: root/audio/out
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-06-11 20:39:38 +0200
committerwm4 <wm4@nowhere>2015-06-11 21:42:09 +0200
commit478ea1d0f3a4c220f9b07f24412be7f5867e7719 (patch)
treee3228a85537b90ece66d05e7bb6ed90b1d2a9f08 /audio/out
parentd0fe5e08b984db840545c1b341a1e56fad304593 (diff)
downloadmpv-478ea1d0f3a4c220f9b07f24412be7f5867e7719.tar.bz2
mpv-478ea1d0f3a4c220f9b07f24412be7f5867e7719.tar.xz
ao_alsa: change ALSA braindeath heuristic
If you try to play surround with dmix, it will advertise surround and lets you set more than 2 channels, but will report a stereo channel map, with the extra channels identified as NA. We could handle this now, but we don't want to (because it's excessively stupid). Do it only if the channel map is not what we requested, instead of just acting if it contains NA entries at all. This avoids that we hurt ourselves in the unlikely but possible case we actually have to use channel maps with NA entries.
Diffstat (limited to 'audio/out')
-rw-r--r--audio/out/ao_alsa.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/audio/out/ao_alsa.c b/audio/out/ao_alsa.c
index dbec9d7b70..779a669150 100644
--- a/audio/out/ao_alsa.c
+++ b/audio/out/ao_alsa.c
@@ -606,17 +606,18 @@ static int init_device(struct ao *ao, bool second_try)
if (mp_chmap_is_valid(&without_na) &&
!mp_chmap_equals(&without_na, &chmap) &&
+ !mp_chmap_equals(&chmap, &ao->channels) &&
!second_try)
{
// Sometimes, ALSA will advertise certain chmaps, but it's not
// possible to set them. This can happen with dmix: as of
// alsa 1.0.28, dmix can do stereo only, but advertises the
// surround chmaps of the underlying device. In this case,
- // requesting e.g. 5.1 will fail, but it will still allow
- // setting 6 channels. Then it will return something like
+ // e.g. setting 6 channels will succeed, but requesting 5.1
+ // afterwards will fail. Then it will return something like
// "FL FR NA NA NA NA" as channel map. This means we would
// have to pad stereo output to 6 channels with silence, which
- // is way too complicated in the general case. You can't change
+ // would require lots of extra processing. You can't change
// the number of channels to 2 either, because the hw params
// are already set! So just fuck it and reopen the device with
// the chmap "cleaned out" of NA entries.