From f53e49fed542be3b299d25456eaeb5c9c4fdb9c6 Mon Sep 17 00:00:00 2001 From: Marten Richter Date: Sun, 4 Nov 2012 14:21:32 +0100 Subject: [PATCH] Fix invalid time --- demuxerts.cc | 3 ++- videoomx.cc | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/demuxerts.cc b/demuxerts.cc index ec83d11..afcdba6 100644 --- a/demuxerts.cc +++ b/demuxerts.cc @@ -705,7 +705,7 @@ ULONG DemuxerTS::getFrameNumFromPTS(ULLONG pts) while (iter != pts_map.end()) { ++total; - //Log::getInstance()->log("DemuxerTS", Log::DEBUG, "getFrameNumfromPTS pts1 %lld pts2 %lld", pts, iter->pts); + //Log::getInstance()->log("DemuxerTS", Log::DEBUG, "getFrameNumfromPTS pts1 %lld pts2 %lld", pts, iter->pts); if (PTSDifference(iter->pts, pts) < PTS_ALLOWANCE) { difference = 0; @@ -785,6 +785,7 @@ void DemuxerTS::parseTSPacketDetails(PESPacket &packet) // Only important stuff double tfps=fps; // if (doubledframerate) tfps*=2.; ULLONG pts_expected = me.pts + 90000*((int)(((double)(frame_num - me.frame)) / tfps)); + while (pts_expected > (1LL<<33)) pts_expected -= (1LL<<33); // this was a workaround for a vdr bug, now fixed, for older recordings deleter the index file diff --git a/videoomx.cc b/videoomx.cc index 45946e8..b2c9c37 100644 --- a/videoomx.cc +++ b/videoomx.cc @@ -2178,6 +2178,7 @@ ULLONG VideoOMX::getCurrentTimestamp() { //ncur_clock_time -= startoffset; ncur_clock_time -= lastreftimeOMX; long long result = lastreftimePTS; + if (lastreftimePTS==0) return 0; // invalid time result += (long long) (ncur_clock_time / 10000LL * 90LL); if (result < 0) result = (1LL << 33) - result; -- 2.39.5