Defer setting clock rate in RTPStats module till codec is bound. (#4250)

With audio simulcast codecs, it is possible that the clock rate of the
primary codec is different from the secondary codec. If a subscriber
binds to the secondary codec, the clock rate should be set correctly. Do
it at bind time.
This commit is contained in:
Raja Subramanian
2026-01-15 22:08:50 +05:30
committed by GitHub
parent d9f716c14a
commit aea044c5cb
8 changed files with 105 additions and 65 deletions
+6 -8
View File
@@ -444,10 +444,9 @@ func (b *BufferBase) SetStreamRestartDetection(enable bool) {
}
func (b *BufferBase) setupRTPStats(clockRate uint32) {
b.rtpStats = rtpstats.NewRTPStatsReceiver(rtpstats.RTPStatsParams{
ClockRate: clockRate,
Logger: b.logger,
})
b.rtpStats = rtpstats.NewRTPStatsReceiver(rtpstats.RTPStatsParams{})
b.rtpStats.SetClockRate(clockRate)
b.ppsSnapshotId = b.rtpStats.NewSnapshotId()
if b.params.IsReportingEnabled {
b.rrSnapshotId = b.rtpStats.NewSnapshotId()
@@ -455,10 +454,9 @@ func (b *BufferBase) setupRTPStats(clockRate uint32) {
}
if b.params.IsOOBSequenceNumber {
b.rtpStatsLite = rtpstats.NewRTPStatsReceiverLite(rtpstats.RTPStatsParams{
ClockRate: clockRate,
Logger: b.logger,
})
b.rtpStatsLite = rtpstats.NewRTPStatsReceiverLite(rtpstats.RTPStatsParams{})
b.rtpStatsLite.SetClockRate(clockRate)
b.liteStatsSnapshotId = b.rtpStatsLite.NewSnapshotLiteId()
}
}