From b9c5d5b8a3bc3a047f28eca2b800e4cf795a4085 Mon Sep 17 00:00:00 2001 From: Albert Liu <45282415+ggrtk@users.noreply.github.com> Date: Wed, 9 Dec 2020 22:41:24 -0800 Subject: [PATCH] dep/cubeb: Update to 860bf2b --- dep/cubeb/src/cubeb_wasapi.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/dep/cubeb/src/cubeb_wasapi.cpp b/dep/cubeb/src/cubeb_wasapi.cpp index 30a6d06c7..d7c9eae71 100644 --- a/dep/cubeb/src/cubeb_wasapi.cpp +++ b/dep/cubeb/src/cubeb_wasapi.cpp @@ -2185,7 +2185,7 @@ int setup_wasapi_stream_one_side(cubeb_stream * stm, void wasapi_find_matching_output_device(cubeb_stream * stm) { HRESULT hr; - cubeb_device_info * input_device; + cubeb_device_info * input_device = nullptr; cubeb_device_collection collection; // Only try to match to an output device if the input device is a bluetooth @@ -2220,11 +2220,13 @@ void wasapi_find_matching_output_device(cubeb_stream * stm) { for (uint32_t i = 0; i < collection.count; i++) { cubeb_device_info dev = collection.device[i]; - if (dev.type == CUBEB_DEVICE_TYPE_OUTPUT && - dev.group_id && !strcmp(dev.group_id, input_device->group_id) && + if (dev.type == CUBEB_DEVICE_TYPE_OUTPUT && dev.group_id && input_device && + !strcmp(dev.group_id, input_device->group_id) && dev.default_rate == input_device->default_rate) { - LOG("Found matching device for %s: %s", input_device->friendly_name, dev.friendly_name); - stm->output_device_id = utf8_to_wstr(reinterpret_cast(dev.devid)); + LOG("Found matching device for %s: %s", input_device->friendly_name, + dev.friendly_name); + stm->output_device_id = + utf8_to_wstr(reinterpret_cast(dev.devid)); } }