Always prepare the ALSA PCM handle before starting capture

Draining the ALSA device via stopping puts it into a setup state, which
requires re-preparing before playback can start again. Preparing it prior to
the first start seems to cause no harm, so just always do it before starting.
This commit is contained in:
Chris Robinson
2018-06-08 05:02:47 -07:00
parent 9c643f0356
commit fd1458ce1b
+9 -2
View File
@@ -1153,10 +1153,17 @@ error2:
static ALCboolean ALCcaptureAlsa_start(ALCcaptureAlsa *self)
{
int err = snd_pcm_start(self->pcmHandle);
int err = snd_pcm_prepare(self->pcmHandle);
if(err < 0)
ERR("prepare failed: %s\n", snd_strerror(err));
else
{
err = snd_pcm_start(self->pcmHandle);
if(err < 0)
ERR("start failed: %s\n", snd_strerror(err));
}
if(err < 0)
{
ERR("start failed: %s\n", snd_strerror(err));
aluHandleDisconnect(STATIC_CAST(ALCbackend, self)->mDevice, "Capture state failure: %s",
snd_strerror(err));
return ALC_FALSE;