From 6b8752407712884175c53d8a4eba7431f5759c1d Mon Sep 17 00:00:00 2001 From: oioitff Date: Fri, 28 Jun 2013 22:06:20 +0800 Subject: [PATCH] sceMpegGetAvcAu should return PSP_ERROR_MPEG_NO_DATA at first call before mpegAvcDecode. --- Core/HLE/sceMpeg.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Core/HLE/sceMpeg.cpp b/Core/HLE/sceMpeg.cpp index 808e4ff089..77cfa16501 100644 --- a/Core/HLE/sceMpeg.cpp +++ b/Core/HLE/sceMpeg.cpp @@ -255,7 +255,7 @@ void AnalyzeMpeg(u32 buffer_addr, MpegContext *ctx) { ctx->mpegLastDate = convertTimestampToDate(ctx->mpegLastTimestamp); ctx->avc.avcDetailFrameWidth = (Memory::Read_U8(buffer_addr + 142) * 0x10); ctx->avc.avcDetailFrameHeight = (Memory::Read_U8(buffer_addr + 143) * 0x10); - ctx->avc.avcDecodeResult = MPEG_AVC_DECODE_SUCCESS; + ctx->avc.avcDecodeResult = 0; ctx->avc.avcFrameStatus = 0; ctx->videoFrameCount = 0; @@ -965,6 +965,11 @@ int sceMpegGetAvcAu(u32 mpeg, u32 streamId, u32 auAddr, u32 attrAddr) SceMpegAu sceAu; sceAu.read(auAddr); + if (ctx->avc.avcDecodeResult == 0) { + // return PSP_ERROR_MPEG_NO_DATA at first call before mpegAvcDecode + ctx->avc.avcDecodeResult = MPEG_AVC_DECODE_SUCCESS; + return hleDelayResult(PSP_ERROR_MPEG_NO_DATA, "mpeg get avc", mpegDecodeErrorDelayMs); + } if (mpegRingbuffer.packetsRead == 0 || mpegRingbuffer.packetsFree == mpegRingbuffer.packets) { DEBUG_LOG(HLE, "PSP_ERROR_MPEG_NO_DATA=sceMpegGetAvcAu(%08x, %08x, %08x, %08x)", mpeg, streamId, auAddr, attrAddr); sceAu.pts = -1;