ao_alsa: non-interleaved access is not always available

I thought this would always work... how disappointing.

Revert to interleaved format if requesting non-interleaved fails.
This commit is contained in:
wm4 2013-11-14 21:19:04 +01:00
parent e91edf9aed
commit 53c6d97873
1 changed files with 5 additions and 0 deletions

View File

@ -458,6 +458,11 @@ static int init(struct ao *ao)
? SND_PCM_ACCESS_RW_NONINTERLEAVED
: SND_PCM_ACCESS_RW_INTERLEAVED;
err = snd_pcm_hw_params_set_access(p->alsa, alsa_hwparams, access);
if (err < 0 && af_fmt_is_planar(ao->format)) {
ao->format = af_fmt_from_planar(ao->format);
access = SND_PCM_ACCESS_RW_INTERLEAVED;
err = snd_pcm_hw_params_set_access(p->alsa, alsa_hwparams, access);
}
CHECK_ALSA_ERROR("Unable to set access type");
int num_channels = ao->channels.num;