summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2021-03-08 22:26:11 +0100
committerMax Kellermann <max@musicpd.org>2021-03-08 22:30:19 +0100
commit6931ce9558854abd4bb70f61f3f465896f0a87b0 (patch)
treeb37d80d7fc380f0cacf77390af4683fc20d3698a
parentd6fb07a3e48873f4706cd718a504582b04278f31 (diff)
output/wasapi: make the Thread a field, not a base class
-rw-r--r--src/output/plugins/wasapi/WasapiOutputPlugin.cxx9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/output/plugins/wasapi/WasapiOutputPlugin.cxx b/src/output/plugins/wasapi/WasapiOutputPlugin.cxx
index d049ad802..dc9f27107 100644
--- a/src/output/plugins/wasapi/WasapiOutputPlugin.cxx
+++ b/src/output/plugins/wasapi/WasapiOutputPlugin.cxx
@@ -157,8 +157,9 @@ SetDSDFallback(AudioFormat &audio_format) noexcept
} // namespace
-class WasapiOutputThread : public Thread {
+class WasapiOutputThread {
friend class WasapiOutput;
+ Thread thread{BIND_THIS_METHOD(Work)};
WinEvent event;
WinEvent data_poped;
IAudioClient &client;
@@ -181,18 +182,18 @@ public:
ComPtr<IAudioRenderClient> &&_render_client,
const UINT32 _frame_size, const UINT32 _buffer_size_in_frames,
bool _is_exclusive)
- :Thread(BIND_THIS_METHOD(Work)), client(_client),
+ :client(_client),
render_client(std::move(_render_client)), frame_size(_frame_size),
buffer_size_in_frames(_buffer_size_in_frames), is_exclusive(_is_exclusive),
spsc_buffer(_buffer_size_in_frames * 4 * _frame_size)
{
SetEventHandle(client, event.handle());
- Start();
+ thread.Start();
}
void Finish() noexcept {
SetStatus(Status::FINISH);
- Join();
+ thread.Join();
}
void Play() noexcept { return SetStatus(Status::PLAY); }