check the current pcm status in snd_pcm_read/write_areas() if

snd_pcm_wait() returns an error.  this will fix the bogus
return code of snd_pcm_readi/writei().
This commit is contained in:
Takashi Iwai 2003-03-27 09:10:22 +00:00
parent 7714346bc2
commit 2978d18323

View file

@ -6110,9 +6110,15 @@ snd_pcm_sframes_t snd_pcm_read_areas(snd_pcm_t *pcm, const snd_pcm_channel_area_
}
err = snd_pcm_wait(pcm, -1);
if (err < 0)
break;
state = snd_pcm_state(pcm);
if (err < 0) {
/* check more precisely */
if (state == SND_PCM_STATE_XRUN)
err = -EPIPE;
else if (state == SND_PCM_STATE_SUSPENDED)
err = -ESTRPIPE;
break;
}
goto _again;
}
@ -6183,9 +6189,15 @@ snd_pcm_sframes_t snd_pcm_write_areas(snd_pcm_t *pcm, const snd_pcm_channel_area
}
err = snd_pcm_wait(pcm, -1);
if (err < 0)
break;
state = snd_pcm_state(pcm);
if (err < 0) {
/* check more precisely */
if (state == SND_PCM_STATE_XRUN)
err = -EPIPE;
else if (state == SND_PCM_STATE_SUSPENDED)
err = -ESTRPIPE;
break;
}
goto _again;
}