From 73f498e7b814d552cb17dd51cf051b93318b5d27 Mon Sep 17 00:00:00 2001 From: Matthias Ringwald Date: Wed, 24 May 2023 14:43:30 +0200 Subject: [PATCH] hci: assume 2-bytes per SCO sample only if input sample size is 16-bit --- src/hci.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/hci.c b/src/hci.c index b6541c5c1..adc3565f7 100644 --- a/src/hci.c +++ b/src/hci.c @@ -9075,7 +9075,14 @@ uint16_t hci_get_sco_packet_length(void){ #ifdef ENABLE_SCO_OVER_HCI // Transparent = mSBC => 1, CVSD with 16-bit samples requires twice as much bytes - int multiplier = ((hci_stack->sco_voice_setting_active & 0x03) == 0x03) ? 1 : 2; + int multiplier; + if (((hci_stack->sco_voice_setting_active & 0x03) != 0x03) && + ((hci_stack->sco_voice_setting_active & 0x20) == 0x20)) { + multiplier = 2; + } else { + multiplier = 1; + } + if (hci_have_usb_transport()){ // see Core Spec for H2 USB Transfer.