From 01d4f05fe7f94b2846952fdb0ab30717a575bc4f Mon Sep 17 00:00:00 2001 From: Matthias Ringwald Date: Tue, 23 Aug 2022 16:27:48 +0200 Subject: [PATCH] hci: add hci_set_num_iso_packets_to_queue --- src/hci.c | 10 +++++++++- src/hci.h | 8 ++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/hci.c b/src/hci.c index 1f85a64be..48209a9f7 100644 --- a/src/hci.c +++ b/src/hci.c @@ -4384,6 +4384,10 @@ void hci_init(const hci_transport_t *transport, const void *config){ hci_stack->le_connection_parameter_range.le_supervision_timeout_min = 10; hci_stack->le_connection_parameter_range.le_supervision_timeout_max = 3200; +#ifdef ENABLE_LE_ISOCHRONOUS_STREAMS + hci_stack->iso_packets_to_queue = 1; +#endif + hci_state_reset(); } @@ -9096,6 +9100,10 @@ static le_audio_big_sync_t * hci_big_sync_for_handle(uint8_t big_handle){ return NULL; } +void hci_set_num_iso_packets_to_queue(uint8_t num_packets){ + hci_stack->iso_packets_to_queue = num_packets; +} + static void hci_iso_notify_can_send_now(void){ btstack_linked_list_iterator_t it; btstack_linked_list_iterator_init(&it, &hci_stack->le_audio_bigs); @@ -9107,7 +9115,7 @@ static void hci_iso_notify_can_send_now(void){ bool can_send = true; for (i=0;inum_bis;i++){ hci_iso_stream_t * iso_stream = hci_iso_stream_for_con_handle(big->bis_con_handles[i]); - if ((iso_stream == NULL) || (iso_stream->num_packets_sent > 0) || (iso_stream->emit_ready_to_send)){ + if ((iso_stream == NULL) || (iso_stream->num_packets_sent >= hci_stack->iso_packets_to_queue) || (iso_stream->emit_ready_to_send)){ can_send = false; break; } diff --git a/src/hci.h b/src/hci.h index 65ccefed4..56d582900 100644 --- a/src/hci.h +++ b/src/hci.h @@ -950,6 +950,8 @@ typedef struct { uint16_t iso_fragmentation_total_size; bool iso_fragmentation_tx_active; + uint8_t iso_packets_to_queue; + // list of iso streams btstack_linked_list_t iso_streams; @@ -1271,6 +1273,12 @@ void hci_set_sco_voice_setting(uint16_t voice_setting); */ uint16_t hci_get_sco_voice_setting(void); +/** + * @brief Set number of ISO packets to buffer for BIS/CIS + * @param num_packets (default = 1) + */ +void hci_set_num_iso_packets_to_queue(uint8_t num_packets); + /** * @brief Set inquiry mode: standard, with RSSI, with RSSI + Extended Inquiry Results. Has to be called before power on. * @param inquriy_mode see bluetooth_defines.h