aboutsummaryrefslogtreecommitdiff
path: root/video
diff options
context:
space:
mode:
authorTorbjörn Andersson2018-06-17 15:24:15 +0200
committerThierry Crozat2018-11-04 22:33:22 +0100
commitac40828ed24ff3d42ac68f2d45f36a03c34dc54d (patch)
treebfc6a3f8565a7c6b8d8e4d1d4726360e2f23e852 /video
parentb672a694b9d14dc57e4f15ed52212d225077a07a (diff)
downloadscummvm-rg350-ac40828ed24ff3d42ac68f2d45f36a03c34dc54d.tar.gz
scummvm-rg350-ac40828ed24ff3d42ac68f2d45f36a03c34dc54d.tar.bz2
scummvm-rg350-ac40828ed24ff3d42ac68f2d45f36a03c34dc54d.zip
VIDEO: Make the video pts sync easier to understand
Diffstat (limited to 'video')
-rw-r--r--video/mpegps_decoder.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/video/mpegps_decoder.cpp b/video/mpegps_decoder.cpp
index 99624dd119..81c1765475 100644
--- a/video/mpegps_decoder.cpp
+++ b/video/mpegps_decoder.cpp
@@ -486,11 +486,16 @@ bool MPEGPSDecoder::MPEGVideoTrack::sendPacket(Common::SeekableReadStream *packe
if (foundFrame) {
_curFrame++;
+
+ // If there is a presentation timestamp, use that for sync. Almost all
+ // packets with a presentation timestamp will have a found frame, so
+ // it is probably not worth the trouble worrying about when they don't.
+
if (pts != 0xFFFFFFFF) {
- Audio::Timestamp ptsTimestamp = Audio::Timestamp(pts / 90, 27000000);
- framePeriod = ptsTimestamp.frameDiff(_nextFrameStartTime);
+ _nextFrameStartTime = Audio::Timestamp(pts / 90, 27000000);
+ } else {
+ _nextFrameStartTime = _nextFrameStartTime.addFrames(framePeriod);
}
- _nextFrameStartTime = _nextFrameStartTime.addFrames(framePeriod);
}
#endif