Commit 0f39dc1e authored by Shen-Ta Hsieh's avatar Shen-Ta Hsieh Committed by Max Kellermann

output/wasapi: use AUDCLNT_BUFFERFLAGS_SILENT for paused output

parent dc9103be
...@@ -275,6 +275,7 @@ void WasapiOutputThread::Work() noexcept { ...@@ -275,6 +275,7 @@ void WasapiOutputThread::Work() noexcept {
} }
BYTE *data; BYTE *data;
DWORD mode = 0;
result = render_client->GetBuffer(write_in_frames, &data); result = render_client->GetBuffer(write_in_frames, &data);
if (FAILED(result)) { if (FAILED(result)) {
...@@ -282,18 +283,20 @@ void WasapiOutputThread::Work() noexcept { ...@@ -282,18 +283,20 @@ void WasapiOutputThread::Work() noexcept {
} }
AtScopeExit(&) { AtScopeExit(&) {
render_client->ReleaseBuffer(write_in_frames, 0); render_client->ReleaseBuffer(write_in_frames, mode);
}; };
if (current_state == Status::PLAY) {
const UINT32 write_size = write_in_frames * frame_size; const UINT32 write_size = write_in_frames * frame_size;
UINT32 new_data_size = 0; UINT32 new_data_size = 0;
if (current_state == Status::PLAY) {
new_data_size = spsc_buffer.pop(data, write_size); new_data_size = spsc_buffer.pop(data, write_size);
std::fill_n(data + new_data_size,
write_size - new_data_size, 0);
} else { } else {
mode = AUDCLNT_BUFFERFLAGS_SILENT;
FormatDebug(wasapi_output_domain, FormatDebug(wasapi_output_domain,
"Working thread paused"); "Working thread paused");
} }
std::fill_n(data + new_data_size, write_size - new_data_size, 0);
} catch (...) { } catch (...) {
std::unique_lock<Mutex> lock(error.mutex); std::unique_lock<Mutex> lock(error.mutex);
error.error_ptr = std::current_exception(); error.error_ptr = std::current_exception();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment