From d540ff816cd7376290bbc277c4afe2c9770e4952 Mon Sep 17 00:00:00 2001 From: raven02 Date: Sun, 31 Mar 2013 03:10:29 +0800 Subject: [PATCH] Improve sceMpegAvcDecode/YCbCr --- Core/HLE/sceMpeg.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Core/HLE/sceMpeg.cpp b/Core/HLE/sceMpeg.cpp index 44c9d070c6..9297302408 100644 --- a/Core/HLE/sceMpeg.cpp +++ b/Core/HLE/sceMpeg.cpp @@ -738,8 +738,8 @@ u32 sceMpegAvcDecode(u32 mpeg, u32 auAddr, u32 frameWidth, u32 bufferAddr, u32 i if (ringbuffer.packetsFree + packetsConsumed >= ringbuffer.packets) { // Having not yet reached the last timestamp? if (ctx->mpegLastTimestamp > 0 && avcAu.pts < ctx->mpegLastTimestamp) { - // Do not yet consume all the remaining packets. - packetsConsumed = 0; + // Do not yet consume all the remaining packets, leave 2 packets + packetsConsumed = ringbuffer.packets - ringbuffer.packetsFree - 2; } } ctx->mediaengine->setReadLength(ctx->mediaengine->readLength() - packetsConsumed * ringbuffer.packetSize); @@ -911,8 +911,8 @@ int sceMpegAvcDecodeYCbCr(u32 mpeg, u32 auAddr, u32 bufferAddr, u32 initAddr) if (ringbuffer.packetsFree + packetsConsumed >= ringbuffer.packets) { // Having not yet reached the last timestamp? if (ctx->mpegLastTimestamp > 0 && avcAu.pts < ctx->mpegLastTimestamp) { - // Do not yet consume all the remaining packets. - packetsConsumed = 0; + // Do not yet consume all the remaining packets, leave 2 packets + packetsConsumed = ringbuffer.packets - ringbuffer.packetsFree - 2; } } ctx->mediaengine->setReadLength(ctx->mediaengine->readLength() - packetsConsumed * ringbuffer.packetSize);