aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMatthew Gregan <[email protected]>2022-04-13 17:46:09 +1200
committerPaul Adenot <[email protected]>2022-04-13 17:02:09 +0200
commit708f52cccffe69ed1d65b52903237c990db860a9 (patch)
tree846e6576576c1c19fa6f76aa2ece7c84453ac9de
parent62d4926af198b7d638ec3be20aff7d319a0b03ba (diff)
downloadcubeb-708f52cccffe69ed1d65b52903237c990db860a9.tar.gz
cubeb-708f52cccffe69ed1d65b52903237c990db860a9.zip
wasapi: Fail stream setup instead of asserting if device latency unavailable.
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.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/cubeb_wasapi.cpp b/src/cubeb_wasapi.cpp
index ad3a110..039ad76 100644
--- a/src/cubeb_wasapi.cpp
+++ b/src/cubeb_wasapi.cpp
@@ -2300,8 +2300,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);