From c03f6c23ed4958e95f931c38f0eaf35597fca1ba Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sun, 17 Jan 2016 00:22:46 -0800 Subject: [PATCH 1/2] Mpeg: Return errors when no audio is available. Before, we were only returning an error once, in an effort to log only once. This meant sometimes games would not realize they needed to add packets. --- Core/HLE/sceMpeg.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Core/HLE/sceMpeg.cpp b/Core/HLE/sceMpeg.cpp index abf7ca70b2..7a30c6d375 100644 --- a/Core/HLE/sceMpeg.cpp +++ b/Core/HLE/sceMpeg.cpp @@ -1602,12 +1602,18 @@ static int sceMpegGetAtracAu(u32 mpeg, u32 streamId, u32 auAddr, u32 attrAddr) if (ctx->mediaengine->IsVideoEnd()) { INFO_LOG(ME, "video end reach. pts: %i dts: %i", (int)atracAu.pts, (int)ctx->mediaengine->getLastTimeStamp()); ringbuffer->packetsAvail = 0; + // TODO: Is this correct? + if (!ctx->mediaengine->IsNoAudioData()) { + WARN_LOG_REPORT(ME, "Video end without audio end, potentially skipping some audio?"); + } result = ERROR_MPEG_NO_DATA; } if (ctx->atracRegistered && ctx->mediaengine->IsNoAudioData() && !ctx->endOfAudioReached) { WARN_LOG(ME, "Audio end reach. pts: %i dts: %i", (int)atracAu.pts, (int)ctx->mediaengine->getLastTimeStamp()); ctx->endOfAudioReached = true; + } + if (ctx->mediaengine->IsNoAudioData()) { result = ERROR_MPEG_NO_DATA; } From 74d40115a0ac7708379c0257f62a2032275abea3 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sun, 17 Jan 2016 00:30:18 -0800 Subject: [PATCH 2/2] Mpeg: Initialize esBuffer to safer values. Makes the audio work properly in Dan Ball Senki W (#4786.) --- Core/HLE/sceMpeg.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Core/HLE/sceMpeg.cpp b/Core/HLE/sceMpeg.cpp index 7a30c6d375..6e4495c06e 100644 --- a/Core/HLE/sceMpeg.cpp +++ b/Core/HLE/sceMpeg.cpp @@ -1320,7 +1320,9 @@ static int sceMpegInitAu(u32 mpeg, u32 bufferAddr, u32 auPointer) if (bufferAddr >= 1 && bufferAddr <= (u32)MPEG_DATA_ES_BUFFERS && ctx->esBuffers[bufferAddr - 1]) { // This esbuffer has been allocated for Avc. - sceAu.esBuffer = bufferAddr; // Can this be right??? not much of a buffer pointer.. + // Default to 0, since we stuff the stream id in here. Technically, we shouldn't. + // TODO: Do something better to track the AU data. This used to be bufferAddr. + sceAu.esBuffer = 0; sceAu.esSize = MPEG_AVC_ES_SIZE; sceAu.dts = 0; sceAu.pts = 0; @@ -1328,7 +1330,9 @@ static int sceMpegInitAu(u32 mpeg, u32 bufferAddr, u32 auPointer) sceAu.write(auPointer); } else { // This esbuffer has been left as Atrac. - sceAu.esBuffer = bufferAddr; + // Default to 0, since we stuff the stream id in here. Technically, we shouldn't. + // TODO: Do something better to track the AU data. This used to be bufferAddr. + sceAu.esBuffer = 0; sceAu.esSize = MPEG_ATRAC_ES_SIZE; sceAu.pts = 0; sceAu.dts = UNKNOWN_TIMESTAMP;