output/wasapi: initialize is_started in Open()

This commit is contained in:
Max Kellermann
2021-03-10 20:03:13 +01:00
parent 8024f7e84d
commit fe7c5a4208

View File

@@ -234,7 +234,11 @@ class WasapiOutput final : public AudioOutput {
const bool dop_setting; const bool dop_setting;
#endif #endif
bool is_started = false; /**
* Only valid if the output is open.
*/
bool is_started;
std::atomic_flag not_interrupted = true; std::atomic_flag not_interrupted = true;
const std::string device_config; const std::string device_config;
@@ -583,6 +587,8 @@ WasapiOutput::DoOpen(AudioFormat &audio_format)
watermark = buffer_size_in_frames * 3 * FrameSize(); watermark = buffer_size_in_frames * 3 * FrameSize();
thread.emplace(*client, std::move(render_client), FrameSize(), thread.emplace(*client, std::move(render_client), FrameSize(),
buffer_size_in_frames, is_exclusive); buffer_size_in_frames, is_exclusive);
is_started = false;
} }
void void
@@ -596,7 +602,6 @@ WasapiOutput::Close() noexcept
FormatError(std::current_exception(), FormatError(std::current_exception(),
"exception while stopping"); "exception while stopping");
} }
is_started = false;
thread->Finish(); thread->Finish();
com_worker->Async([&]() { com_worker->Async([&]() {
thread.reset(); thread.reset();