summaryrefslogtreecommitdiffstats
path: root/audio/out/ao_alsa.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-04-14 21:19:01 +0200
committerwm4 <wm4@nowhere>2015-04-14 21:19:01 +0200
commit2896afaa39856f22da0ed7439dbd16edc225c2c4 (patch)
tree4b58f0612bd4b3c8d4207cb8c8ee0c4fc0bf74f1 /audio/out/ao_alsa.c
parent7d40a33ed9a707d1e6dcfa70ff96bd09f23a82be (diff)
downloadmpv-2896afaa39856f22da0ed7439dbd16edc225c2c4.tar.bz2
mpv-2896afaa39856f22da0ed7439dbd16edc225c2c4.tar.xz
ao_alsa: fallback to stereo channel layout if everything else fails
mp_chmap_from_channels_alsa() doesn't always succeed - there are a bunch of channel counts for which no defined ALSA layout exists. Fallback to stereo in this case. (Normally, this code path shouldn't happen at all.)
Diffstat (limited to 'audio/out/ao_alsa.c')
-rw-r--r--audio/out/ao_alsa.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/audio/out/ao_alsa.c b/audio/out/ao_alsa.c
index f26c4cedb0..f4565da0dc 100644
--- a/audio/out/ao_alsa.c
+++ b/audio/out/ao_alsa.c
@@ -492,8 +492,11 @@ static int init_device(struct ao *ao)
}
if (num_channels != ao->channels.num) {
- MP_ERR(ao, "Couldn't get requested number of channels.\n");
mp_chmap_from_channels_alsa(&ao->channels, num_channels);
+ if (!mp_chmap_is_valid(&ao->channels))
+ mp_chmap_from_channels(&ao->channels, 2);
+ MP_ERR(ao, "Couldn't get requested number of channels, fallback to %s.\n",
+ mp_chmap_to_str(&ao->channels));
}
// Some ALSA drivers have broken delay reporting, so disable the ALSA