diff options
| author | jacqueline <me@jacqueline.id.au> | 2024-02-21 14:13:19 +1100 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2024-02-21 14:13:19 +1100 |
| commit | 28651fa7e1d6a90af65d268e6515ed1d2e3b6037 (patch) | |
| tree | dacc7c0d7eefeec98ee187412e4caa6e2220e4b1 /src | |
| parent | 29a246a7334c0a298053991f37d22e19de936ad9 (diff) | |
| download | tangara-fw-28651fa7e1d6a90af65d268e6515ed1d2e3b6037.tar.gz | |
Wait for the sink buffer to drain before stopping playback
Diffstat (limited to 'src')
| -rw-r--r-- | src/audio/audio_fsm.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/audio/audio_fsm.cpp b/src/audio/audio_fsm.cpp index 0119855a..ea0315eb 100644 --- a/src/audio/audio_fsm.cpp +++ b/src/audio/audio_fsm.cpp @@ -366,6 +366,12 @@ void Playback::react(const internal::InputFileFinished& ev) { ESP_LOGI(kTag, "finished playing file"); sServices->track_queue().finish(); if (!sServices->track_queue().current()) { + for (int i = 0; i < 20; i++) { + if (xStreamBufferIsEmpty(sDrainBuffer)) { + break; + } + vTaskDelay(pdMS_TO_TICKS(200)); + } transit<Standby>(); } } |
