diff options
author | Matthew Gregan <[email protected]> | 2022-04-13 17:46:09 +1200 |
---|---|---|
committer | Matthew Gregan <[email protected]> | 2022-04-16 17:34:32 +1200 |
commit | 2922ab0d7fff83cb33529e5f357fbb3283d216fb (patch) | |
tree | ce24765a63b37901a521b1a01be658da3d4ca88f | |
parent | b62d61bc661b49c7a7f5d97f4657189c630ac7a5 (diff) | |
download | cubeb-firefox-100.tar.gz cubeb-firefox-100.zip |
wasapi: Fail stream setup instead of asserting if device latency unavailable.firefox-100
Follow up to https://github.com/mozilla/cubeb/pull/695. Before that PR,
we would fail setup when GetDevicePeriod failed. This restores that
behaviour.
-rw-r--r-- | src/cubeb_wasapi.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/cubeb_wasapi.cpp b/src/cubeb_wasapi.cpp index 9d5e18f..e4ccaaf 100644 --- a/src/cubeb_wasapi.cpp +++ b/src/cubeb_wasapi.cpp @@ -2270,8 +2270,12 @@ setup_wasapi_stream_one_side(cubeb_stream * stm, if (wasapi_create_device(stm->context, device_info, stm->device_enumerator.get(), device.get(), &default_devices) == CUBEB_OK) { + if (device_info.latency_hi == 0) { + LOG("Input: could not query latency_hi to guess safe latency"); + wasapi_destroy_device(&device_info); + return CUBEB_ERROR; + } // This multiplicator has been found empirically. - XASSERT(device_info.latency_hi > 0); uint32_t latency_frames = device_info.latency_hi * 8; LOG("Input: latency increased to %u frames from a default of %u", latency_frames, device_info.latency_hi); |