Commit 5f656dff authored by Max Kellermann's avatar Max Kellermann

output/wasapi: implement Cancel()

parent 34d4d915
...@@ -258,6 +258,7 @@ public: ...@@ -258,6 +258,7 @@ public:
std::chrono::steady_clock::duration Delay() const noexcept override; 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;
void Cancel() noexcept override;
bool Pause() override; bool Pause() override;
void Interrupt() noexcept override; void Interrupt() noexcept override;
...@@ -664,6 +665,14 @@ WasapiOutput::Drain() ...@@ -664,6 +665,14 @@ WasapiOutput::Drain()
thread->CheckException(); thread->CheckException();
} }
void
WasapiOutput::Cancel() noexcept
{
assert(thread);
thread->spsc_buffer.consume_all([](auto &&) {});
}
/// run inside COMWorkerThread /// run inside COMWorkerThread
void void
WasapiOutput::OpenDevice() WasapiOutput::OpenDevice()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment