diff --git a/pkg/sfu/connectionquality/connectionstats.go b/pkg/sfu/connectionquality/connectionstats.go index 29fa49fc8..d2dba70d8 100644 --- a/pkg/sfu/connectionquality/connectionstats.go +++ b/pkg/sfu/connectionquality/connectionstats.go @@ -261,13 +261,13 @@ func (cs *ConnectionStats) updateScoreFromReceiverReport(at time.Time) (float32, // delta stat duration could be large due to not receiving receiver report for a long time (for example, due to mute), // adjust to streaming start if necessary - agg := toAggregateDeltaInfo(streams) if streamingStartedAt.After(cs.params.SenderProvider.GetLastReceiverReportTime()) { // last receiver report was before streaming started, wait for next one mos, _ := cs.scorer.GetMOSAndQuality() return mos, streams } + agg := toAggregateDeltaInfo(streams) if streamingStartedAt.After(agg.StartTime) { agg.StartTime = streamingStartedAt } diff --git a/pkg/sfu/downtrack.go b/pkg/sfu/downtrack.go index 77b1a8d65..f664fa7fa 100644 --- a/pkg/sfu/downtrack.go +++ b/pkg/sfu/downtrack.go @@ -1769,10 +1769,11 @@ func (d *DownTrack) handleRTCP(bytes []byte) { } if len(rr.Reports) > 0 { d.listenerLock.RLock() - for _, l := range d.receiverReportListeners { + rrListeners := d.receiverReportListeners + d.listenerLock.RUnlock() + for _, l := range rrListeners { l(d, rr) } - d.listenerLock.RUnlock() } case *rtcp.TransportLayerNack: diff --git a/pkg/sfu/rtpstats/rtpstats_sender.go b/pkg/sfu/rtpstats/rtpstats_sender.go index ab4799c8b..ad483fdd3 100644 --- a/pkg/sfu/rtpstats/rtpstats_sender.go +++ b/pkg/sfu/rtpstats/rtpstats_sender.go @@ -881,8 +881,9 @@ func (r *RTPStatsSender) getSenderSnapshot(startTime time.Time, s *senderSnapsho packetsDuplicate: r.packetsDuplicate, bytesDuplicate: r.bytesDuplicate, headerBytesDuplicate: r.headerBytesDuplicate, - packetsLostFeed: r.packetsLost, packetsOutOfOrder: s.packetsOutOfOrder + s.intervalStats.packetsOutOfOrder, + packetsLostFeed: r.packetsLost, + packetsLost: r.packetsLostFromRR, frames: s.frames + s.intervalStats.frames, nacks: r.nacks, plis: r.plis,