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.
This commit is contained in:
Earle F. Philhower, III committed 2018-01-04 09:46:16 -08:00
1 parent 2d25b16f09
commit 6b30ed77f5
1 file changed
+3
+3
View File
@@ -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;