mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-09-29 15:56:37 +02:00
sceAudiocodec: don't return a zero Atrac3+ frame size for odd bitrates
CalculateInputBytesAndChannelsAt3Plus only set the frame size for the four bitrates it had a table entry for and left it at 0 otherwise, which fails the decode - the same shape of bug the AAC path just had. formatByte2 * 8 + 8 is the size for all four known bitrates, so use it for the rest too; the firmware never returns 0 here. The common PSMF path is unaffected: it takes the size from the frame's own header before reaching this. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
b561de3ff1
commit
ba7bf86e73
@@ -139,24 +139,12 @@ void CalculateInputBytesAndChannelsAt3Plus(const SceAudiocodecCodec *ctx, int *i
|
||||
return;
|
||||
}
|
||||
|
||||
int size = formatByte2 * 8 + 8;
|
||||
// No idea if this is accurate, this is just a guess...
|
||||
if (formatByte1 & 8) {
|
||||
*channels = 2;
|
||||
} else {
|
||||
*channels = 1;
|
||||
}
|
||||
switch (size) {
|
||||
case 0x118:
|
||||
case 0x178:
|
||||
case 0x230:
|
||||
case 0x2E8:
|
||||
// These have been seen before, let's return it.
|
||||
*inputBytes = size;
|
||||
return;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
// bit 3 of the first byte is the channel count. This is a guess, but it fits the data we have.
|
||||
*channels = (formatByte1 & 8) ? 2 : 1;
|
||||
// formatByte2 * 8 + 8 gives the frame size for every bitrate we have data for (0x118, 0x178,
|
||||
// 0x230, 0x2E8), so use it for any other value as well rather than leaving inputBytes at 0,
|
||||
// which the firmware never does and which would fail the decode outright.
|
||||
*inputBytes = formatByte2 * 8 + 8;
|
||||
}
|
||||
|
||||
// Atrac3 (0x1001). Unlike Atrac3+, the context doesn't carry a frame size - libatrac3plus.prx
|
||||
|
||||
Reference in New Issue
Block a user