Do not re-pause a paused track. (#2037)

This commit is contained in:
Raja Subramanian
2023-09-06 08:27:16 +05:30
committed by GitHub
parent 9b9298b927
commit c122c20f49
2 changed files with 10 additions and 4 deletions
+8 -2
View File
@@ -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,
+2 -2
View File
@@ -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
}