From 6c2a6a65e0adb1961c8d79dbdf30739cafcbd811 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 14 Nov 2018 09:48:24 +0100 Subject: [PATCH] output/alsa: remove snd_pcm_state() check from DrainInternal() This check was added 9 years ago in commit 4dc25d3908648cc781fe43e54243bb64aec4b2cb to work around a dmix bug which I assume has been fixed long ago. Removing this fixes another corner case: if draining is requested before the start threshold is reached, the PCM is still in SND_PCM_STATE_PREPARED but not yet SND_PCM_STATE_RUNNING, which means the submitted data will never be played. This corner case is realistic when playing songs shorter than the ALSA buffer (if the buffer is very large). --- src/output/plugins/AlsaOutputPlugin.cxx | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/output/plugins/AlsaOutputPlugin.cxx b/src/output/plugins/AlsaOutputPlugin.cxx index 00de0af18..841b12b8c 100644 --- a/src/output/plugins/AlsaOutputPlugin.cxx +++ b/src/output/plugins/AlsaOutputPlugin.cxx @@ -712,11 +712,6 @@ AlsaOutput::Recover(int err) noexcept inline bool AlsaOutput::DrainInternal() noexcept { - if (snd_pcm_state(pcm) != SND_PCM_STATE_RUNNING) { - CancelInternal(); - return true; - } - /* drain ring_buffer */ CopyRingToPeriodBuffer();