mirror of
https://github.com/livekit/livekit.git
synced 2026-08-14 07:09:48 +00:00
Option to disable traffic load tracking. (#2698)
This commit is contained in:
+11
-6
@@ -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) {
|
||||
|
||||
@@ -62,6 +62,10 @@ func (p *ParticipantTrafficLoad) Close() {
|
||||
}
|
||||
|
||||
func (p *ParticipantTrafficLoad) OnTrafficLoad(f func(trafficLoad *types.TrafficLoad)) {
|
||||
if p == nil {
|
||||
return
|
||||
}
|
||||
|
||||
p.lock.Lock()
|
||||
p.onTrafficLoad = f
|
||||
p.lock.Unlock()
|
||||
@@ -75,6 +79,10 @@ func (p *ParticipantTrafficLoad) getOnTrafficLoad() func(trafficLoad *types.Traf
|
||||
}
|
||||
|
||||
func (p *ParticipantTrafficLoad) GetTrafficLoad() *types.TrafficLoad {
|
||||
if p == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
p.lock.RLock()
|
||||
defer p.lock.RUnlock()
|
||||
|
||||
|
||||
@@ -530,6 +530,7 @@ func (r *rtpStatsBase) maybeAdjustFirstPacketTime(srData *RTCPSenderReportData,
|
||||
"extNowTS", extNowTS,
|
||||
"extStartTS", extStartTS,
|
||||
"srData", srData,
|
||||
"tsOffset", tsOffset,
|
||||
"timeSinceReceive", timeSinceReceive.String(),
|
||||
"timeSinceFirst", timeSinceFirst.String(),
|
||||
"samplesDiff", samplesDiff,
|
||||
|
||||
Reference in New Issue
Block a user