[speaker] bugfix: continue to block tasks if stop flag is set (#9222)

This commit is contained in:
Kevin Ahrendt 2025-06-26 20:12:58 +01:00 committed by Jesse Hills
parent e146c0796a
commit 068aa0ff1e
No known key found for this signature in database
GPG Key ID: BEAAE804EFD8E83A

View File

@ -343,13 +343,12 @@ void AudioPipeline::read_task(void *params) {
xEventGroupSetBits(this_pipeline->event_group_, EventGroupBits::READER_MESSAGE_FINISHED); xEventGroupSetBits(this_pipeline->event_group_, EventGroupBits::READER_MESSAGE_FINISHED);
// Wait until the pipeline notifies us the source of the media file // Wait until the pipeline notifies us the source of the media file
EventBits_t event_bits = EventBits_t event_bits = xEventGroupWaitBits(
xEventGroupWaitBits(this_pipeline->event_group_, this_pipeline->event_group_,
EventGroupBits::READER_COMMAND_INIT_FILE | EventGroupBits::READER_COMMAND_INIT_HTTP | EventGroupBits::READER_COMMAND_INIT_FILE | EventGroupBits::READER_COMMAND_INIT_HTTP, // Bit message to read
EventGroupBits::PIPELINE_COMMAND_STOP, // Bit message to read pdFALSE, // Clear the bit on exit
pdFALSE, // Clear the bit on exit pdFALSE, // Wait for all the bits,
pdFALSE, // Wait for all the bits, portMAX_DELAY); // Block indefinitely until bit is set
portMAX_DELAY); // Block indefinitely until bit is set
if (!(event_bits & EventGroupBits::PIPELINE_COMMAND_STOP)) { if (!(event_bits & EventGroupBits::PIPELINE_COMMAND_STOP)) {
xEventGroupClearBits(this_pipeline->event_group_, EventGroupBits::READER_MESSAGE_FINISHED | xEventGroupClearBits(this_pipeline->event_group_, EventGroupBits::READER_MESSAGE_FINISHED |
@ -434,12 +433,12 @@ void AudioPipeline::decode_task(void *params) {
xEventGroupSetBits(this_pipeline->event_group_, EventGroupBits::DECODER_MESSAGE_FINISHED); xEventGroupSetBits(this_pipeline->event_group_, EventGroupBits::DECODER_MESSAGE_FINISHED);
// Wait until the reader notifies us that the media type is available // Wait until the reader notifies us that the media type is available
EventBits_t event_bits = xEventGroupWaitBits(this_pipeline->event_group_, EventBits_t event_bits =
EventGroupBits::READER_MESSAGE_LOADED_MEDIA_TYPE | xEventGroupWaitBits(this_pipeline->event_group_,
EventGroupBits::PIPELINE_COMMAND_STOP, // Bit message to read EventGroupBits::READER_MESSAGE_LOADED_MEDIA_TYPE, // Bit message to read
pdFALSE, // Clear the bit on exit pdFALSE, // Clear the bit on exit
pdFALSE, // Wait for all the bits, pdFALSE, // Wait for all the bits,
portMAX_DELAY); // Block indefinitely until bit is set portMAX_DELAY); // Block indefinitely until bit is set
xEventGroupClearBits(this_pipeline->event_group_, xEventGroupClearBits(this_pipeline->event_group_,
EventGroupBits::DECODER_MESSAGE_FINISHED | EventGroupBits::READER_MESSAGE_LOADED_MEDIA_TYPE); EventGroupBits::DECODER_MESSAGE_FINISHED | EventGroupBits::READER_MESSAGE_LOADED_MEDIA_TYPE);