Handle RED extended sequence number. (#2123)

When converting from RED -> Opus, if there is a loss, SFU recovers
that loss if it can using a subsequent redundant packet. That path
was not setting the extended sequence number properly.

Also, ensuring use of monotonic clock for first packet time adjustment
also.
This commit is contained in:
Raja Subramanian
2023-10-03 19:38:55 +05:30
committed by GitHub
parent 96ccf696d3
commit cb0a48c12d
3 changed files with 49 additions and 6 deletions
+2 -1
View File
@@ -474,7 +474,8 @@ func (r *rtpStatsBase) maybeAdjustFirstPacketTime(ets uint64, extStartTS uint64)
}
samplesDuration := time.Duration(float64(samplesDiff) / float64(r.params.ClockRate) * float64(time.Second))
now := time.Now()
timeSinceFirst := time.Since(r.firstTime)
now := r.firstTime.Add(timeSinceFirst)
firstTime := now.Add(-samplesDuration)
if firstTime.Before(r.firstTime) {
r.logger.Debugw(
+14
View File
@@ -281,10 +281,24 @@ func (r *RTPStatsSender) Update(
}
}
r.logger.Infow(
"adjusting start sequence number",
"snBefore", r.extStartSN,
"snAfter", extSequenceNumber,
"tsBefore", r.extStartTS,
"tsAfter", extTimestamp,
)
r.extStartSN = extSequenceNumber
}
if extTimestamp < r.extStartTS {
r.logger.Infow(
"adjusting start timestamp",
"snBefore", r.extStartSN,
"snAfter", extSequenceNumber,
"tsBefore", r.extStartTS,
"tsAfter", extTimestamp,
)
r.extStartTS = extTimestamp
}