Make a config option to skip unmanaged tracks in bandwidth estimation (#2050)
* WIP commit * Make a config option to skip unmanaged tracks in bandwidth estimation
This commit is contained in:
@@ -499,6 +499,22 @@ func (s *StreamAllocator) OnActiveChanged(isActive bool) {
|
||||
}
|
||||
}
|
||||
|
||||
// called to check if track should participate in BWE
|
||||
func (s *StreamAllocator) IsBWEEnabled(downTrack *sfu.DownTrack) bool {
|
||||
if !s.params.Config.DisableEstimationUnmanagedTracks {
|
||||
return true
|
||||
}
|
||||
|
||||
s.videoTracksMu.Lock()
|
||||
defer s.videoTracksMu.Unlock()
|
||||
|
||||
if track := s.videoTracks[livekit.TrackID(downTrack.ID())]; track != nil {
|
||||
return track.IsManaged()
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
func (s *StreamAllocator) maybePostEventAllocateTrack(downTrack *sfu.DownTrack) {
|
||||
shouldPost := false
|
||||
s.videoTracksMu.Lock()
|
||||
@@ -1097,7 +1113,9 @@ func (s *StreamAllocator) allocateAllTracks() {
|
||||
updateStreamStateChange(track, allocation, update)
|
||||
|
||||
// STREAM-ALLOCATOR-TODO: optimistic allocation before bitrate is available will return 0. How to account for that?
|
||||
availableChannelCapacity -= allocation.BandwidthRequested
|
||||
if !s.params.Config.DisableEstimationUnmanagedTracks {
|
||||
availableChannelCapacity -= allocation.BandwidthRequested
|
||||
}
|
||||
}
|
||||
|
||||
if availableChannelCapacity < 0 {
|
||||
|
||||
Reference in New Issue
Block a user