From 6ca72a3a26dc94218fa4b5b3f36a51791548ff2b Mon Sep 17 00:00:00 2001 From: Mischa Siekmann <45062894+gnumpi@users.noreply.github.com> Date: Mon, 14 Apr 2025 20:51:10 +0200 Subject: [PATCH] Speaker-Media-Player: Fix potential deadlock in audio pipeline (#8548) --- esphome/components/speaker/media_player/audio_pipeline.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/esphome/components/speaker/media_player/audio_pipeline.cpp b/esphome/components/speaker/media_player/audio_pipeline.cpp index b49cf3ddda..60f562cc2c 100644 --- a/esphome/components/speaker/media_player/audio_pipeline.cpp +++ b/esphome/components/speaker/media_player/audio_pipeline.cpp @@ -441,9 +441,10 @@ void AudioPipeline::decode_task(void *params) { pdFALSE, // Wait for all the bits, portMAX_DELAY); // Block indefinitely until bit is set + xEventGroupClearBits(this_pipeline->event_group_, + EventGroupBits::DECODER_MESSAGE_FINISHED | EventGroupBits::READER_MESSAGE_LOADED_MEDIA_TYPE); + if (!(event_bits & EventGroupBits::PIPELINE_COMMAND_STOP)) { - xEventGroupClearBits(this_pipeline->event_group_, - EventGroupBits::DECODER_MESSAGE_FINISHED | EventGroupBits::READER_MESSAGE_LOADED_MEDIA_TYPE); InfoErrorEvent event; event.source = InfoErrorSource::DECODER;