Add API to restart lite stats. (#4366)
This commit is contained in:
@@ -460,6 +460,10 @@ func (b *BufferBase) setupRTPStats(clockRate uint32) {
|
|||||||
b.deltaStatsSnapshotId = b.rtpStats.NewSnapshotId()
|
b.deltaStatsSnapshotId = b.rtpStats.NewSnapshotId()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
b.setupRTPStatsLite(clockRate)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (b *BufferBase) setupRTPStatsLite(clockRate uint32) {
|
||||||
if b.params.IsOOBSequenceNumber {
|
if b.params.IsOOBSequenceNumber {
|
||||||
b.rtpStatsLite = rtpstats.NewRTPStatsReceiverLite(rtpstats.RTPStatsParams{})
|
b.rtpStatsLite = rtpstats.NewRTPStatsReceiverLite(rtpstats.RTPStatsParams{})
|
||||||
b.rtpStatsLite.SetLogger(b.logger)
|
b.rtpStatsLite.SetLogger(b.logger)
|
||||||
@@ -474,21 +478,40 @@ func (b *BufferBase) stopRTPStats(reason string) (stats *livekit.RTPStats, stats
|
|||||||
b.rtpStats.Stop()
|
b.rtpStats.Stop()
|
||||||
stats = b.rtpStats.ToProto()
|
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 {
|
if b.rtpStatsLite != nil {
|
||||||
b.rtpStatsLite.Stop()
|
b.rtpStatsLite.Stop()
|
||||||
statsLite = b.rtpStatsLite.ToProto()
|
statsLite = b.rtpStatsLite.ToProto()
|
||||||
}
|
}
|
||||||
|
|
||||||
b.logger.Debugw(
|
b.logger.Debugw(
|
||||||
"rtp stats",
|
"rtp stats lite",
|
||||||
"direction", "upstream",
|
"direction", "upstream",
|
||||||
"stats", b.rtpStats,
|
|
||||||
"statsLite", b.rtpStatsLite,
|
"statsLite", b.rtpStatsLite,
|
||||||
"reason", reason,
|
"reason", reason,
|
||||||
)
|
)
|
||||||
return
|
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) {
|
func (b *BufferBase) MarkForRestartStream(reason string) {
|
||||||
b.logger.Debugw("marking for stream restart", "reason", reason)
|
b.logger.Debugw("marking for stream restart", "reason", reason)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user