output/wasapi: start after the buffer has been filled

Postpone the Start() call until there is something to be played.
This commit is contained in:
Max Kellermann 2021-03-08 23:02:43 +01:00
parent 69783a44c8
commit 0a97e68aa9

View File

@ -355,16 +355,10 @@ try {
return; return;
} }
if (!started) { if (!started && current_state != Status::PLAY)
if (current_state != Status::PLAY) /* don't bother starting the IAudioClient if
/* don't bother starting the we're paused */
IAudioClient if we're continue;
paused */
continue;
Start(client);
started = true;
}
UINT32 write_in_frames = buffer_size_in_frames; UINT32 write_in_frames = buffer_size_in_frames;
if (!is_exclusive) { if (!is_exclusive) {
@ -387,6 +381,11 @@ try {
AtScopeExit(&) { AtScopeExit(&) {
render_client->ReleaseBuffer(write_in_frames, mode); render_client->ReleaseBuffer(write_in_frames, mode);
if (!started) {
Start(client);
started = true;
}
}; };
if (current_state == Status::PLAY) { if (current_state == Status::PLAY) {