From bc5b4d68afe73fd982359418aa96826f32740e43 Mon Sep 17 00:00:00 2001 From: Raja Subramanian Date: Thu, 31 Aug 2023 12:41:25 +0530 Subject: [PATCH] Do NACKs and reports always. (#2022) * Do NACKs and reports always. With padding packet drops, it is possible that a lot of packets go by without RTCP RR. Do NACKs and RTCP RR always. * remove local variable --- pkg/sfu/buffer/buffer.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/pkg/sfu/buffer/buffer.go b/pkg/sfu/buffer/buffer.go index aaeb08925..293b0f1fc 100644 --- a/pkg/sfu/buffer/buffer.go +++ b/pkg/sfu/buffer/buffer.go @@ -410,6 +410,12 @@ func (b *Buffer) SetRTT(rtt uint32) { } func (b *Buffer) calc(pkt []byte, arrivalTime time.Time) { + defer func() { + b.doNACKs() + + b.doReports(arrivalTime) + }() + var rtpPacket rtp.Packet if err := rtpPacket.Unmarshal(pkt); err != nil { b.logger.Errorw("could not unmarshal RTP packet", err) @@ -465,10 +471,6 @@ func (b *Buffer) calc(pkt []byte, arrivalTime time.Time) { return } - b.doNACKs() - - b.doReports(arrivalTime) - ep := b.getExtPacket(&rtpPacket, arrivalTime, flowState) if ep == nil { return @@ -661,8 +663,7 @@ func (b *Buffer) doNACKs() { } func (b *Buffer) doReports(arrivalTime time.Time) { - timeDiff := arrivalTime.Sub(b.lastReport) - if timeDiff < ReportDelta { + if time.Since(b.lastReport) < ReportDelta { return }