Wait for the sink buffer to drain before stopping playback

custom
jacqueline 1 year ago
parent 29a246a733
commit 28651fa7e1
  1. 6
      src/audio/audio_fsm.cpp

@ -366,6 +366,12 @@ void Playback::react(const internal::InputFileFinished& ev) {
ESP_LOGI(kTag, "finished playing file"); ESP_LOGI(kTag, "finished playing file");
sServices->track_queue().finish(); sServices->track_queue().finish();
if (!sServices->track_queue().current()) { if (!sServices->track_queue().current()) {
for (int i = 0; i < 20; i++) {
if (xStreamBufferIsEmpty(sDrainBuffer)) {
break;
}
vTaskDelay(pdMS_TO_TICKS(200));
}
transit<Standby>(); transit<Standby>();
} }
} }

Loading…
Cancel
Save