diff --git a/pkg/sfu/rtpstats/rtpstats_sender.go b/pkg/sfu/rtpstats/rtpstats_sender.go index 5f883e930..c38116eaa 100644 --- a/pkg/sfu/rtpstats/rtpstats_sender.go +++ b/pkg/sfu/rtpstats/rtpstats_sender.go @@ -152,10 +152,11 @@ type senderSnapshot struct { maxJitterFeed float64 maxJitter float64 - extLastRRSN uint64 - intervalStats intervalStats - processedReceptionReports []rtcp.ReceptionReport - skippedReceptionReports []rtcp.ReceptionReport + extLastRRSN uint64 + intervalStats intervalStats + processedReceptionReports []rtcp.ReceptionReport + skippedReceptionReports []rtcp.ReceptionReport + metadataCacheOverflowCount int } func (s *senderSnapshot) MarshalLogObject(e zapcore.ObjectEncoder) error { @@ -188,6 +189,7 @@ func (s *senderSnapshot) MarshalLogObject(e zapcore.ObjectEncoder) error { e.AddObject("intervalStats", &s.intervalStats) e.AddObject("processedReceptionReports", wrappedReceptionReportsLogger{s, false}) e.AddObject("skippedReceptionReports", wrappedReceptionReportsLogger{s, true}) + e.AddInt("metadataCacheOverflowCount", s.metadataCacheOverflowCount) return nil } @@ -228,11 +230,10 @@ type RTPStatsSender struct { nextSenderSnapshotID uint32 senderSnapshots []senderSnapshot - clockSkewCount int - metadataCacheOverflowCount int - largeJumpNegativeCount int - largeJumpCount int - timeReversedCount int + clockSkewCount int + largeJumpNegativeCount int + largeJumpCount int + timeReversedCount int } func NewRTPStatsSender(params RTPStatsParams, cacheSize int) *RTPStatsSender { @@ -370,7 +371,8 @@ func (r *RTPStatsSender) Update( "gapSN", gapSN, "currTS", extTimestamp, "gapTS", int64(extTimestamp-r.extHighestTS), - "packetTime", packetTime, + "packetTime", time.Unix(0, packetTime), + "timeSinceHighest", time.Duration(packetTime-r.highestTime), "marker", marker, "hdrSize", hdrSize, "payloadSize", payloadSize, @@ -385,7 +387,7 @@ func (r *RTPStatsSender) Update( } if extSequenceNumber < r.extStartSN { - r.packetsLost += r.extStartSN - extSequenceNumber + r.packetsLost += r.extStartSN - extSequenceNumber - 1 // adjust start of snapshots for i := uint32(0); i < r.nextSnapshotID-cFirstSnapshotID; i++ { @@ -635,17 +637,18 @@ func (r *RTPStatsSender) UpdateFromReceiverReport(rr rtcp.ReceptionReport) (rtt if r.lastRRTime == 0 { timeSinceLastRR = time.Duration(mono.UnixNano() - r.startTime) } - r.metadataCacheOverflowCount++ - if (r.metadataCacheOverflowCount-1)%10 == 0 { + s.metadataCacheOverflowCount++ + if (s.metadataCacheOverflowCount-1)%10 == 0 { r.logger.Infow( "metadata cache overflow", + "senderSnapshotID", i+cFirstSnapshotID, "timeSinceLastRR", timeSinceLastRR, "receivedRR", rr, "extReceivedRRSN", extReceivedRRSN, "packetsInInterval", extReceivedRRSN-s.extLastRRSN, "intervalStats", &is, "aggregateIntervalStats", eis, - "count", r.metadataCacheOverflowCount, + "count", s.metadataCacheOverflowCount, "rtpStats", lockedRTPStatsSenderLogEncoder{r}, ) }