Add API to restart lite stats. (#4366)

This commit is contained in:
Raja Subramanian
2026-03-16 15:20:13 +05:30
committed by GitHub
parent c8bb2578be
commit 750d5904f0
+25 -2
View File
@@ -460,6 +460,10 @@ func (b *BufferBase) setupRTPStats(clockRate uint32) {
b.deltaStatsSnapshotId = b.rtpStats.NewSnapshotId()
}
b.setupRTPStatsLite(clockRate)
}
func (b *BufferBase) setupRTPStatsLite(clockRate uint32) {
if b.params.IsOOBSequenceNumber {
b.rtpStatsLite = rtpstats.NewRTPStatsReceiverLite(rtpstats.RTPStatsParams{})
b.rtpStatsLite.SetLogger(b.logger)
@@ -474,21 +478,40 @@ func (b *BufferBase) stopRTPStats(reason string) (stats *livekit.RTPStats, stats
b.rtpStats.Stop()
stats = b.rtpStats.ToProto()
}
b.logger.Debugw(
"rtp stats",
"direction", "upstream",
"stats", b.rtpStats,
"reason", reason,
)
statsLite = b.stopRTPStatsLite(reason)
return
}
func (b *BufferBase) stopRTPStatsLite(reason string) (statsLite *livekit.RTPStats) {
if b.rtpStatsLite != nil {
b.rtpStatsLite.Stop()
statsLite = b.rtpStatsLite.ToProto()
}
b.logger.Debugw(
"rtp stats",
"rtp stats lite",
"direction", "upstream",
"stats", b.rtpStats,
"statsLite", b.rtpStatsLite,
"reason", reason,
)
return
}
func (b *BufferBase) RestartStatsLite(reason string) {
b.Lock()
defer b.Unlock()
b.stopRTPStatsLite(reason)
b.setupRTPStatsLite(b.clockRate)
}
func (b *BufferBase) MarkForRestartStream(reason string) {
b.logger.Debugw("marking for stream restart", "reason", reason)