From b672a694b9d14dc57e4f15ed52212d225077a07a Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Sun, 10 Jun 2018 09:09:46 +0200 Subject: VIDEO: Synchronize video to pts timestamps This is another attempts at improving the audio/video sync in the MPEG-PS decoder. Unfortunately, the audio probably also needs to be synced to its pts timestamps... --- video/mpegps_decoder.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'video') diff --git a/video/mpegps_decoder.cpp b/video/mpegps_decoder.cpp index 421ae1ee3e..99624dd119 100644 --- a/video/mpegps_decoder.cpp +++ b/video/mpegps_decoder.cpp @@ -486,6 +486,10 @@ bool MPEGPSDecoder::MPEGVideoTrack::sendPacket(Common::SeekableReadStream *packe if (foundFrame) { _curFrame++; + if (pts != 0xFFFFFFFF) { + Audio::Timestamp ptsTimestamp = Audio::Timestamp(pts / 90, 27000000); + framePeriod = ptsTimestamp.frameDiff(_nextFrameStartTime); + } _nextFrameStartTime = _nextFrameStartTime.addFrames(framePeriod); } #endif -- cgit v1.2.3