Check sender report against media path. (#2843)

Seeing cases (mostly across relay) of large first packet time adjustment
getting ignored. From data, it looks like the first packet is extremely
delayed (some times of the order of minutes) which does not make sense.

Adding some checks against media path, i. e. compare RTP timestamp from
sender report against expected RTP timestamp based on media path
arrivals and log deviations more than 5 seconds.

Another puzzling case. Trying to understand more.

Also, refactoring SetRtcpSenderReportData() function as it was getting
unwieldy.
This commit is contained in:
Raja Subramanian
2024-07-09 09:20:27 +05:30
committed by GitHub
parent 4e9ab46091
commit 27f6794e77
2 changed files with 122 additions and 60 deletions
+4 -4
View File
@@ -548,7 +548,8 @@ func (r *RTPStatsSender) UpdateFromReceiverReport(rr rtcp.ReceptionReport) (rtt
if r.lastRRTime.IsZero() {
timeSinceLastRR = time.Since(r.startTime)
}
if r.metadataCacheOverflowCount%10 == 0 {
r.metadataCacheOverflowCount++
if (r.metadataCacheOverflowCount-1)%10 == 0 {
r.logger.Infow(
"metadata cache overflow",
"timeSinceLastRR", timeSinceLastRR.String(),
@@ -561,7 +562,6 @@ func (r *RTPStatsSender) UpdateFromReceiverReport(rr rtcp.ReceptionReport) (rtt
"rtpStats", lockedRTPStatsSenderLogEncoder{r},
)
}
r.metadataCacheOverflowCount++
}
s.extLastRRSN = extReceivedRRSN
}
@@ -656,7 +656,8 @@ func (r *RTPStatsSender) GetRtcpSenderReport(ssrc uint32, publisherSRData *RTCPS
rtpDiffSinceLastReport := nowRTPExt - r.srNewest.RTPTimestampExt
windowClockRate := float64(rtpDiffSinceLastReport) / timeSinceLastReport.Seconds()
if timeSinceLastReport.Seconds() > 0.2 && math.Abs(float64(r.params.ClockRate)-windowClockRate) > 0.2*float64(r.params.ClockRate) {
if r.clockSkewCount%100 == 0 {
r.clockSkewCount++
if (r.clockSkewCount-1)%100 == 0 {
fields := append(
getFields(),
"timeSinceLastReport", timeSinceLastReport.String(),
@@ -666,7 +667,6 @@ func (r *RTPStatsSender) GetRtcpSenderReport(ssrc uint32, publisherSRData *RTCPS
)
r.logger.Infow("sending sender report, clock skew", fields...)
}
r.clockSkewCount++
}
}