From 2922ab0d7fff83cb33529e5f357fbb3283d216fb Mon Sep 17 00:00:00 2001 From: Matthew Gregan Date: Wed, 13 Apr 2022 17:46:09 +1200 Subject: 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. --- src/cubeb_wasapi.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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); -- cgit v1.2.3