From 6730f9047e74601de024d731983f55890f72ad46 Mon Sep 17 00:00:00 2001 From: Erik Zandvliet Date: Tue, 7 Nov 2017 11:44:29 +0100 Subject: [PATCH] Fix rollover point --- lib/ts_stream.cpp | 4 ++-- lib/ts_stream.h | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/ts_stream.cpp b/lib/ts_stream.cpp index 9f772e63..9e305fa6 100644 --- a/lib/ts_stream.cpp +++ b/lib/ts_stream.cpp @@ -434,7 +434,7 @@ namespace TS{ timeStamp += (rolloverCount[tid] * TS_PTS_ROLLOVER); - if ((timeStamp < lastms[tid]) && ((timeStamp + TS_PTS_ROLLOVER) > lastms[tid] )){ + if ((timeStamp < lastms[tid]) && ((timeStamp % TS_PTS_ROLLOVER) < 0.1 * TS_PTS_ROLLOVER) && ((lastms[tid] % TS_PTS_ROLLOVER) > 0.9 * TS_PTS_ROLLOVER)){ ++rolloverCount[tid]; timeStamp += TS_PTS_ROLLOVER; } @@ -472,7 +472,7 @@ namespace TS{ free(payload); } - void Stream::setLastms(uint32_t tid, uint64_t timestamp){ + void Stream::setLastms(unsigned long tid, uint64_t timestamp){ lastms[tid] = timestamp; rolloverCount[tid] = timestamp / TS_PTS_ROLLOVER; } diff --git a/lib/ts_stream.h b/lib/ts_stream.h index 44490292..284f6e6d 100644 --- a/lib/ts_stream.h +++ b/lib/ts_stream.h @@ -61,7 +61,7 @@ namespace TS{ uint64_t timeStamp, int64_t timeOffset, uint64_t bPos, bool alignment); std::set getActiveTracks(); - void setLastms(uint32_t tid, uint64_t timestamp); + void setLastms(unsigned long tid, uint64_t timestamp); private: unsigned long long lastPAT; ProgramAssociationTable associationTable; @@ -86,8 +86,8 @@ namespace TS{ std::map mpeg2SeqExt; std::map mp2Hdr; - std::map rolloverCount; - std::map lastms; + std::map rolloverCount; + std::map lastms; mutable tthread::recursive_mutex tMutex;