111 const int64_t lowMask = boundary - 1;
112 const int64_t boundaryHalf = boundary / 2;
114 int64_t low = lastCounter & lowMask;
115 int64_t dt = frameCounter - low;
116 if (dt < -boundaryHalf)
117 return lastCounter + dt + boundary;
118 if (dt < boundaryHalf)
119 return lastCounter + dt;
121 return lastCounter + dt - boundary;
135 pack.setTimeOfArrival(XsTimeStamp::now());
136 int64_t newCounter, lastCounter = -1;
138 if (!highestPacket.empty())
139 lastCounter = highestPacket.packetId();
141 if (pack.packetId() > 0)
142 newCounter = pack.packetId();
143 else if (pack.containsPacketCounter())
145 else if (pack.containsSampleTimeFine())
147 newCounter = lastCounter + 1;
153 else if (pack.containsPacketCounter8())
155 else if (pack.containsAwindaSnapshot())
158 newCounter = lastCounter + 1;
162 pack.setPacketId(newCounter);
180 int64_t low = lastTime % 864000000;
181 int64_t dt = frameTime - low;
182 if (dt < (-864000000 / 2))
183 return lastTime + dt + 864000000;
184 if (dt < (864000000 / 2))
185 return lastTime + dt;
187 return lastTime + dt - 864000000;
193 if (pack.containsSampleTime64())
194 pack.setEstimatedTimeOfSampling(
XsTimeStamp((int64_t) pack.sampleTime64()));
196 pack.setEstimatedTimeOfSampling(
estimateTosInternal(pack.packetId(), pack.timeOfArrival().msTime()));
223 double fracTop = 0.0, fracBot = 0.0;
226 double dpid =
d.m_pid - avgPid;
227 double dtoa =
d.m_toa - avgToa;
228 fracTop += dpid * dtoa;
229 fracBot += dpid * dpid;
231 m_rate = fracTop / fracBot;
255 double diffMin = 0.0;
259 if (diff < -
m_rate && diff < diffMin)
301 m_rate = (double)(last.
m_toa - first.m_toa) / (double)(last.
m_pid - first.m_pid);
344 double rate = (double)(next->m_toa - prev->m_toa) / (double)(next->m_pid - prev->m_pid);
345 double itoa = (it->m_pid - prev->m_pid) * rate + prev->m_toa;
346 if ((
double) it->m_toa >= itoa)