[APU] Fix incorrect packet frame count when frame ends exactly where packet ends

This resolves looping background sound in GoW
This commit is contained in:
Gliniak 2022-11-03 11:14:37 +01:00
parent 259679d53c
commit b23566b823
1 changed files with 6 additions and 0 deletions

View File

@ -851,6 +851,12 @@ std::tuple<int, bool> XmaContext::GetPacketFrameCount(uint8_t* packet) {
if (stream.Read(1) == 0) {
return {frame_count, false};
}
// There is a case when frame ends EXACTLY at the end of packet.
// In such case we shouldn't increase frame count by additional not existing
// frame and don't mark it as splitted, but as a normal frame
if (!stream.BitsRemaining()) {
return {frame_count, false};
}
}
}