mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-11-02 09:01:48 -05:00
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
This commit is contained in:
parent
912f0d5ddf
commit
1a9c520529
1 changed files with 9 additions and 7 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue