From beecc1419e32edc5bbd3dfdec4e3e0f9cc23ef4d Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 14 Dec 2007 15:29:51 +0100 Subject: [PATCH] aplay - Reset non-blocking flag before snd_pcm_drain() 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 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/aplay/aplay.c b/aplay/aplay.c index 1fa0af1..b6b4646 100644 --- a/aplay/aplay.c +++ b/aplay/aplay.c @@ -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) -- 2.47.1