aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/cubeb_wasapi.cpp
diff options
context:
space:
mode:
authorPaul Adenot <[email protected]>2020-10-05 18:44:45 +0200
committerPaul Adenot <[email protected]>2020-10-07 18:11:16 +0200
commit2141a1e08b8bccaa47b3c2c26e07c294f11909a4 (patch)
tree8d60be79064e53b6cb978200df1ba70fe1ccb108 /src/cubeb_wasapi.cpp
parent970e118e4bc006b2621155c68c28b5b80a1a0e10 (diff)
downloadcubeb-2141a1e08b8bccaa47b3c2c26e07c294f11909a4.tar.gz
cubeb-2141a1e08b8bccaa47b3c2c26e07c294f11909a4.zip
Pass in AUDCLNT_STREAMOPTIONS_RAW when possible when initializing an AudioClient
Diffstat (limited to 'src/cubeb_wasapi.cpp')
-rw-r--r--src/cubeb_wasapi.cpp25
1 files changed, 25 insertions, 0 deletions
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
@@ -1813,6 +1813,26 @@ handle_channel_layout(cubeb_stream * stm, EDataFlow direction, com_heap_ptr<WAV
}
static bool
+initialize_iaudioclient2(com_ptr<IAudioClient> & audio_client)
+{
+ com_ptr<IAudioClient2> audio_client2;
+ audio_client->QueryInterface<IAudioClient2>(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<IAudioClient> & audio_client,
cubeb_stream * stm,
const com_heap_ptr<WAVEFORMATEX> & mix_format,
@@ -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");