Option to disable traffic load tracking. (#2698)

This commit is contained in:
Raja Subramanian
2024-05-02 19:09:12 +05:30
committed by GitHub
parent 2792e7e834
commit 674550ea16
3 changed files with 20 additions and 6 deletions
+11 -6
View File
@@ -140,6 +140,7 @@ type ParticipantParams struct {
SubscriptionLimitVideo int32
PlayoutDelay *livekit.PlayoutDelay
SyncStreams bool
EnableTrafficLoadTracking bool
}
type ParticipantImpl struct {
@@ -868,7 +869,9 @@ func (p *ParticipantImpl) Close(sendLeave bool, reason types.ParticipantCloseRea
go func() {
p.SubscriptionManager.Close(isExpectedToResume)
p.TransportManager.Close()
p.ParticipantTrafficLoad.Close()
if p.ParticipantTrafficLoad != nil {
p.ParticipantTrafficLoad.Close()
}
}()
p.dataChannelStats.Stop()
@@ -1383,11 +1386,13 @@ func (p *ParticipantImpl) setupSubscriptionManager() {
}
func (p *ParticipantImpl) setupParticipantTrafficLoad() {
p.ParticipantTrafficLoad = NewParticipantTrafficLoad(ParticipantTrafficLoadParams{
Participant: p,
DataChannelStats: p.dataChannelStats,
Logger: p.params.Logger,
})
if p.params.EnableTrafficLoadTracking {
p.ParticipantTrafficLoad = NewParticipantTrafficLoad(ParticipantTrafficLoadParams{
Participant: p,
DataChannelStats: p.dataChannelStats,
Logger: p.params.Logger,
})
}
}
func (p *ParticipantImpl) updateState(state livekit.ParticipantInfo_State) {