diff options
author | Paul Adenot <[email protected]> | 2021-07-06 14:50:16 +0200 |
---|---|---|
committer | Paul Adenot <[email protected]> | 2021-07-13 13:51:30 +0200 |
commit | b6a7dee491e19b7da17098563df4c81f4c1b1f4d (patch) | |
tree | 743e9040349c10571a947dce803ef14f0a993564 /src | |
parent | 1749dc217b29cba13002a9b7e0cc4f299ee644b6 (diff) | |
download | cubeb-b6a7dee491e19b7da17098563df4c81f4c1b1f4d.tar.gz cubeb-b6a7dee491e19b7da17098563df4c81f4c1b1f4d.zip |
Use long buffers for input
Diffstat (limited to 'src')
-rw-r--r-- | src/cubeb_wasapi.cpp | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/src/cubeb_wasapi.cpp b/src/cubeb_wasapi.cpp index 728d173..25d9838 100644 --- a/src/cubeb_wasapi.cpp +++ b/src/cubeb_wasapi.cpp @@ -2151,22 +2151,17 @@ int setup_wasapi_stream_one_side(cubeb_stream * stm, if (rv == CUBEB_OK) { const char* HANDSFREE_TAG = "BTHHFENUM"; size_t len = sizeof(HANDSFREE_TAG); - if (direction == eCapture && - strlen(device_info.group_id) >= len && - strncmp(device_info.group_id, HANDSFREE_TAG, len) == 0) { - // Rather high-latency to prevent constant under-runs in this particular - // case of an input device using bluetooth handsfree. + if (direction == eCapture) { uint32_t default_period_frames = hns_to_frames(device_info.default_rate, default_period); - latency_frames = default_period_frames * 4; - stm->input_bluetooth_handsfree = true; - LOG("Input is a bluetooth device in handsfree, latency increased to %u frames from a default of %u", latency_frames, default_period_frames); - } else { - uint32_t minimum_period_frames = hns_to_frames(device_info.default_rate, minimum_period); - latency_frames = std::max(latency_frames, minimum_period_frames); - stm->input_bluetooth_handsfree = false; - LOG("Input is a not bluetooth handsfree, latency %s to %u frames (minimum %u)", latency_frames < minimum_period_frames ? "increased" : "set", latency_frames, minimum_period_frames); + if (strlen(device_info.group_id) >= len && + strncmp(device_info.group_id, HANDSFREE_TAG, len) == 0) { + stm->input_bluetooth_handsfree = true; + } else { + stm->input_bluetooth_handsfree = false; + } + latency_frames = default_period_frames * 8; + LOG("Input: latency increased to %u frames from a default of %u", latency_frames, default_period_frames); } - latency_hns = frames_to_hns(device_info.default_rate, latency_frames); wasapi_destroy_device(&device_info); @@ -2209,6 +2204,8 @@ int setup_wasapi_stream_one_side(cubeb_stream * stm, return CUBEB_ERROR; } + LOG("Buffer size is: %d for %s\n", *buffer_frame_count, DIRECTION_NAME); + // Events are used if not looping back if (!is_loopback) { hr = audio_client->SetEventHandle(event); |