Mp3: Properly flush the buffer on reset.

This commit is contained in:
Unknown W. Brackets 2019-04-28 11:59:07 -07:00
parent 4b4c0f9bda
commit bfa9aa009d
2 changed files with 9 additions and 5 deletions

View File

@ -171,15 +171,16 @@ static int sceMp3Decode(u32 mp3, u32 outPcmPtr) {
}
static int sceMp3ResetPlayPosition(u32 mp3) {
DEBUG_LOG(ME, "SceMp3ResetPlayPosition(%08x)", mp3);
AuCtx *ctx = getMp3Ctx(mp3);
if (!ctx) {
ERROR_LOG(ME, "%s: bad mp3 handle %08x", __FUNCTION__, mp3);
return -1;
if (mp3 >= MP3_MAX_HANDLES)
return hleLogError(ME, ERROR_MP3_INVALID_HANDLE, "invalid handle");
return hleLogError(ME, ERROR_MP3_NOT_YET_INIT_HANDLE, "unreserved handle");
} else if (ctx->Version < 0 || ctx->AuBuf == 0) {
return hleLogError(ME, ERROR_MP3_NOT_YET_INIT_HANDLE, "not yet init");
}
return ctx->AuResetPlayPosition();
return hleLogSuccessI(ME, ctx->AuResetPlayPosition());
}
static int sceMp3CheckStreamDataNeeded(u32 mp3) {

View File

@ -481,6 +481,9 @@ u32 AuCtx::AuResetPlayPositionByFrame(int position) {
u32 AuCtx::AuResetPlayPosition() {
readPos = startPos;
SumDecodedSamples = 0;
AuBufAvailable = 0;
sourcebuff.clear();
return 0;
}