]> git.alsa-project.org Git - alsa-lib.git/commitdiff
start pcm when draining in prepared state
authorClemens Ladisch <clemens@ladisch.de>
Mon, 7 Feb 2005 09:13:58 +0000 (09:13 +0000)
committerClemens Ladisch <clemens@ladisch.de>
Mon, 7 Feb 2005 09:13:58 +0000 (09:13 +0000)
For consistency with hw pcms, dmix/dshare pcms are started
when draining in the prepared state with a non-empty buffer.

src/pcm/pcm_dmix.c
src/pcm/pcm_dshare.c

index 45b17fde8eff5a097d2b4ce13cfa8f05338618c6..3add06450a3b8e6a88da3f1111e15c4543a01040 100644 (file)
@@ -595,6 +595,9 @@ static int snd_pcm_dmix_drain(snd_pcm_t *pcm)
        stop_threshold = pcm->stop_threshold;
        if (pcm->stop_threshold > pcm->buffer_size)
                pcm->stop_threshold = pcm->buffer_size;
+       if (dmix->state == SND_PCM_STATE_PREPARED &&
+           snd_pcm_mmap_playback_hw_avail(pcm) > 0)
+               snd_pcm_dmix_start(pcm);
        while (dmix->state == SND_PCM_STATE_RUNNING) {
                err = snd_pcm_dmix_sync_ptr(pcm);
                if (err < 0)
index 19e9351fdd2cc7fc6c68a151eef7f060893fd077..9b09a8b01f1e0dd6e2aabe9a29b31ee5b294f785 100644 (file)
@@ -326,6 +326,9 @@ static int snd_pcm_dshare_drain(snd_pcm_t *pcm)
        stop_threshold = pcm->stop_threshold;
        if (pcm->stop_threshold > pcm->buffer_size)
                pcm->stop_threshold = pcm->buffer_size;
+       if (dshare->state == SND_PCM_STATE_PREPARED &&
+           snd_pcm_mmap_playback_hw_avail(pcm) > 0)
+               snd_pcm_dshare_start(pcm);
        while (dshare->state == SND_PCM_STATE_RUNNING) {
                err = snd_pcm_dshare_sync_ptr(pcm);
                if (err < 0)