Revert to using FFMPEG as decoding backend for sceMp3 again, instead of minimp3.

This commit is contained in:
Henrik Rydgård committed 2025-04-14 22:38:25 +02:00
1 parent 06a5de0972
commit 6fe537df55
1 file changed
+11 -2
+11 -2
View File
@@ -70,6 +70,10 @@ public:
bool Decode(const uint8_t* inbuf, int inbytes, int *inbytesConsumed, int outputChannels, int16_t *outbuf, int *outSamples) override {
_dbg_assert_(outputChannels == 2);
// When used from sceMp3LowLevelDecode, this fails to parse the mp3 header!
// It's because minimp3 is a bit more sensitive than ffmpeg - if you give it a buffer that's larger than the frame size,
// it'll check that there's a second matching frame before accepting. But in our case we only get one frame,
// but we do not know the size. So this might need some modifications in minimp3.
mp3dec_frame_info_t info{};
int samplesWritten = mp3dec_decode_frame(&mp3_, inbuf, inbytes, (mp3d_sample_t *)temp_, &info);
_dbg_assert_(samplesWritten <= MINIMP3_MAX_SAMPLES_PER_FRAME);
@@ -146,8 +150,13 @@ AudioDecoder *CreateAudioDecoder(PSPAudioType audioType, int sampleRateHz, int c
}
switch (audioType) {
case PSP_CODEC_MP3:
return new MiniMp3Audio();
// Our MiniMP3 backend has too many issues:
// * Doesn't accept sample rate
// * Doesn't accept data where there's only one valid frame if the buffer is bigger.
// This prevents sceMp3LowLevelDecode from working, since nothing passes us the frame size.
//
// case PSP_CODEC_MP3:
// return new MiniMp3Audio();
case PSP_CODEC_AT3:
return CreateAtrac3Audio(channels, blockAlign, extraData, extraDataSize);
case PSP_CODEC_AT3PLUS: