Add PropagationDelay API to sender report data (#2646)
This commit is contained in:
@@ -117,12 +117,21 @@ type RTCPSenderReportData struct {
|
||||
AtAdjusted time.Time
|
||||
}
|
||||
|
||||
func (r *RTCPSenderReportData) PropagationDelay() time.Duration {
|
||||
return r.AtAdjusted.Sub(r.NTPTimestamp.Time())
|
||||
}
|
||||
|
||||
func (r *RTCPSenderReportData) ToString() string {
|
||||
if r == nil {
|
||||
return ""
|
||||
}
|
||||
|
||||
return fmt.Sprintf("ntp: %s, rtp: %d, extRtp: %d, at: %s, atAdj: %s", r.NTPTimestamp.Time().String(), r.RTPTimestamp, r.RTPTimestampExt, r.At.String(), r.AtAdjusted.String())
|
||||
return fmt.Sprintf("ntp: %s, rtp: %d, extRtp: %d, at: %s, atAdj: %s",
|
||||
r.NTPTimestamp.Time().String(),
|
||||
r.RTPTimestamp,
|
||||
r.RTPTimestampExt,
|
||||
r.At.String(), r.AtAdjusted.String(),
|
||||
)
|
||||
}
|
||||
|
||||
func (r *RTCPSenderReportData) MarshalLogObject(e zapcore.ObjectEncoder) error {
|
||||
|
||||
@@ -772,7 +772,7 @@ func (d *DownTrack) WriteRTP(extPkt *buffer.ExtPacket, layer int32) error {
|
||||
_, _, refSenderReport := d.forwarder.GetSenderReportParams()
|
||||
if refSenderReport != nil {
|
||||
actExtCopy := *extPkt.AbsCaptureTimeExt
|
||||
if err = actExtCopy.Rewrite(refSenderReport.AtAdjusted.Sub(refSenderReport.NTPTimestamp.Time())); err == nil {
|
||||
if err = actExtCopy.Rewrite(refSenderReport.PropagationDelay()); err == nil {
|
||||
actBytes, err = actExtCopy.Marshal()
|
||||
if err == nil {
|
||||
extensions = append(
|
||||
|
||||
Reference in New Issue
Block a user