mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
sceAudiocodec: report the decoded size in bytes, not samples
The field at 0x24 is a byte count, like srcBytesRead next to it, and sceAudiocodecGetOutputBytes describes the same quantity the same way (0x1200 for MPEG1 MP3). We were putting the sample count there, a quarter of the value, and libmp3.prx takes it as the length of the PCM to pass on. Renamed to dstBytesWritten so it reads like what it is. Nothing on our side consumed the field, so this only changes what the firmware modules see. mpeg.prx ignores it, which is why Atrac3+ playback was unaffected either way, but libatrac3plus.prx does read it. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
This commit is contained in:
1 parent
08573668c5
commit
7ed0598433
2 files changed
+6
-2
No files matched your search
@@ -398,7 +398,11 @@ static int sceAudiocodecDecode(u32 ctxPtr, int codec) {
|
||||
}
|
||||
|
||||
ctx->srcBytesRead = inDataConsumed + headerBytes;
|
||||
ctx->dstSamplesWritten = outSamples;
|
||||
// In bytes, not samples. sceAudiocodecGetOutputBytes describes the same quantity in bytes
|
||||
// (0x1200 for MPEG1 MP3), and libmp3.prx takes this as the length of the PCM to hand on -
|
||||
// reporting the sample count instead gave it a quarter of every frame, which played back
|
||||
// fast and metallic. The decoder always writes stereo 16-bit, whatever the source is.
|
||||
ctx->dstBytesWritten = outSamples * 2 * (int)sizeof(int16_t);
|
||||
}
|
||||
return hleLogDebug(Log::ME, 0, "codec %s sampleRate: %d bytesPerFrame: %d channels: %d", GetCodecName(codec), sampleRate, bytesPerFrame, channels);
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ struct SceAudiocodecCodec {
|
||||
u32 inBuf; // 0x18 the raw frame to decode
|
||||
s32 srcBytesRead; // 0x1c written by the decoder
|
||||
u32 outBuf; // 0x20 where decoded PCM goes
|
||||
s32 dstSamplesWritten; // 0x24 written by the decoder
|
||||
s32 dstBytesWritten; // 0x24 written by the decoder, in bytes like srcBytesRead
|
||||
|
||||
// Codec-specific, 0x28..0x67.
|
||||
union {
|
||||
|
||||
Reference in new issue
Block a user