mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-01-06 07:00:59 +00:00
esp32/btstack_audio_esp32_v4: tolerate empty i2s read after I2S_EVENT_RX_DONE
This commit is contained in:
parent
643a64fcb6
commit
0d72163bdf
@ -442,7 +442,16 @@ static void btstack_audio_esp32_source_process_buffer(void){
|
||||
|
||||
uint16_t data_len = btstack_audio_esp32_samples_per_dma_buffer * BYTES_PER_SAMPLE_STEREO;
|
||||
i2s_read(BTSTACK_AUDIO_I2S_NUM, buffer, data_len, &bytes_read, 0);
|
||||
btstack_assert(bytes_read == data_len);
|
||||
|
||||
// check if full buffer is ready. tolerate reading zero bytes (->retry), but assert on partial read
|
||||
if (bytes_read == 0){
|
||||
ESP_LOGW(LOG_TAG, "i2s_read: no data after I2S_EVENT_RX_DONE\n");
|
||||
return;
|
||||
} else if (bytes_read < data_len){
|
||||
ESP_LOGE(LOG_TAG, "i2s_read: only %u of %u!!!\n", (int) bytes_read, data_len);
|
||||
btstack_assert(false);
|
||||
return;
|
||||
}
|
||||
|
||||
int16_t * buffer16 = (int16_t *) buffer;
|
||||
if (btstack_audio_esp32_source_state == BTSTACK_AUDIO_ESP32_STREAMING) {
|
||||
|
Loading…
Reference in New Issue
Block a user