aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/backends
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2018-06-08 05:02:47 -0700
committerChris Robinson <[email protected]>2018-06-08 05:02:47 -0700
commitfd1458ce1bfef0d8f8baba0aff5edb5cfa0940a4 (patch)
tree773bdecdc9a56e39f3c3c7a1996e91d2d9f71d20 /Alc/backends
parent9c643f035671cbfa8c9c76d246b317778c6917d9 (diff)
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.
Diffstat (limited to 'Alc/backends')
-rw-r--r--Alc/backends/alsa.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/Alc/backends/alsa.c b/Alc/backends/alsa.c
index e0fdc070..409be7fa 100644
--- a/Alc/backends/alsa.c
+++ b/Alc/backends/alsa.c
@@ -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;