Redo the last packet handling of the MP3 decoder (#266)

Keep track of how many values are actually good in the buffer (before it
was always guaranteed to be the full size) and when EOF is detected,
only shift out valid, good bytes, and return STOP when the unused bytes
are 0 or unchanged from the last pass.

Fixes #265
This commit is contained in:
Earle F. Philhower, III authored and GitHub committed 2020-05-11 02:09:05 -07:00
1 parent 1fde10daa0
commit b7cb0ee8e2
2 files changed
+9 -11

No files matched your search

+1 -1
View File
@@ -43,9 +43,9 @@ class AudioGeneratorMP3 : public AudioGenerator
const int buffLen = 0x600; // Slightly larger than largest MP3 frame
unsigned char *buff;
int lastReadPos;
int lastBuffLen;
unsigned int lastRate;
int lastChannels;
bool finishing;
// Decoding bits
bool madInitted;