1
0
mirror of https://github.com/esphome/esphome.git synced 2025-01-18 20:10:55 +00:00

[i2s_audio] Speaker type fix (#7919)

This commit is contained in:
Keith Burzinski 2024-12-04 21:03:38 -06:00 committed by GitHub
parent 4e839d42d0
commit ece72c6b18
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -246,7 +246,8 @@ void I2SAudioSpeaker::speaker_task(void *params) {
const size_t dma_buffers_size = DMA_BUFFERS_COUNT * DMA_BUFFER_DURATION_MS * bytes_per_ms;
// Ensure ring buffer is at least as large as the total size of the DMA buffers
const size_t ring_buffer_size = std::min(dma_buffers_size, this_speaker->buffer_duration_ms_ * bytes_per_ms);
const size_t ring_buffer_size =
std::min((uint32_t) dma_buffers_size, this_speaker->buffer_duration_ms_ * bytes_per_ms);
if (this_speaker->send_esp_err_to_event_group_(this_speaker->allocate_buffers_(dma_buffers_size, ring_buffer_size))) {
// Failed to allocate buffers