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 {
|
if f.provisional.muted || f.provisional.pubMuted {
|
||||||
f.provisional.allocatedLayer = buffer.InvalidLayer
|
f.provisional.allocatedLayer = buffer.InvalidLayer
|
||||||
return VideoTransition{
|
return VideoTransition{
|
||||||
From: f.vls.GetTarget(),
|
From: existingTargetLayer,
|
||||||
To: f.provisional.allocatedLayer,
|
To: f.provisional.allocatedLayer,
|
||||||
BandwidthDelta: -getBandwidthNeeded(f.provisional.Bitrates, existingTargetLayer, f.lastAllocation.BandwidthRequested),
|
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()
|
f.lock.Lock()
|
||||||
defer f.lock.Unlock()
|
defer f.lock.Unlock()
|
||||||
|
|
||||||
|
existingTargetLayer := f.vls.GetTarget()
|
||||||
|
if !existingTargetLayer.IsValid() {
|
||||||
|
// already paused
|
||||||
|
return f.lastAllocation
|
||||||
|
}
|
||||||
|
|
||||||
maxLayer := f.vls.GetMax()
|
maxLayer := f.vls.GetMax()
|
||||||
maxSeenLayer := f.vls.GetMaxSeen()
|
maxSeenLayer := f.vls.GetMaxSeen()
|
||||||
optimalBandwidthNeeded := getOptimalBandwidthNeeded(f.muted, f.pubMuted, maxSeenLayer.Spatial, brs, maxLayer)
|
optimalBandwidthNeeded := getOptimalBandwidthNeeded(f.muted, f.pubMuted, maxSeenLayer.Spatial, brs, maxLayer)
|
||||||
alloc := VideoAllocation{
|
alloc := VideoAllocation{
|
||||||
BandwidthRequested: 0,
|
BandwidthRequested: 0,
|
||||||
BandwidthDelta: 0 - getBandwidthNeeded(brs, f.vls.GetTarget(), f.lastAllocation.BandwidthRequested),
|
BandwidthDelta: 0 - getBandwidthNeeded(brs, existingTargetLayer, f.lastAllocation.BandwidthRequested),
|
||||||
Bitrates: brs,
|
Bitrates: brs,
|
||||||
BandwidthNeeded: optimalBandwidthNeeded,
|
BandwidthNeeded: optimalBandwidthNeeded,
|
||||||
TargetLayer: buffer.InvalidLayer,
|
TargetLayer: buffer.InvalidLayer,
|
||||||
|
|||||||
@@ -883,8 +883,8 @@ func (s *StreamAllocator) allocateTrack(track *Track) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// already streaming at some layer and transition is not requesting any change, i. e. BandwidthDelta == 0
|
// a no-op transition
|
||||||
if transition.From.IsValid() && transition.BandwidthDelta == 0 {
|
if transition.From == transition.To {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user