Skip to content

Commit

Permalink
[i2s_audio] Bugfix: Correctly set ring buffer size (esphome#7959)
Browse files Browse the repository at this point in the history
  • Loading branch information
kahrendt authored Dec 14, 2024
1 parent ce7ff15 commit 7f2ca80
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion esphome/components/i2s_audio/speaker/i2s_audio_speaker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ void I2SAudioSpeaker::speaker_task(void *params) {

// Ensure ring buffer is at least as large as the total size of the DMA buffers
const size_t ring_buffer_size =
std::min((uint32_t) dma_buffers_size, this_speaker->buffer_duration_ms_ * bytes_per_ms);
std::max((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
Expand Down

0 comments on commit 7f2ca80

Please sign in to comment.