output/pipewire: implement Delay(), fix busy loop while paused
Closes https://github.com/MusicPlayerDaemon/MPD/issues/1265
This commit is contained in:
parent
bad3283182
commit
57a1403f08
|
@ -179,6 +179,7 @@ private:
|
||||||
pw_thread_loop_signal(thread_loop, false);
|
pw_thread_loop_signal(thread_loop, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::chrono::steady_clock::duration Delay() const noexcept override;
|
||||||
size_t Play(const void *chunk, size_t size) override;
|
size_t Play(const void *chunk, size_t size) override;
|
||||||
|
|
||||||
void Drain() override;
|
void Drain() override;
|
||||||
|
@ -493,6 +494,19 @@ PipeWireOutput::Process() noexcept
|
||||||
pw_thread_loop_signal(thread_loop, false);
|
pw_thread_loop_signal(thread_loop, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::chrono::steady_clock::duration
|
||||||
|
PipeWireOutput::Delay() const noexcept
|
||||||
|
{
|
||||||
|
const PipeWire::ThreadLoopLock lock(thread_loop);
|
||||||
|
|
||||||
|
auto result = std::chrono::steady_clock::duration::zero();
|
||||||
|
if (paused)
|
||||||
|
/* idle while paused */
|
||||||
|
result = std::chrono::seconds(1);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
size_t
|
size_t
|
||||||
PipeWireOutput::Play(const void *chunk, size_t size)
|
PipeWireOutput::Play(const void *chunk, size_t size)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue