Log received sender report of audio for debugging (#1673)
* Log received sender report of audio for debugging * log OWD also * add some more bits
This commit is contained in:
+32
-11
@@ -750,15 +750,27 @@ func (r *RTPStats) SetRtcpSenderReportData(srData *RTCPSenderReportData) {
|
|||||||
if r.srDataExt != nil {
|
if r.srDataExt != nil {
|
||||||
smoothedOwd = r.srDataExt.SmoothedOWD
|
smoothedOwd = r.srDataExt.SmoothedOWD
|
||||||
}
|
}
|
||||||
|
smoothedOwd = (owd + smoothedOwd) / 2
|
||||||
|
// TODO-REMOVE-AFTER-DEBUG
|
||||||
|
if r.params.ClockRate != 90000 { // log only for audio as it is less frequent
|
||||||
|
r.logger.Debugw(
|
||||||
|
"received sender report",
|
||||||
|
"ntp", srData.NTPTimestamp.Time(),
|
||||||
|
"rtp", srData.RTPTimestamp,
|
||||||
|
"arrival", srData.ArrivalTime,
|
||||||
|
"owd", owd,
|
||||||
|
"smoothedOwd", smoothedOwd,
|
||||||
|
)
|
||||||
|
}
|
||||||
r.srDataExt = &RTCPSenderReportDataExt{
|
r.srDataExt = &RTCPSenderReportDataExt{
|
||||||
SenderReportData: *srData,
|
SenderReportData: *srData,
|
||||||
SmoothedOWD: (owd + smoothedOwd) / 2,
|
SmoothedOWD: smoothedOwd,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *RTPStats) GetRtcpSenderReportDataExt() *RTCPSenderReportDataExt {
|
func (r *RTPStats) GetRtcpSenderReportDataExt() *RTCPSenderReportDataExt {
|
||||||
r.lock.Lock()
|
r.lock.RLock()
|
||||||
defer r.lock.Unlock()
|
defer r.lock.RUnlock()
|
||||||
|
|
||||||
if r.srDataExt == nil {
|
if r.srDataExt == nil {
|
||||||
return nil
|
return nil
|
||||||
@@ -815,9 +827,14 @@ func (r *RTPStats) GetRtcpSenderReport(ssrc uint32, srDataExt *RTCPSenderReportD
|
|||||||
} else {
|
} else {
|
||||||
highestTime := time.Unix(0, r.highestTime)
|
highestTime := time.Unix(0, r.highestTime)
|
||||||
ntpTime := nowNTP.Time()
|
ntpTime := nowNTP.Time()
|
||||||
ntpDiff := ntpTime.Sub(highestTime)
|
|
||||||
rtpDiff := int32(nowRTP - r.highestTS)
|
ntpDiffLocal := ntpTime.Sub(highestTime)
|
||||||
rtpOffset := int32(nowRTP - r.highestTS - uint32(ntpDiff.Nanoseconds()*int64(r.params.ClockRate)/1e9))
|
rtpDiffLocal := int32(nowRTP - r.highestTS)
|
||||||
|
rtpOffsetLocal := int32(nowRTP - r.highestTS - uint32(ntpDiffLocal.Nanoseconds()*int64(r.params.ClockRate)/1e9))
|
||||||
|
|
||||||
|
ntpDiffSmoothed := ntpTime.Sub(smoothedLocalTimeOfLatestSenderReportNTP)
|
||||||
|
rtpDiffSmoothed := int32(nowRTP - srDataExt.SenderReportData.RTPTimestamp)
|
||||||
|
rtpOffsetSmoothed := int32(nowRTP - srDataExt.SenderReportData.RTPTimestamp - uint32(ntpDiffSmoothed.Nanoseconds()*int64(r.params.ClockRate)/1e9))
|
||||||
|
|
||||||
timeSinceFirst := nowNTP.Time().Sub(r.firstSenderReportNTP.Time())
|
timeSinceFirst := nowNTP.Time().Sub(r.firstSenderReportNTP.Time())
|
||||||
rtpDiffSinceFirst := getExtTS(nowRTP, r.tsCycles) - getExtTS(r.firstSenderReportRTP, 0)
|
rtpDiffSinceFirst := getExtTS(nowRTP, r.tsCycles) - getExtTS(r.firstSenderReportRTP, 0)
|
||||||
@@ -831,14 +848,18 @@ func (r *RTPStats) GetRtcpSenderReport(ssrc uint32, srDataExt *RTCPSenderReportD
|
|||||||
feedDriftTime := (float64(feedDrift) * 1000) / float64(r.params.ClockRate)
|
feedDriftTime := (float64(feedDrift) * 1000) / float64(r.params.ClockRate)
|
||||||
|
|
||||||
r.logger.Debugw(
|
r.logger.Debugw(
|
||||||
"sender report",
|
"sending sender report",
|
||||||
"highestTS", r.highestTS,
|
"highestTS", r.highestTS,
|
||||||
"reportTS", nowRTP,
|
|
||||||
"rtpDiff", rtpDiff,
|
|
||||||
"highestTime", highestTime,
|
"highestTime", highestTime,
|
||||||
|
"smoothedTime", smoothedLocalTimeOfLatestSenderReportNTP,
|
||||||
|
"reportTS", nowRTP,
|
||||||
"reportTime", ntpTime,
|
"reportTime", ntpTime,
|
||||||
"timeDiff", ntpDiff,
|
"rtpDiffLocal", rtpDiffLocal,
|
||||||
"rtpOffset", rtpOffset,
|
"ntpDiffLocal", ntpDiffLocal,
|
||||||
|
"rtpOffsetLocal", rtpOffsetLocal,
|
||||||
|
"rtpDiffSmoothed", rtpDiffSmoothed,
|
||||||
|
"ntpDiffSmoothed", ntpDiffSmoothed,
|
||||||
|
"rtpOffsetSmoothed", rtpOffsetSmoothed,
|
||||||
"timeSinceFirst", timeSinceFirst,
|
"timeSinceFirst", timeSinceFirst,
|
||||||
"rtpDiffSinceFirst", rtpDiffSinceFirst,
|
"rtpDiffSinceFirst", rtpDiffSinceFirst,
|
||||||
"drift", drift,
|
"drift", drift,
|
||||||
|
|||||||
@@ -1459,6 +1459,7 @@ func (f *Forwarder) getTranslationParamsCommon(extPkt *buffer.ExtPacket, layer i
|
|||||||
// log jumps greater than 0.5 seconds
|
// log jumps greater than 0.5 seconds
|
||||||
f.logger.Debugw("reference timestamp too far ahead", "lastTS", last.LastTS, "refTS", refTS, "td", td)
|
f.logger.Debugw("reference timestamp too far ahead", "lastTS", last.LastTS, "refTS", refTS, "td", td)
|
||||||
}
|
}
|
||||||
|
f.logger.Debugw("reference timestamp on switch", "lastTS", last.LastTS, "refTS", refTS, "td", int32(td), "switchingAt", time.Now())
|
||||||
} else {
|
} else {
|
||||||
f.logger.Debugw("reference timestamp get error, using default", "error", err)
|
f.logger.Debugw("reference timestamp get error, using default", "error", err)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user