Add debug log for RTCP sender report. (#1890)

* Add debug log for RTCP sender report.

Temporary to collect more data. Hitting scenarios under congestion
where the sender report gets off sync. Need some data to pore through
and understand and implement changes.

* Debugw
This commit is contained in:
Raja Subramanian
2023-07-18 23:21:06 +05:30
committed by GitHub
parent f41b93657e
commit 66de9ff4a0
3 changed files with 43 additions and 1 deletions
+19
View File
@@ -944,6 +944,25 @@ func (r *RTPStats) GetRtcpSenderReport(ssrc uint32, calculatedClockRate uint32)
"nowRTPExt", nowRTPExt,
"nowRTPExtUsingRate", nowRTPExtUsingRate,
)
} else {
packetDriftResult, reportDriftResult := r.getDrift()
r.logger.Debugw(
"sending sender report",
"ntp", nowNTP.Time().String(),
"rtp", nowRTP,
"departure", now.String(),
"ntpDiffSinceLast", ntpDiffSinceLast.Seconds(),
"rtpDiffSinceLast", int32(rtpDiffSinceLast),
"departureDiffSinceLast", departureDiffSinceLast.Seconds(),
"expectedTimeDiffSinceLast", expectedTimeDiffSinceLast,
"packetDrift", packetDriftResult.String(),
"reportDrift", reportDriftResult.String(),
"highestTS", r.highestTS,
"highestTime", r.highestTime.String(),
"calculatedClockRate", calculatedClockRate,
"nowRTPExt", nowRTPExt,
"nowRTPExtUsingRate", nowRTPExtUsingRate,
)
}
return &rtcp.SenderReport{
+5 -1
View File
@@ -1165,7 +1165,11 @@ func (d *DownTrack) CreateSenderReport() *rtcp.SenderReport {
return nil
}
return d.rtpStats.GetRtcpSenderReport(d.ssrc, d.receiver.GetCalculatedClockRate(d.forwarder.CurrentLayer().Spatial))
clockLayer := d.forwarder.CurrentLayer().Spatial
if clockLayer == buffer.InvalidLayerSpatial {
clockLayer = d.forwarder.GetReferenceLayerSpatial()
}
return d.rtpStats.GetRtcpSenderReport(d.ssrc, d.receiver.GetCalculatedClockRate(clockLayer))
}
func (d *DownTrack) writeBlankFrameRTP(duration float32, generation uint32) chan struct{} {
+19
View File
@@ -529,6 +529,13 @@ func (f *Forwarder) GetMaxSubscribedSpatial() int32 {
return layer
}
func (f *Forwarder) GetReferenceLayerSpatial() int32 {
f.lock.RLock()
defer f.lock.RUnlock()
return f.referenceLayerSpatial
}
func (f *Forwarder) isDeficientLocked() bool {
return f.lastAllocation.IsDeficient
}
@@ -1970,6 +1977,18 @@ done:
if !targetLayer.IsValid() {
distance += (maxSeenLayer.Temporal + 1)
}
// TODO-REMOVE-AFTER-DEBUG
logger.Debugw(
"distance to desired",
"maxSeenLauer", maxSeenLayer,
"availableLayers", availableLayers,
"brs", brs,
"targetLayer", targetLayer,
"maxLayer", maxLayer,
"adjustedMaxLayer", adjustedMaxLayer,
"maxAvailableSpatial", maxAvailableSpatial,
"maxAvailableTemporal", maxAvailableTemporal,
)
return float64(distance) / float64(maxSeenLayer.Temporal+1)
}