Skip to content

Commit 1752da5

Browse files
Fixed bug where 'bufferEmptyStartTimeMs' was not reset on bailout
1 parent f0652d2 commit 1752da5

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/ESP32_VS1053_Stream.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -409,19 +409,25 @@ void ESP32_VS1053_Stream::_playFromRingBuffer()
409409
{
410410
bufferEmptyStartTimeMs = millis();
411411
bufferEmptyStartTimeMs += bufferEmptyStartTimeMs ? 0 : 1;
412-
log_i("No buffer data available");
412+
log_i("no buffer data available");
413413
return;
414414
}
415415
const auto BAILOUT_MS = 2000;
416416
if (millis() - bufferEmptyStartTimeMs > BAILOUT_MS)
417417
{
418-
log_e("Buffer empty for %i ms, bailing out...", BAILOUT_MS);
418+
log_e("buffer empty for %i ms, bailing out...", BAILOUT_MS);
419+
bufferEmptyStartTimeMs = 0;
419420
_remainingBytes = 0;
420421
return;
421422
}
422423
return;
423424
}
424-
bufferEmptyStartTimeMs = 0;
425+
if (bufferEmptyStartTimeMs)
426+
{
427+
log_e("buffer empty for %i ms", millis() - bufferEmptyStartTimeMs);
428+
bufferEmptyStartTimeMs = 0;
429+
}
430+
425431
_vs1053->playChunk(data, size);
426432
vRingbufferReturnItem(_ringbuffer_handle, data);
427433
bytesToDecoder += size;

0 commit comments

Comments
 (0)