Merge branch 'topic/pcm-drain-nonblock' into for-linus

* topic/pcm-drain-nonblock:
  ALSA: pcm - Increase protocol version
  ALSA: pcm - Fix drain behavior in non-blocking mode
This commit is contained in:
Takashi Iwai 2009-09-10 15:33:00 +02:00
commit 2c0d19a78d
3 changed files with 38 additions and 28 deletions

View file

@ -197,12 +197,16 @@ static int snd_pcm_update_hw_ptr_post(struct snd_pcm_substream *substream,
avail = snd_pcm_capture_avail(runtime);
if (avail > runtime->avail_max)
runtime->avail_max = avail;
if (avail >= runtime->stop_threshold) {
if (substream->runtime->status->state == SNDRV_PCM_STATE_DRAINING)
if (runtime->status->state == SNDRV_PCM_STATE_DRAINING) {
if (avail >= runtime->buffer_size) {
snd_pcm_drain_done(substream);
else
return -EPIPE;
}
} else {
if (avail >= runtime->stop_threshold) {
xrun(substream);
return -EPIPE;
return -EPIPE;
}
}
if (avail >= runtime->control->avail_min)
wake_up(&runtime->sleep);