File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -483,6 +483,10 @@ void ESP32_VS1053_Stream::_handleStream(WiFiClient *const stream)
483
483
484
484
if (stream && stream->available () && _metaDataStart && _musicDataPosition == _metaDataStart)
485
485
{
486
+ const auto DATA_NEEDED = stream->peek () * 16 + 1 ;
487
+ if (stream->available () < DATA_NEEDED)
488
+ return ;
489
+
486
490
const auto METALENGTH = stream->read () * 16 ;
487
491
if (METALENGTH)
488
492
{
@@ -573,8 +577,12 @@ void ESP32_VS1053_Stream::_handleChunkedStream(WiFiClient *const stream)
573
577
log_d (" spend %lu ms stuffing %i bytes in decoder" , millis () - start, bytesToDecoder);
574
578
}
575
579
576
- if (_metaDataStart && _musicDataPosition == _metaDataStart && _bytesLeftInChunk)
580
+ if (stream && stream-> available () && _metaDataStart && _musicDataPosition == _metaDataStart && _bytesLeftInChunk)
577
581
{
582
+ const auto DATA_NEEDED = stream->peek () * 16 + 1 ;
583
+ if (stream->available () < DATA_NEEDED)
584
+ return ;
585
+
578
586
const auto METALENGTH = stream->read () * 16 ;
579
587
_bytesLeftInChunk--;
580
588
if (METALENGTH)
@@ -678,6 +686,9 @@ void ESP32_VS1053_Stream::loop()
678
686
}
679
687
}
680
688
689
+ if (stream)
690
+ stream->setTimeout (0 );
691
+
681
692
if (_remainingBytes && _vs1053->data_request ())
682
693
{
683
694
if (_chunkedResponse)
You can’t perform that action at this time.
0 commit comments