output/wasapi: move the thread->Play() call right before the consumed_size check

Fixes a bogus assertion failure (which can now be removed).
This commit is contained in:
Max Kellermann 2021-03-10 20:06:59 +01:00
parent 14f0134097
commit 8024f7e84d

View File

@ -633,8 +633,13 @@ WasapiOutput::Play(const void *chunk, size_t size)
do { do {
const size_t consumed_size = thread->spsc_buffer.push( const size_t consumed_size = thread->spsc_buffer.push(
static_cast<const BYTE *>(input.data), input.size); static_cast<const BYTE *>(input.data), input.size);
if (!is_started) {
is_started = true;
thread->Play();
}
if (consumed_size == 0) { if (consumed_size == 0) {
assert(is_started);
thread->Wait(); thread->Wait();
thread->CheckException(); thread->CheckException();
if (!not_interrupted.test_and_set()) { if (!not_interrupted.test_and_set()) {
@ -643,11 +648,6 @@ WasapiOutput::Play(const void *chunk, size_t size)
continue; continue;
} }
if (!is_started) {
is_started = true;
thread->Play();
}
thread->CheckException(); thread->CheckException();
if (pcm_export) { if (pcm_export) {