mirror of
https://github.com/livekit/livekit.git
synced 2026-07-28 18:39:41 +00:00
Do not re-pause a paused track. (#2037)
This commit is contained in:
@@ -811,7 +811,7 @@ func (f *Forwarder) ProvisionalAllocateGetCooperativeTransition(allowOvershoot b
|
||||
if f.provisional.muted || f.provisional.pubMuted {
|
||||
f.provisional.allocatedLayer = buffer.InvalidLayer
|
||||
return VideoTransition{
|
||||
From: f.vls.GetTarget(),
|
||||
From: existingTargetLayer,
|
||||
To: f.provisional.allocatedLayer,
|
||||
BandwidthDelta: -getBandwidthNeeded(f.provisional.Bitrates, existingTargetLayer, f.lastAllocation.BandwidthRequested),
|
||||
}
|
||||
@@ -1300,12 +1300,18 @@ func (f *Forwarder) Pause(availableLayers []int32, brs Bitrates) VideoAllocation
|
||||
f.lock.Lock()
|
||||
defer f.lock.Unlock()
|
||||
|
||||
existingTargetLayer := f.vls.GetTarget()
|
||||
if !existingTargetLayer.IsValid() {
|
||||
// already paused
|
||||
return f.lastAllocation
|
||||
}
|
||||
|
||||
maxLayer := f.vls.GetMax()
|
||||
maxSeenLayer := f.vls.GetMaxSeen()
|
||||
optimalBandwidthNeeded := getOptimalBandwidthNeeded(f.muted, f.pubMuted, maxSeenLayer.Spatial, brs, maxLayer)
|
||||
alloc := VideoAllocation{
|
||||
BandwidthRequested: 0,
|
||||
BandwidthDelta: 0 - getBandwidthNeeded(brs, f.vls.GetTarget(), f.lastAllocation.BandwidthRequested),
|
||||
BandwidthDelta: 0 - getBandwidthNeeded(brs, existingTargetLayer, f.lastAllocation.BandwidthRequested),
|
||||
Bitrates: brs,
|
||||
BandwidthNeeded: optimalBandwidthNeeded,
|
||||
TargetLayer: buffer.InvalidLayer,
|
||||
|
||||
@@ -883,8 +883,8 @@ func (s *StreamAllocator) allocateTrack(track *Track) {
|
||||
return
|
||||
}
|
||||
|
||||
// already streaming at some layer and transition is not requesting any change, i. e. BandwidthDelta == 0
|
||||
if transition.From.IsValid() && transition.BandwidthDelta == 0 {
|
||||
// a no-op transition
|
||||
if transition.From == transition.To {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user