From 2896afaa39856f22da0ed7439dbd16edc225c2c4 Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 14 Apr 2015 21:19:01 +0200 Subject: 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.) --- audio/out/ao_alsa.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3