(Attempted) Simplify time stamp calculation on switches. (#2688)
* Simplify time stamp calculation on switches. Trying to simplify time stamp calculation on restarts. The additional checks take effect rarely and it not worth the extra complication. Also, doing the reference time stamp in extended range. The challenge with that is when publisher migrates the extended timestamp could change post migration (i. e. post migration would not know about rollovers). To address that, maintain an offset that is updated on resync. * WIP * Revert to resume threshold * typo * clean up
This commit is contained in:
@@ -529,6 +529,11 @@ func (r *rtpStatsBase) maybeAdjustFirstPacketTime(srData *RTCPSenderReportData,
|
||||
"adjustment", r.firstTime.Sub(firstTime).String(),
|
||||
"extNowTS", extNowTS,
|
||||
"extStartTS", extStartTS,
|
||||
"srData", srData,
|
||||
"timeSinceReceive", timeSinceReceive.String(),
|
||||
"timeSinceFirst", timeSinceFirst.String(),
|
||||
"samplesDiff", samplesDiff,
|
||||
"samplesDuration", samplesDuration,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -212,18 +212,21 @@ func (r *RTPStatsReceiver) Update(
|
||||
flowState.ExtSequenceNumber = resSN.ExtendedVal
|
||||
flowState.ExtTimestamp = resTS.ExtendedVal
|
||||
} else { // in-order
|
||||
if gapSN >= cNumSequenceNumbers/2 {
|
||||
if gapSN >= cNumSequenceNumbers/2 || resTS.ExtendedVal < resTS.PreExtendedHighest {
|
||||
r.logger.Warnw(
|
||||
"large sequence number gap", nil,
|
||||
"large sequence number gap OR time reversed", nil,
|
||||
"extStartSN", r.sequenceNumber.GetExtendedStart(),
|
||||
"extHighestSN", r.sequenceNumber.GetExtendedHighest(),
|
||||
"extStartTS", r.timestamp.GetExtendedStart(),
|
||||
"extHighestTS", r.timestamp.GetExtendedHighest(),
|
||||
"firstTime", r.firstTime.String(),
|
||||
"highestTime", r.highestTime.String(),
|
||||
"prev", resSN.PreExtendedHighest,
|
||||
"curr", resSN.ExtendedVal,
|
||||
"gap", gapSN,
|
||||
"prevSN", resSN.PreExtendedHighest,
|
||||
"currSN", resSN.ExtendedVal,
|
||||
"gapSN", gapSN,
|
||||
"prevTS", resTS.PreExtendedHighest,
|
||||
"currTS", resTS.ExtendedVal,
|
||||
"gapTS", resTS.ExtendedVal-resTS.PreExtendedHighest,
|
||||
"packetTime", packetTime.String(),
|
||||
"sequenceNumber", sequenceNumber,
|
||||
"timestamp", timestamp,
|
||||
|
||||
@@ -33,6 +33,8 @@ const (
|
||||
cSenderReportInitialWait = time.Second
|
||||
)
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
type snInfoFlag byte
|
||||
|
||||
const (
|
||||
@@ -625,7 +627,7 @@ func (r *RTPStatsSender) GetExpectedRTPTimestamp(at time.Time) (expectedTSExt ui
|
||||
defer r.lock.RUnlock()
|
||||
|
||||
if !r.initialized {
|
||||
err = errors.New("uninitilaized")
|
||||
err = errors.New("uninitialized")
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user