From 00217c7af17bf1050b07c6bc64faac24231c1418 Mon Sep 17 00:00:00 2001 From: Raja Subramanian Date: Tue, 2 May 2023 22:43:37 +0530 Subject: [PATCH] Logging delta of receiver report (#1676) --- pkg/sfu/buffer/rtpstats.go | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/pkg/sfu/buffer/rtpstats.go b/pkg/sfu/buffer/rtpstats.go index 0e17414e1..c7b8575f9 100644 --- a/pkg/sfu/buffer/rtpstats.go +++ b/pkg/sfu/buffer/rtpstats.go @@ -753,11 +753,24 @@ func (r *RTPStats) SetRtcpSenderReportData(srData *RTCPSenderReportData) { smoothedOwd = (owd + smoothedOwd) / 2 // TODO-REMOVE-AFTER-DEBUG if r.params.ClockRate != 90000 { // log only for audio as it is less frequent + ntpTime := srData.NTPTimestamp.Time() + + var ntpDiffSinceLast, arrivalDiffSinceLast time.Duration + var rtpDiffSinceLast uint32 + if r.srDataExt != nil { + ntpDiffSinceLast = ntpTime.Sub(r.srDataExt.SenderReportData.NTPTimestamp.Time()) + rtpDiffSinceLast = srData.RTPTimestamp - r.srDataExt.SenderReportData.RTPTimestamp + arrivalDiffSinceLast = srData.ArrivalTime.Sub(r.srDataExt.SenderReportData.ArrivalTime) + } r.logger.Debugw( "received sender report", - "ntp", srData.NTPTimestamp.Time(), + "ntp", ntpTime, "rtp", srData.RTPTimestamp, "arrival", srData.ArrivalTime, + "ntpDiff", ntpDiffSinceLast, + "rtpDiff", rtpDiffSinceLast, + "arrivalDiff", arrivalDiffSinceLast, + "expectedTimeDiff", float64(rtpDiffSinceLast)/float64(r.params.ClockRate), "owd", owd, "smoothedOwd", smoothedOwd, ) @@ -1381,6 +1394,7 @@ func (r *RTPStats) getIntervalStats(startInclusive uint16, endExclusive uint16) "start", startInclusive, "end", endExclusive, "count", packetsNotFound, + "highestSN", r.highestSN, ) } return