From: Takashi Iwai Date: Fri, 24 Mar 2006 14:51:24 +0000 (+0000) Subject: Fix PCM auto-start conditions X-Git-Tag: v1.0.11rc5~18 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=1a9c520529b9f56f46b38671838b2a870f083c13;p=alsa-lib.git Fix PCM auto-start conditions Fix the PCM auto-start conditions - The capture stream should be started the PCM anyway before reads - Fixed the endless poll() when the written size doesn't fit to the buffer size due to lack of auto-start --- diff --git a/src/pcm/pcm.c b/src/pcm/pcm.c index 91fc63e2..c78606bd 100644 --- a/src/pcm/pcm.c +++ b/src/pcm/pcm.c @@ -6364,11 +6364,9 @@ snd_pcm_sframes_t snd_pcm_read_areas(snd_pcm_t *pcm, const snd_pcm_channel_area_ switch (state) { case SND_PCM_STATE_PREPARED: - if (size >= pcm->start_threshold) { - err = snd_pcm_start(pcm); - if (err < 0) - goto _end; - } + err = snd_pcm_start(pcm); + if (err < 0) + goto _end; break; case SND_PCM_STATE_DRAINING: case SND_PCM_STATE_RUNNING: @@ -6470,8 +6468,12 @@ snd_pcm_sframes_t snd_pcm_write_areas(snd_pcm_t *pcm, const snd_pcm_channel_area if (avail < 0) { err = avail; goto _end; - } else if (((snd_pcm_uframes_t)avail < pcm->avail_min && size > (snd_pcm_uframes_t)avail) || - (size >= pcm->xfer_align && (snd_pcm_uframes_t)avail < pcm->xfer_align)) { + } + if ((state == SND_PCM_STATE_RUNNING && + (snd_pcm_uframes_t)avail < pcm->avail_min && + size > (snd_pcm_uframes_t)avail) || + (size >= pcm->xfer_align && + (snd_pcm_uframes_t)avail < pcm->xfer_align)) { if (pcm->mode & SND_PCM_NONBLOCK) { err = -EAGAIN;