diff --git a/Core/HLE/sceMpeg.cpp b/Core/HLE/sceMpeg.cpp index 71d7d3996..63fb479f4 100644 --- a/Core/HLE/sceMpeg.cpp +++ b/Core/HLE/sceMpeg.cpp @@ -1063,7 +1063,7 @@ int sceMpegGetAtracAu(u32 mpeg, u32 streamId, u32 auAddr, u32 attrAddr) } // The audio can end earlier than the video does. - if (mpegRingbuffer.packetsFree == mpegRingbuffer.packets || (ctx->mediaengine->IsAudioEnd() && !ctx->mediaengine->IsVideoEnd())) { + if (mpegRingbuffer.packetsFree == mpegRingbuffer.packets) { DEBUG_LOG(HLE, "PSP_ERROR_MPEG_NO_DATA=sceMpegGetAtracAu(%08x, %08x, %08x, %08x)", mpeg, streamId, auAddr, attrAddr); // TODO: Does this really delay? return hleDelayResult(PSP_ERROR_MPEG_NO_DATA, "mpeg get atrac", mpegDecodeErrorDelayMs); diff --git a/Core/HLE/scePsmf.cpp b/Core/HLE/scePsmf.cpp index c1d2d4a42..b3a0aae8d 100644 --- a/Core/HLE/scePsmf.cpp +++ b/Core/HLE/scePsmf.cpp @@ -1016,7 +1016,7 @@ int scePsmfPlayerGetVideoData(u32 psmfPlayer, u32 videoDataAddr) s64 deltapts = psmfplayer->mediaengine->getVideoTimeStamp() - psmfplayer->mediaengine->getAudioTimeStamp(); int delaytime = 3000; - if (deltapts > 0 && !psmfplayer->mediaengine->IsAudioEnd()) + if (deltapts > 0 && !psmfplayer->mediaengine->IsNoAudioData()) delaytime = deltapts * 1000000 / 90000; if (!ret) return hleDelayResult(ret, "psmfPlayer video decode", delaytime); @@ -1037,7 +1037,7 @@ int scePsmfPlayerGetAudioData(u32 psmfPlayer, u32 audioDataAddr) Memory::Memset(audioDataAddr, 0, audioSamplesBytes); psmfplayer->mediaengine->getAudioSamples(Memory::GetPointer(audioDataAddr)); } - int ret = psmfplayer->mediaengine->IsAudioEnd() ? ERROR_PSMFPLAYER_NO_MORE_DATA : 0; + int ret = psmfplayer->mediaengine->IsNoAudioData() ? ERROR_PSMFPLAYER_NO_MORE_DATA : 0; return hleDelayResult(ret, "psmfPlayer audio decode", 3000); } diff --git a/Core/HW/MediaEngine.cpp b/Core/HW/MediaEngine.cpp index fb16e305c..17c3f542f 100644 --- a/Core/HW/MediaEngine.cpp +++ b/Core/HW/MediaEngine.cpp @@ -94,7 +94,7 @@ MediaEngine::MediaEngine(): m_pdata(0) { m_demux = 0; m_audioContext = 0; m_isVideoEnd = false; - m_isAudioEnd = false; + m_noAudioData = false; m_bufSize = 0x2000; m_mpegheaderReadPos = 0; g_iNumVideos++; @@ -136,7 +136,7 @@ void MediaEngine::closeMedia() { m_demux = 0; Atrac3plus_Decoder::CloseContext(&m_audioContext); m_isVideoEnd = false; - m_isAudioEnd = false; + m_noAudioData = false; } void MediaEngine::DoState(PointerWrap &p){ @@ -164,7 +164,7 @@ void MediaEngine::DoState(PointerWrap &p){ p.Do(m_audiopts); p.Do(m_isVideoEnd); - p.Do(m_isAudioEnd); + p.Do(m_noAudioData); p.DoMarker("MediaEngine"); } @@ -249,7 +249,7 @@ bool MediaEngine::openContext() { setVideoDim(); m_audioContext = Atrac3plus_Decoder::OpenContext(); m_isVideoEnd = false; - m_isAudioEnd = false; + m_noAudioData = false; m_mpegheaderReadPos++; av_seek_frame(m_pFormatCtx, m_videoStream, 0, 0); #endif // USE_FFMPEG @@ -584,8 +584,10 @@ int MediaEngine::getAudioSamples(u8* buffer) { u8 *audioFrame = 0; int headerCode1, headerCode2; int frameSize = m_demux->getNextaudioFrame(&audioFrame, &headerCode1, &headerCode2); - if (frameSize == 0) + if (frameSize == 0) { + m_noAudioData = true; return 0; + } int outbytes = 0; Atrac3plus_Decoder::Decode(m_audioContext, audioFrame, frameSize, &outbytes, buffer); if (headerCode1 == 0x24) { @@ -599,6 +601,7 @@ int MediaEngine::getAudioSamples(u8* buffer) { } } m_audiopts += 4180; + m_noAudioData = false; return 0x2000; } diff --git a/Core/HW/MediaEngine.h b/Core/HW/MediaEngine.h index d6f9fe5b8..88c450367 100644 --- a/Core/HW/MediaEngine.h +++ b/Core/HW/MediaEngine.h @@ -71,7 +71,7 @@ public: s64 getLastTimeStamp(); bool IsVideoEnd() { return m_isVideoEnd; } - bool IsAudioEnd() { return m_isAudioEnd; } + bool IsNoAudioData() { return m_noAudioData; } void DoState(PointerWrap &p); @@ -106,7 +106,7 @@ public: s64 m_lastTimeStamp; bool m_isVideoEnd; - bool m_isAudioEnd; + bool m_noAudioData; int m_ringbuffersize; u8 m_mpegheader[0x10000];