Do not use local time stamp when sending RTCP Sender Report (#1315)

* some additional logging

* Do not use local time stamp when sending RTCP Sender Report

As local time does not take into account the transmission delay
of publisher side sender report, using local time to calculate
offset is not accurate.

Calculate NTP time stamp based on difference in RTP time.
Notes in code about some shortcomings of this, but should
get better RTT numbers. I think RTT numbers were bloated because of
using local time stamp.
This commit is contained in:
Raja Subramanian
2023-01-19 23:32:50 +05:30
committed by GitHub
parent e31b25300d
commit b7263b7625
2 changed files with 53 additions and 27 deletions
+6 -1
View File
@@ -1409,7 +1409,7 @@ func (f *Forwarder) getTranslationParamsCommon(extPkt *buffer.ExtPacket, layer i
last := f.rtpMunger.GetLast()
td = refTS - last.LastTS
if td > (1 << 31) {
f.logger.Infow("reference timestamp out-of-order", "lastTS", last.LastTS, "refTS", refTS, "td", td)
f.logger.Infow("reference timestamp out-of-order", "lastTS", last.LastTS, "refTS", refTS, "td", int32(td))
td = 0 // reset to force arrival time based calculation
}
}
@@ -1424,6 +1424,11 @@ func (f *Forwarder) getTranslationParamsCommon(extPkt *buffer.ExtPacket, layer i
if td == 0 {
td = 1
}
f.logger.Infow(
"timestamp adjustment using arrival time",
"tDiffMsOrig", (extPkt.Arrival-f.lTSCalc)/1e6, "tDiffMsAdjusted", tDiffMs,
"tdOrig", uint32(tDiffMs*int64(f.codec.ClockRate)/1000), "tdAdjusted", td,
)
}
f.rtpMunger.UpdateSnTsOffsets(extPkt, 1, td)