From 9fc276481a9b3030f908353961f38be3fb63b6e4 Mon Sep 17 00:00:00 2001 From: Raja Subramanian Date: Sat, 7 Oct 2023 12:25:47 +0530 Subject: [PATCH] Increase accuracy of delay since last sender report. (#2136) It is in 1 / 65536 seconds units. That is about 0.015 ms. So, use microseconds to increase accuracy. --- pkg/sfu/buffer/rtpstats_receiver.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/sfu/buffer/rtpstats_receiver.go b/pkg/sfu/buffer/rtpstats_receiver.go index bb4d33fe..2c30189d 100644 --- a/pkg/sfu/buffer/rtpstats_receiver.go +++ b/pkg/sfu/buffer/rtpstats_receiver.go @@ -361,9 +361,9 @@ func (r *RTPStatsReceiver) GetRtcpReceptionReport(ssrc uint32, proxyFracLost uin if r.srNewest != nil { lastSR = uint32(r.srNewest.NTPTimestamp >> 16) if !r.srNewest.At.IsZero() { - delayMS := uint32(time.Since(r.srNewest.At).Milliseconds()) - dlsr = (delayMS / 1e3) << 16 - dlsr |= (delayMS % 1e3) * 65536 / 1000 + delayUS := uint32(time.Since(r.srNewest.At).Microseconds()) + dlsr = (delayUS / 1e6) << 16 + dlsr |= (delayUS % 1e6) * 65536 / 1e6 } }