@@ -116,7 +116,7 @@ void BluetoothA2DPSink::start(const char *name) {
116116 ESP_LOGD (BT_AV_TAG, " %s" , __func__);
117117 log_free_heap ();
118118
119- is_autoreconnect_allowed = (reconnect_status == AutoReconnect);
119+ is_autoreconnect_allowed = (reconnect_status == AutoReconnect);
120120
121121 if (is_start_disabled) {
122122 ESP_LOGE (BT_AV_TAG, " re-start not supported after end(true)" );
@@ -129,7 +129,6 @@ void BluetoothA2DPSink::start(const char *name) {
129129 }
130130 ESP_LOGI (BT_AV_TAG, " Device name will be set to '%s'" , this ->bt_name );
131131
132-
133132 if (is_autoreconnect_allowed) {
134133 // Initialize NVS
135134 init_nvs ();
@@ -274,7 +273,6 @@ bool BluetoothA2DPSink::app_work_dispatch(app_callback_t p_cback,
274273 return false ;
275274}
276275
277-
278276void BluetoothA2DPSink::app_alloc_meta_buffer (esp_avrc_ct_cb_param_t *param) {
279277 ESP_LOGD (BT_AV_TAG, " %s" , __func__);
280278 esp_avrc_ct_cb_param_t *rc = (esp_avrc_ct_cb_param_t *)(param);
@@ -992,7 +990,6 @@ void BluetoothA2DPSink::audio_data_callback(const uint8_t *data, uint32_t len) {
992990 }
993991}
994992
995-
996993bool BluetoothA2DPSink::is_avrc_connected () { return avrc_connection_state; }
997994
998995void BluetoothA2DPSink::execute_avrc_command (int cmd) {
@@ -1094,7 +1091,6 @@ void BluetoothA2DPSink::confirm_pin_code(int code) {
10941091 }
10951092}
10961093
1097-
10981094size_t BluetoothA2DPSink::i2s_write_data (const uint8_t *data,
10991095 size_t item_size) {
11001096 if (!is_output) return item_size;
@@ -1109,9 +1105,11 @@ size_t BluetoothA2DPSink::i2s_write_data(const uint8_t *data,
11091105 int processed = 0 ;
11101106 while (open > 0 ) {
11111107 int written =
1112- out->write (data + processed, std::min (open, A2DP_I2S_MAX_WRITE_SIZE ));
1108+ out->write (data + processed, std::min (open, max_write_size ));
11131109 open -= written;
11141110 processed += written;
1111+ // add some delay between the writes
1112+ delay_ms (max_write_delay_ms);
11151113 }
11161114 return processed;
11171115}
0 commit comments