Ensure BPS=16 is set in MP3 decoder
Valgrind found another uninitialized use. BitsPerSample was not being called by the LIBMAD decoder, so it was possible to start out in a bad state. Now always set it to 16, the decoder native output size. Channels are initialized to 2, but this setting is always reset on a per-frame basis anyway.
This commit is contained in:
1 parent
158fe23181
commit
da068e30e6
1 file changed
+4
@@ -203,6 +203,10 @@ bool AudioGeneratorMP3::begin(AudioFileSource *source, AudioOutput *output)
|
||||
Serial.printf_P(PSTR("MP3 source file not open\n"));
|
||||
return false; // Error
|
||||
}
|
||||
|
||||
output->SetBitsPerSample(16); // Constant for MP3 decoder
|
||||
output->SetChannels(2);
|
||||
|
||||
if (!output->begin()) return false;
|
||||
|
||||
// Where we are in generating one frame's data, set to invalid so we will run loop on first getsample()
|
||||
|
||||
Reference in new issue
Block a user