diff options
author | Takashi Iwai <tiwai@suse.de> | 2009-09-10 15:33:00 +0200 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-09-10 15:33:00 +0200 |
commit | 2c0d19a78de1ea5d0e92d86be0b16ccab0feccec (patch) | |
tree | 190cfbbe1a465755c575aef23e6c37495a00536c /sound/core/pcm_lib.c | |
parent | 05a33e3d6fdca6ae3f645cc7bca9c11a4476e84c (diff) | |
parent | 5a53a7640a7af7acf904ed805c6fd1bf9fea829c (diff) | |
download | linux-2c0d19a78de1ea5d0e92d86be0b16ccab0feccec.tar.gz linux-2c0d19a78de1ea5d0e92d86be0b16ccab0feccec.tar.bz2 linux-2c0d19a78de1ea5d0e92d86be0b16ccab0feccec.zip |
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
Diffstat (limited to 'sound/core/pcm_lib.c')
-rw-r--r-- | sound/core/pcm_lib.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c index 9db60d831bb2..30f410832a25 100644 --- a/sound/core/pcm_lib.c +++ b/sound/core/pcm_lib.c @@ -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); |