mirror of
https://github.com/livekit/livekit.git
synced 2026-10-23 10:52:46 +00:00
Get next higher using bit rate. (#1960)
This commit is contained in:
1 parent
5c0a4beb61
commit
ce1fde451c
2 files changed
+12
-9
No files matched your search
@@ -852,24 +852,19 @@ func (s *StreamAllocator) allocateTrack(track *Track) {
|
||||
//
|
||||
// For both cases, do
|
||||
// a. Find cooperative transition from track that needs allocation.
|
||||
// b. If track is currently streaming at minimum, do not do anything.
|
||||
// c. If track is giving back bits, apply the transition and use bits given
|
||||
// b. If track is giving back bits, apply the transition and use bits given
|
||||
// back to boost any deficient track(s).
|
||||
//
|
||||
// If track needs more bits, i.e. upward transition (may need resume or higher layer subscription),
|
||||
// a. Try to allocate using existing headroom. This can be tried to get the best
|
||||
// possible fit for the available headroom.
|
||||
// b. If there is not enough headroom to allocate anything, ask for best offer from
|
||||
// other tracks that are currently streaming and try to use it.
|
||||
// other tracks that are currently streaming and try to use it. This is done only if the
|
||||
// track needing change is not currently streaming, i. e. it has to be resumed.
|
||||
//
|
||||
track.ProvisionalAllocatePrepare()
|
||||
transition := track.ProvisionalAllocateGetCooperativeTransition(FlagAllowOvershootWhileDeficient)
|
||||
|
||||
// track is currently streaming at minimum
|
||||
if transition.BandwidthDelta == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
// downgrade, giving back bits
|
||||
if transition.From.GreaterThan(transition.To) {
|
||||
allocation := track.ProvisionalAllocateCommit()
|
||||
@@ -928,6 +923,11 @@ func (s *StreamAllocator) allocateTrack(track *Track) {
|
||||
transition = track.ProvisionalAllocateGetCooperativeTransition(FlagAllowOvershootWhileDeficient) // get transition again to reset above allocation attempt using available headroom
|
||||
}
|
||||
|
||||
// track is currently streaming at minimum
|
||||
if transition.BandwidthDelta == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
// if there is not enough headroom, try to redistribute starting with tracks that are closest to their desired.
|
||||
bandwidthAcquired := int64(0)
|
||||
var contributingTracks []*Track
|
||||
|
||||
Reference in new issue
Block a user