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.)
This commit is contained in:
wm4 2015-04-14 21:19:01 +02:00
parent 7d40a33ed9
commit 2896afaa39
1 changed files with 4 additions and 1 deletions

View File

@ -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