Permalink
Browse files

Fix infinite loop on EOF in SPI buffer

Emil Plalan found and fixed a bug where the buffer refill would loop
forever (until WDT) when there was no more data to read.  For web streams
this wasn't detected, since there isn't really an EOF.  However, single
files streamed from a web server would have this problem.
  • Loading branch information...
earlephilhower committed Jan 4, 2018
1 parent 2d25b16 commit 6b30ed77f5362542e6259bb38bac9ce988a4d6d6
Showing with 3 additions and 0 deletions.
  1. +3 −0 src/AudioFileSourceSPIRAMBuffer.cpp
@@ -91,6 +91,9 @@ uint32_t AudioFileSourceSPIRAMBuffer::read(void *data, uint32_t len)
if ((ramSize-bytesAvailable)<toRead) {
toRead=ramSize-bytesAvailable;
}
} else {
// EOF, break out of read loop
break;
}
}
writePtr = bytesAvailable % ramSize;

0 comments on commit 6b30ed7

Please sign in to comment.