From 96fa2f896b40f2d6bf34024e22d18c45598cc832 Mon Sep 17 00:00:00 2001 From: Raja Subramanian Date: Tue, 15 Aug 2023 23:09:45 +0530 Subject: [PATCH] Set 32-bit RTP timestamp properly after repair. (#1968) --- pkg/sfu/buffer/rtpstats.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/sfu/buffer/rtpstats.go b/pkg/sfu/buffer/rtpstats.go index 1d0bdd2b8..1a556c3d0 100644 --- a/pkg/sfu/buffer/rtpstats.go +++ b/pkg/sfu/buffer/rtpstats.go @@ -965,7 +965,7 @@ func (r *RTPStats) GetRtcpSenderReport(ssrc uint32, calculatedClockRate uint32) nowRTPExtUsingRate = r.extStartTS + uint64(float64(calculatedClockRate)*timeSinceFirst.Seconds()) if nowRTPExtUsingRate > nowRTPExt { nowRTPExt = nowRTPExtUsingRate - nowRTP = uint32(nowRTPExtUsingRate) + nowRTP = uint32(nowRTPExt) } } @@ -992,6 +992,7 @@ func (r *RTPStats) GetRtcpSenderReport(ssrc uint32, calculatedClockRate uint32) ) ntpDiffSinceLast := nowNTP.Time().Sub(r.srNewest.NTPTimestamp.Time()) nowRTPExt = r.srNewest.RTPTimestampExt + uint64(ntpDiffSinceLast.Seconds()*float64(r.params.ClockRate)) + nowRTP = uint32(nowRTPExt) } // monitor and log RTP timestamp anomalies