56 int64_t newCounter, lastCounter = -1;
58 if (!highestPacket.empty())
59 lastCounter = highestPacket.packetId().msTime();
61 if (pack.containsPacketCounter())
63 else if (pack.containsSampleTimeFine())
65 if (pack.containsSampleTimeCoarse())
66 newCounter = (
int64_t) pack.sampleTime64();
70 else if (pack.containsPacketCounter8())
73 newCounter = lastCounter + 1;
77 pack.setPacketId(newCounter);
78 if (newCounter > lastCounter)
93 if (lastCounter < 0) {
98 int64_t dt = frameCounter - low;
102 return lastCounter + dt;
116 if (lastCounter < 0) {
121 int64_t dt = frameCounter - low;
125 return lastCounter + dt;
142 int64_t low = lastTime % 864000000;
144 if (dt < (-864000000/2))
145 return lastTime + dt + 864000000;
146 if (dt < (864000000/2))
147 return lastTime + dt;
149 return lastTime + dt - 864000000;
static int64_t stampPacket(XsDataPacket &pack, XsDataPacket &highest)
Create 64 bit counter for a packet.
static const int64_t SC8BOUNDARY_HIGHMASK
8 bit Sample Counter boundary exclusive mask
mrpt::system::TTimeStamp now()
A shortcut for system::getCurrentTime.
static const int64_t SC8BOUNDARY
8 bit Sample Counter boundary
static const int64_t SC8BOUNDARY_HALF
8 bit Sample Counter boundary/2, used for determining SC wrapping
static int64_t calculateLargeSampleTime(int64_t frameTime, int64_t lastTime)
Calculate the new large sample time value based on frameTime and the lastTime.
static const int64_t SC8BOUNDARY_LOWMASK
8 bit Sample Counter boundary inclusive mask
static int64_t calculateLargePacketCounter(int64_t frameCounter, int64_t lastCounter)
Calculate the new large sample counter value based on frameCounter and the lastCounter.
static const int64_t MTSCBOUNDARY_LOWMASK
16 bit MT Sample Counter boundary inclusive mask
static int64_t calculateLargePacketCounter8(int64_t frameCounter, int64_t lastCounter)
Calculate the new large packet counter value based on frameCounter and the lastCounter.
static const int64_t MTSCBOUNDARY_HALF
16 bit MT Sample Counter boundary/2, used for determining SC wrapping
static const int64_t MTSCBOUNDARY
16 bit MT Sample Counter boundary
Contains data received from a device or read from a file.
static const int64_t MTSCBOUNDARY_HIGHMASK
16 bit MT Sample Counter boundary exclusive mask