summaryrefslogtreecommitdiff
path: root/src/TimePrint.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2018-11-16 12:49:31 +0100
committerMax Kellermann <max@musicpd.org>2018-11-16 12:49:37 +0100
commit4cdcaa8630952e4bb53bd319440863e6295f1782 (patch)
tree3a6f1682dd0da3c84e9a3d1182a008842b5319b2 /src/TimePrint.cxx
parent04f632296f74c95c132086d3158785c1d36093e7 (diff)
output/alsa: don't call snd_pcm_drain() if nothing was written
Works around a problem where MPD goes into a busy loop because snd_pcm_drain() always returns `-EAGAIN` without making any progress (fixes #425). This problem was triggered by snd_pcm_drain() after snd_pcm_cancel() and snd_pcm_prepare(), but without submitting any data with snd_pcm_writei(). I believe this is a kernel bug: in non-blocking mode, the kernel's snd_pcm_drain() function returns early. In this mode, it only checks whether snd_pcm_drain_done() has been called already, but snd_pcm_drain_done() is never called if no data was submitted. In blocking mode, the following `for` loop detects this condition, so snd_pcm_drain_done() is not necessary, but without this extra check, we get `-EAGAIN` forever.
Diffstat (limited to 'src/TimePrint.cxx')
0 files changed, 0 insertions, 0 deletions