summaryrefslogtreecommitdiff
path: root/src/output
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2021-03-08 19:55:14 +0100
committerMax Kellermann <max@musicpd.org>2021-03-08 19:58:15 +0100
commit5f656dffda1f62604cc97553b2cf4951be206328 (patch)
tree1bc8858a5936f3d22c18a3c3b82c557d01a01831 /src/output
parent34d4d9157a249780cb0f0ab6d80b1dbe7da77a63 (diff)
output/wasapi: implement Cancel()
Diffstat (limited to 'src/output')
-rw-r--r--src/output/plugins/wasapi/WasapiOutputPlugin.cxx9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/output/plugins/wasapi/WasapiOutputPlugin.cxx b/src/output/plugins/wasapi/WasapiOutputPlugin.cxx
index 970f6e8cd..508d3f71d 100644
--- a/src/output/plugins/wasapi/WasapiOutputPlugin.cxx
+++ b/src/output/plugins/wasapi/WasapiOutputPlugin.cxx
@@ -258,6 +258,7 @@ public:
std::chrono::steady_clock::duration Delay() const noexcept override;
size_t Play(const void *chunk, size_t size) override;
void Drain() override;
+ void Cancel() noexcept override;
bool Pause() override;
void Interrupt() noexcept override;
@@ -664,6 +665,14 @@ WasapiOutput::Drain()
thread->CheckException();
}
+void
+WasapiOutput::Cancel() noexcept
+{
+ assert(thread);
+
+ thread->spsc_buffer.consume_all([](auto &&) {});
+}
+
/// run inside COMWorkerThread
void
WasapiOutput::OpenDevice()