Handle case of layer stop with out bitrate. (#1448)

Missed this in the last commit. Sorry.
The case of
- locking to a layer
- that layer stops
- re-allocation

This should trigger a key frame request to the max available layer.
So, have to set the request layer to max available.
This commit is contained in:
Raja Subramanian
2023-02-20 14:49:32 +05:30
committed by GitHub
parent c51d083016
commit d1ce60192c
2 changed files with 4 additions and 2 deletions
+3 -1
View File
@@ -582,11 +582,13 @@ func (f *Forwarder) AllocateOptimal(availableLayers []int32, brs Bitrates, allow
} }
} }
alloc.targetLayers.Temporal = DefaultMaxLayerTemporal alloc.targetLayers.Temporal = DefaultMaxLayerTemporal
alloc.requestLayerSpatial = alloc.targetLayers.Spatial
} else { } else {
// opportunistically latch on to anything // opportunistically latch on to anything
opportunisticAlloc() opportunisticAlloc()
alloc.requestLayerSpatial = int32(math.Min(float64(f.maxLayers.Spatial), float64(f.maxPublishedLayer)))
} }
alloc.requestLayerSpatial = int32(math.Min(float64(f.maxLayers.Spatial), float64(f.maxPublishedLayer)))
} }
if !alloc.targetLayers.IsValid() { if !alloc.targetLayers.IsValid() {
+1 -1
View File
@@ -370,7 +370,7 @@ func TestForwarderAllocateOptimal(t *testing.T) {
bandwidthDelta: 0, bandwidthDelta: 0,
bitrates: emptyBitrates, bitrates: emptyBitrates,
targetLayers: expectedTargetLayers, targetLayers: expectedTargetLayers,
requestLayerSpatial: 0, requestLayerSpatial: 1,
maxLayers: expectedMaxLayers, maxLayers: expectedMaxLayers,
distanceToDesired: 0, distanceToDesired: 0,
} }