From a3069afebb10c324c553f71111422044e5d7f583 Mon Sep 17 00:00:00 2001 From: Matthias Ringwald Date: Tue, 15 May 2018 17:18:01 +0200 Subject: [PATCH] hci: calculate sco_packet_length based on number of concurrent sco connections - fixes #129 --- src/hci.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/hci.c b/src/hci.c index 870aeda9b..f42fc30c4 100644 --- a/src/hci.c +++ b/src/hci.c @@ -4675,13 +4675,20 @@ uint16_t hci_get_sco_voice_setting(void){ * @return Length of SCO packets in bytes (not audio frames) */ int hci_get_sco_packet_length(void){ + int sco_packet_length = 0; + +#ifdef ENABLE_CLASSIC +#ifdef ENABLE_SCO_OVER_HCI // see Core Spec for H2 USB Transfer. // CVSD requires twice as much bytes int multiplier = hci_stack->sco_voice_setting & 0x0020 ? 2 : 1; // 3 byte SCO header + 24 bytes per connection - return 3 + 24 * hci_number_sco_connections() * multiplier; + sco_packet_length = 3 + 24 * hci_number_sco_connections() * multiplier; +#endif +#endif + return sco_packet_length; } /**