Pass in AUDCLNT_STREAMOPTIONS_RAW when possible when initializing an AudioClient

This commit is contained in:
Paul Adenot 2020-10-05 18:44:45 +02:00
Родитель 970e118e4b
Коммит 2141a1e08b
1 изменённых файлов: 25 добавлений и 0 удалений

Просмотреть файл

@ -1812,6 +1812,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,
@ -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");