output/snapcast: fix busy loop while paused

Removing the LockHasClients(); this code was copied from the "httpd"
output plugin, but unlike "httpd", the SnapCast output plugin does not
feed silence while paused, so we need to implement a delay to avoid
busy-looping the CPU.

As a side effect, this eliminates the suttering after resuming
playback, because the timer now gets reset even if there is a client.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/1394
This commit is contained in:
Max Kellermann 2022-07-08 22:53:19 +02:00
parent 02b00f9146
commit bc6924d303
2 changed files with 4 additions and 3 deletions

2
NEWS
View File

@ -5,6 +5,8 @@ ver 0.23.8 (not yet released)
- cdio_paranoia: fix crash if no drive was found
- cdio_paranoia: faster cancellation
- cdio_paranoia: don't scan for replay gain tags
- snapcast: fix busy loop while paused
- snapcast: fix stuttering after resuming playback
* mixer
- better error messages
- alsa: fix setting volume before playback starts

View File

@ -214,9 +214,8 @@ SnapcastOutput::RemoveClient(SnapcastClient &client) noexcept
std::chrono::steady_clock::duration
SnapcastOutput::Delay() const noexcept
{
if (!LockHasClients() && pause) {
/* if there's no client and this output is paused,
then Pause() will not do anything, it will not fill
if (pause) {
/* Pause() will not do anything, it will not fill
the buffer and it will not update the timer;
therefore, we reset the timer here */
timer->Reset();