Merge pull request #2049 from oioitff/mpeg-fix

Improve mpeg pts.
This commit is contained in:
Henrik Rydgård committed 2013-06-03 02:36:11 -07:00
commit dd85a7b8e5
2 files changed
+9 -14

No files matched your search

+4 -4
View File
@@ -975,8 +975,8 @@ int sceMpegGetAvcAu(u32 mpeg, u32 streamId, u32 auAddr, u32 attrAddr)
int result = 0;
sceAu.pts = ctx->mediaengine->getVideoTimeStamp();
if (sceAu.pts >= ctx->mpegLastTimestamp) {
INFO_LOG(HLE, "video end reach. pts: %i dts: %i", (int)sceAu.pts, (int)ctx->mpegLastTimestamp);
if (sceAu.pts >= ctx->mediaengine->getLastTimeStamp()) {
INFO_LOG(HLE, "video end reach. pts: %i dts: %i", (int)sceAu.pts, (int)ctx->mediaengine->getLastTimeStamp());
mpegRingbuffer.packetsFree = mpegRingbuffer.packets;
Memory::WriteStruct(ctx->mpegRingbufferAddr, &mpegRingbuffer);
@@ -1039,8 +1039,8 @@ int sceMpegGetAtracAu(u32 mpeg, u32 streamId, u32 auAddr, u32 attrAddr)
int result = 0;
sceAu.pts = ctx->mediaengine->getAudioTimeStamp();
if (sceAu.pts >= ctx->mpegLastTimestamp) {
INFO_LOG(HLE, "video end reach. pts: %i dts: %i", (int)sceAu.pts, (int)ctx->mpegLastTimestamp);
if (sceAu.pts >= ctx->mediaengine->getLastTimeStamp()) {
INFO_LOG(HLE, "video end reach. pts: %i dts: %i", (int)sceAu.pts, (int)ctx->mediaengine->getLastTimeStamp());
mpegRingbuffer.packetsFree = mpegRingbuffer.packets;
Memory::WriteStruct(ctx->mpegRingbufferAddr, &mpegRingbuffer);
+5 -10
View File
@@ -361,20 +361,14 @@ bool MediaEngine::stepVideo(int videoPixelMode) {
pCodecCtx->height, m_pFrameRGB->data, m_pFrameRGB->linesize);
if(frameFinished) {
if (m_videopts == 3003) {
m_audiopts = packet.pts;
}
m_videopts = packet.pts + packet.duration;
int firstTimeStamp = bswap32(*(int*)(m_pdata + 86));
m_videopts = packet.pts + packet.duration - firstTimeStamp;
bGetFrame = true;
}
}
av_free_packet(&packet);
if (bGetFrame) break;
}
if (m_audiopts > 0) {
if (m_audiopts - m_videopts > 5000)
return stepVideo(videoPixelMode);
}
return bGetFrame;
#else
return true;
@@ -557,7 +551,7 @@ s64 MediaEngine::getVideoTimeStamp() {
}
s64 MediaEngine::getAudioTimeStamp() {
if (m_audiopts > 0)
if (m_demux)
return m_audiopts;
return m_videopts;
}
@@ -565,7 +559,8 @@ s64 MediaEngine::getAudioTimeStamp() {
s64 MediaEngine::getLastTimeStamp() {
if (!m_pdata)
return 0;
int firstTimeStamp = bswap32(*(int*)(m_pdata + 86));
int lastTimeStamp = bswap32(*(int*)(m_pdata + 92));
return lastTimeStamp;
return lastTimeStamp - firstTimeStamp;
}