From 5b7087c754e520e4200e21e12b7f0324e0c8e896 Mon Sep 17 00:00:00 2001 From: Matthias Ringwald Date: Wed, 17 Feb 2021 16:55:30 +0100 Subject: [PATCH] hci: provide sco packet length and track voice settings for HAVE_SCO_TRANSPORT --- src/hci.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/hci.c b/src/hci.c index b72d15a34..ffafde7fd 100644 --- a/src/hci.c +++ b/src/hci.c @@ -4730,7 +4730,7 @@ int hci_send_cmd_packet(uint8_t *packet, int size){ } break; -#ifdef ENABLE_SCO_OVER_HCI +#if defined (ENABLE_SCO_OVER_HCI) || defined (HAVE_SCO_TRANSPORT) case HCI_OPCODE_HCI_SETUP_SYNCHRONOUS_CONNECTION: // setup_synchronous_connection? Voice setting at offset 22 // TODO: compare to current setting if sco connection already active @@ -6083,11 +6083,11 @@ static int hci_have_usb_transport(void){ */ int hci_get_sco_packet_length(void){ int sco_packet_length = 0; - + int multiplier; #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; + multiplier = ((hci_stack->sco_voice_setting_active & 0x03) == 0x03) ? 1 : 2; if (hci_have_usb_transport()){ // see Core Spec for H2 USB Transfer. @@ -6103,6 +6103,13 @@ int hci_get_sco_packet_length(void){ } } #endif + +#ifdef HAVE_SCO_TRANSPORT + // Transparent = mSBC => 1, CVSD with 16-bit samples requires twice as much bytes + multiplier = ((hci_stack->sco_voice_setting_active & 0x03) == 0x03) ? 1 : 2; + sco_packet_length = 3 + 60 * multiplier; +#endif + return sco_packet_length; }