From 2141a1e08b8bccaa47b3c2c26e07c294f11909a4 Mon Sep 17 00:00:00 2001 From: Paul Adenot Date: Mon, 5 Oct 2020 18:44:45 +0200 Subject: Pass in AUDCLNT_STREAMOPTIONS_RAW when possible when initializing an AudioClient --- src/cubeb_wasapi.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src/cubeb_wasapi.cpp') diff --git a/src/cubeb_wasapi.cpp b/src/cubeb_wasapi.cpp index ccd047b..8dc8022 100644 --- a/src/cubeb_wasapi.cpp +++ b/src/cubeb_wasapi.cpp @@ -1812,6 +1812,26 @@ handle_channel_layout(cubeb_stream * stm, EDataFlow direction, com_heap_ptr & audio_client) +{ + com_ptr audio_client2; + audio_client->QueryInterface(audio_client2.receive()); + if (!audio_client2) { + LOG("Could not get IAudioClient2 interface, not setting AUDCLNT_STREAMOPTIONS_RAW."); + return CUBEB_OK; + } + AudioClientProperties properties = { 0 }; + properties.cbSize = sizeof(AudioClientProperties); + properties.Options |= AUDCLNT_STREAMOPTIONS_RAW; + HRESULT hr = audio_client2->SetClientProperties(&properties); + if (FAILED(hr)) { + LOG("Can't create the reconfigure event, error: %lx", GetLastError()); + return CUBEB_ERROR; + } + return CUBEB_OK; +} + static bool initialize_iaudioclient3(com_ptr & audio_client, cubeb_stream * stm, @@ -2082,6 +2102,11 @@ int setup_wasapi_stream_one_side(cubeb_stream * stm, LOG("Could not get cubeb_device_info."); } + if (initialize_iaudioclient2(audio_client) != CUBEB_OK) { + LOG("Can't create the reconfigure event, error: %lx", GetLastError()); + // This is not fatal. + } + #if 0 // See https://bugzilla.mozilla.org/show_bug.cgi?id=1590902 if (initialize_iaudioclient3(audio_client, stm, mix_format, flags, direction)) { LOG("Initialized with IAudioClient3"); -- cgit v1.2.3