1
0
Fork 0

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).
This commit is contained in:
Takashi Iwai 2007-12-14 15:29:51 +01:00
parent 8d7759aa32
commit beecc1419e

View 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)