Remove infinite loop on error in DecodeNextFrame

DecodeNextFrame had a leftover while(1) in the inner loop without any
additional Input() calls, which could lead to an infinite loop on an
error condition.  Remove that unneeded loop.  Addresses some of the
stuff found in issue #21
This commit is contained in:
Earle F. Philhower, III committed 2017-12-22 21:19:06 -08:00
1 parent e4c1c8fc66
commit 6c3064a4b5
1 file changed
+6 -8
+6 -8
View File
@@ -111,15 +111,13 @@ enum mad_flow AudioGeneratorMP3::Input()
bool AudioGeneratorMP3::DecodeNextFrame()
{
do {
while (1) {
if (mad_frame_decode(&frame, &stream) == -1) {
if (!MAD_RECOVERABLE(stream.error)) break;
ErrorToFlow(); // Always returns CONTINUE
continue;
}
nsCountMax = MAD_NSBSAMPLES(&frame.header);
return true;
if (mad_frame_decode(&frame, &stream) == -1) {
if (!MAD_RECOVERABLE(stream.error)) break;
ErrorToFlow(); // Always returns CONTINUE
continue;
}
nsCountMax = MAD_NSBSAMPLES(&frame.header);
return true;
} while (stream.error == MAD_ERROR_BUFLEN);
Serial.printf_P(PSTR("stream.error != mad_Err_bufflen\n"));
return false;