Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=fa5717f2099aadb2083d5df4d19af8f9685fa03e
Commit:     fa5717f2099aadb2083d5df4d19af8f9685fa03e
Parent:     8ace4f3c9d83fd60e7539526a3a70bf5730db8c0
Author:     Takashi Iwai <[EMAIL PROTECTED]>
AuthorDate: Tue Jan 8 18:00:04 2008 +0100
Committer:  Jaroslav Kysela <[EMAIL PROTECTED]>
CommitDate: Thu Jan 31 17:29:46 2008 +0100

    [ALSA] Fix PCM write blocking
    
    The snd_pcm_lib_write1() may block in some weird condition:
      - the stream isn't started
      - avail_min is big (e.g. period size)
      - partial write up to buffer_size - avail_min
    The patch fixes this invalid blocking problem.
    
    Signed-off-by: Takashi Iwai <[EMAIL PROTECTED]>
    Signed-off-by: Jaroslav Kysela <[EMAIL PROTECTED]>
---
 sound/core/pcm_lib.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c
index 48ffa40..f9f9b3f 100644
--- a/sound/core/pcm_lib.c
+++ b/sound/core/pcm_lib.c
@@ -1655,8 +1655,11 @@ static snd_pcm_sframes_t snd_pcm_lib_write1(struct 
snd_pcm_substream *substream,
                if (runtime->sleep_min == 0 && runtime->status->state == 
SNDRV_PCM_STATE_RUNNING)
                        snd_pcm_update_hw_ptr(substream);
                avail = snd_pcm_playback_avail(runtime);
-               if (((avail < runtime->control->avail_min && size > avail) ||
-                  (size >= runtime->xfer_align && avail < 
runtime->xfer_align))) {
+               if (!avail ||
+                   (snd_pcm_running(substream) &&
+                    ((avail < runtime->control->avail_min && size > avail) ||
+                     (size >= runtime->xfer_align &&
+                      avail < runtime->xfer_align)))) {
                        wait_queue_t wait;
                        enum { READY, SIGNALED, ERROR, SUSPENDED, EXPIRED, 
DROPPED } state;
                        long tout;
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to