output/alsa: remove snd_pcm_state() check from DrainInternal()

This check was added 9 years ago in commit
4dc25d3908 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).
This commit is contained in:
Max Kellermann 2018-11-14 09:48:24 +01:00
parent 4247a757b3
commit 6c2a6a65e0

View File

@ -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();