]> git.alsa-project.org Git - alsa-utils.git/commitdiff
aplay - Reset non-blocking flag before snd_pcm_drain()
authorTakashi Iwai <tiwai@suse.de>
Fri, 14 Dec 2007 14:29:51 +0000 (15:29 +0100)
committerTakashi Iwai <tiwai@suse.de>
Fri, 14 Dec 2007 14:29:51 +0000 (15:29 +0100)
snd_pcm_drain() doesn't block when running with O_NONBLOCK.
Reset the non-blocking mode before calling snd_pcm_drain() properly
(and restore again for any further operations).

aplay/aplay.c

index 1fa0af1ce952f143e1effea10061b4f5aa451634..b6b46468318a85abf6f6ac31044a52c49b456474 100644 (file)
@@ -1462,7 +1462,9 @@ static void voc_pcm_flush(void)
                if (pcm_write(audiobuf, b) != (ssize_t)b)
                        error(_("voc_pcm_flush error"));
        }
+       snd_pcm_nonblock(handle, 0);
        snd_pcm_drain(handle);
+       snd_pcm_nonblock(handle, nonblock);
 }
 
 static void voc_play(int fd, int ofs, char *name)
@@ -1988,7 +1990,9 @@ void playback_go(int fd, size_t loaded, off64_t count, int rtype, char *name)
                written += r;
                l = 0;
        }
+       snd_pcm_nonblock(handle, 0);
        snd_pcm_drain(handle);
+       snd_pcm_nonblock(handle, nonblock);
 }
 
 
@@ -2227,7 +2231,9 @@ void playbackv_go(int* fds, unsigned int channels, size_t loaded, off64_t count,
                r = r * bits_per_frame / 8;
                count -= r;
        }
+       snd_pcm_nonblock(handle, 0);
        snd_pcm_drain(handle);
+       snd_pcm_nonblock(handle, nonblock);
 }
 
 void capturev_go(int* fds, unsigned int channels, off64_t count, int rtype, char **names)