Change lock scope of access to RTCP sender report data. (#1473)

* Change lock scope of access to RTCP sender report data.

Forwarder calls back to get time stamp offset.
Holding buffer lock is a much bigger scoped lock.

Reduce lock scope and cache latest sender report under its own lock.
And use that cache when calculating time stamp offset.

* move sr cache to stream tracker manager for re-use in relay

* cache before spread
This commit is contained in:
Raja Subramanian
2023-02-27 12:28:25 +05:30
committed by GitHub
parent 207c97c4b9
commit 8e6bcdaffe
4 changed files with 77 additions and 56 deletions
+3 -3
View File
@@ -690,14 +690,14 @@ func (r *RTPStats) SetRtcpSenderReportData(srData *RTCPSenderReportData) {
return
}
// Low pass filter one-way-delay (owd) to normalize time stamp to local time base when sending RTCP sender report.
// Forwarding RTCP sender report would be ideal. But, there are a couple of issues with that
// Low pass filter one-way-delay (owd) to normalize time stamp to local time base when sending RTCP Sender Report.
// Forwarding RTCP Sender Report would be ideal. But, there are a couple of issues with that
// 1. Senders could have different clocks.
// 2. Adjusting to current time as required by RTCP spec.
// By normalizing to local clock, these issues can be addressed. However, normalization is not straightforward
// as it is not possible to know the propagation delay and processing delay at both ends (send side processing
// after time stamping the RTCP packet and receive side processing after reading packet off the wire).
// Smoothed version of OWD is used to
// Smoothed version of OWD is used to alleviate irregularities somewhat.
owd := srData.ArrivalTime.Sub(srData.NTPTimestamp.Time())
if r.srDataExt != nil {
prevOwd := r.srDataExt.SenderReportData.ArrivalTime.Sub(r.srDataExt.SenderReportData.NTPTimestamp.Time())