output/Thread: allow Delay() to return duration::max()

Eliminate the periodic wakeups while paused in some output plugins.
This commit is contained in:
Max Kellermann
2024-07-29 16:44:37 +02:00
parent 5b8ef9a62b
commit 12eaaef210
6 changed files with 12 additions and 5 deletions

View File

@@ -197,7 +197,10 @@ AudioOutputControl::WaitForDelay(std::unique_lock<Mutex> &lock) noexcept
if (delay <= std::chrono::steady_clock::duration::zero())
return true;
(void)wake_cond.wait_for(lock, delay);
if (delay >= std::chrono::steady_clock::duration::max())
wake_cond.wait(lock);
else
(void)wake_cond.wait_for(lock, delay);
if (command != Command::NONE)
return false;