Add a flag to pass through timestamp. (#2714)
* Add a flag to psss through timestamp. Can make it a config later if needed. * log both adjusted and non-adjusted
This commit is contained in:
@@ -31,6 +31,8 @@ const (
|
|||||||
cSnInfoMask = cSnInfoSize - 1
|
cSnInfoMask = cSnInfoSize - 1
|
||||||
|
|
||||||
cSenderReportInitialWait = time.Second
|
cSenderReportInitialWait = time.Second
|
||||||
|
|
||||||
|
cPassthroughNTPTimestamp = true
|
||||||
)
|
)
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
@@ -645,10 +647,19 @@ func (r *RTPStatsSender) GetRtcpSenderReport(ssrc uint32, publisherSRData *RTCPS
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
timeSincePublisherSR := time.Since(publisherSRData.AtAdjusted)
|
timeSincePublisherSRAdjusted := time.Since(publisherSRData.AtAdjusted)
|
||||||
now := publisherSRData.AtAdjusted.Add(timeSincePublisherSR)
|
now := publisherSRData.AtAdjusted.Add(timeSincePublisherSRAdjusted)
|
||||||
nowNTP := mediatransportutil.ToNtpTime(now)
|
var (
|
||||||
nowRTPExt := publisherSRData.RTPTimestampExt - tsOffset + uint64(timeSincePublisherSR.Nanoseconds()*int64(r.params.ClockRate)/1e9)
|
nowNTP mediatransportutil.NtpTime
|
||||||
|
nowRTPExt uint64
|
||||||
|
)
|
||||||
|
if cPassthroughNTPTimestamp {
|
||||||
|
nowNTP = publisherSRData.NTPTimestamp
|
||||||
|
nowRTPExt = publisherSRData.RTPTimestampExt - tsOffset
|
||||||
|
} else {
|
||||||
|
nowNTP = mediatransportutil.ToNtpTime(now)
|
||||||
|
nowRTPExt = publisherSRData.RTPTimestampExt - tsOffset + uint64(timeSincePublisherSRAdjusted.Nanoseconds()*int64(r.params.ClockRate)/1e9)
|
||||||
|
}
|
||||||
|
|
||||||
srData := &RTCPSenderReportData{
|
srData := &RTCPSenderReportData{
|
||||||
NTPTimestamp: nowNTP,
|
NTPTimestamp: nowNTP,
|
||||||
@@ -666,13 +677,15 @@ func (r *RTPStatsSender) GetRtcpSenderReport(ssrc uint32, publisherSRData *RTCPS
|
|||||||
"feed", publisherSRData,
|
"feed", publisherSRData,
|
||||||
"tsOffset", tsOffset,
|
"tsOffset", tsOffset,
|
||||||
"timeNow", time.Now().String(),
|
"timeNow", time.Now().String(),
|
||||||
|
"now", now.String(),
|
||||||
"extStartTS", r.extStartTS,
|
"extStartTS", r.extStartTS,
|
||||||
"extHighestTS", r.extHighestTS,
|
"extHighestTS", r.extHighestTS,
|
||||||
"highestTime", r.highestTime.String(),
|
"highestTime", r.highestTime.String(),
|
||||||
"timeSinceHighest", now.Sub(r.highestTime).String(),
|
"timeSinceHighest", now.Sub(r.highestTime).String(),
|
||||||
"firstTime", r.firstTime.String(),
|
"firstTime", r.firstTime.String(),
|
||||||
"timeSinceFirst", now.Sub(r.firstTime).String(),
|
"timeSinceFirst", now.Sub(r.firstTime).String(),
|
||||||
"timeSincePublisherSR", timeSincePublisherSR.String(),
|
"timeSincePublisherSRAdjusted", timeSincePublisherSRAdjusted.String(),
|
||||||
|
"timeSincePublisherSR", time.Since(publisherSRData.At).String(),
|
||||||
"nowRTPExt", nowRTPExt,
|
"nowRTPExt", nowRTPExt,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user