]> git.alsa-project.org Git - alsa-lib.git/commitdiff
Fix drain of dmix without data
authorTakashi Iwai <tiwai@suse.de>
Tue, 17 May 2005 15:36:18 +0000 (15:36 +0000)
committerTakashi Iwai <tiwai@suse.de>
Tue, 17 May 2005 15:36:18 +0000 (15:36 +0000)
Fixed the drain of dmix plugin without any data.
It should return immediately.

src/pcm/pcm_dmix.c

index a21762ec9585cd4ea71eac608c8aa5774b6a7950..2da13b67e843019409746a1185d0c70bda154d73 100644 (file)
@@ -487,9 +487,14 @@ static int snd_pcm_dmix_drain(snd_pcm_t *pcm)
                return -EBADFD;
        if (pcm->mode & SND_PCM_NONBLOCK)
                return -EAGAIN;
-       if (dmix->state == SND_PCM_STATE_PREPARED &&
-           snd_pcm_mmap_playback_hw_avail(pcm) > 0)
-               snd_pcm_dmix_start(pcm);
+       if (dmix->state == SND_PCM_STATE_PREPARED) {
+               if (snd_pcm_mmap_playback_hw_avail(pcm) > 0)
+                       snd_pcm_dmix_start(pcm);
+               else {
+                       snd_pcm_dmix_drop(pcm);
+                       return 0;
+               }
+       }
        stop_threshold = pcm->stop_threshold;
        if (pcm->stop_threshold > pcm->buffer_size)
                pcm->stop_threshold = pcm->buffer_size;