aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorChun-Min Chang <[email protected]>2022-03-22 17:28:41 -0700
committerChun-Min Chang <[email protected]>2022-03-23 09:21:42 -0700
commit342ff3cd471cd3a88219f70ef1c210e57ab99554 (patch)
treefa706fc88a3809c2e42c1a3f3cb53fa5db8b0e30 /src
parentd29291525e783132d81c85cb6e450a8692336347 (diff)
downloadcubeb-342ff3cd471cd3a88219f70ef1c210e57ab99554.tar.gz
cubeb-342ff3cd471cd3a88219f70ef1c210e57ab99554.zip
Avoid duplicate GetDevicePeriod call
The value returned from `GetDevicePeriod` is the same as `latency_hi` from `wasapi_create_device`
Diffstat (limited to 'src')
-rw-r--r--src/cubeb_wasapi.cpp15
1 files changed, 2 insertions, 13 deletions
diff --git a/src/cubeb_wasapi.cpp b/src/cubeb_wasapi.cpp
index c923869..27977b0 100644
--- a/src/cubeb_wasapi.cpp
+++ b/src/cubeb_wasapi.cpp
@@ -2237,21 +2237,10 @@ 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) {
- // Sanity check the latency, it may be that the device doesn't support it.
- REFERENCE_TIME minimum_period;
- REFERENCE_TIME default_period;
- hr = audio_client->GetDevicePeriod(&default_period, &minimum_period);
- if (FAILED(hr)) {
- LOG("Could not get device period: %lx", hr);
- return CUBEB_ERROR;
- }
-
- uint32_t default_period_frames =
- hns_to_frames(device_info.default_rate, default_period);
// This multiplicator has been found empirically.
- uint32_t latency_frames = default_period_frames * 8;
+ uint32_t latency_frames = device_info.latency_hi * 8;
LOG("Input: latency increased to %u frames from a default of %u",
- latency_frames, default_period_frames);
+ latency_frames, device_info.latency_hi);
latency_hns = frames_to_hns(device_info.default_rate, latency_frames);
const char * HANDSFREE_TAG = "BTHHFENUM";