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:
Raja Subramanian
2023-09-08 20:59:58 +05:30
committed by GitHub
parent b95670f56b
commit 83353d821c
3 changed files with 57 additions and 14 deletions
+19 -1
View File
@@ -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 {