aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTorbjörn Andersson2018-06-10 09:09:46 +0200
committerThierry Crozat2018-11-04 22:33:22 +0100
commitb672a694b9d14dc57e4f15ed52212d225077a07a (patch)
tree67dcb01f3931d7f3c572e097dccc5fc8fc89274f
parentd4f8b330d61cb2457fa1c085510a5f0553b98d97 (diff)
downloadscummvm-rg350-b672a694b9d14dc57e4f15ed52212d225077a07a.tar.gz
scummvm-rg350-b672a694b9d14dc57e4f15ed52212d225077a07a.tar.bz2
scummvm-rg350-b672a694b9d14dc57e4f15ed52212d225077a07a.zip
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...
-rw-r--r--video/mpegps_decoder.cpp4
1 files changed, 4 insertions, 0 deletions
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