aboutsummaryrefslogtreecommitdiffstats
path: root/sound/core/pcm_lib.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2009-09-10 15:33:00 +0200
committerTakashi Iwai <tiwai@suse.de>2009-09-10 15:33:00 +0200
commit2c0d19a78de1ea5d0e92d86be0b16ccab0feccec (patch)
tree190cfbbe1a465755c575aef23e6c37495a00536c /sound/core/pcm_lib.c
parentMerge branch 'topic/oxygen' into for-linus (diff)
parentALSA: pcm - Increase protocol version (diff)
downloadlinux-dev-2c0d19a78de1ea5d0e92d86be0b16ccab0feccec.tar.xz
linux-dev-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.c12
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);