Limit layer to num advertised. (#1395)
* Limit layer to num advertised. Otherwise, this leads to invalid layer for non-simulcast tracks. * need to subtrack 1 * fix test
This commit is contained in:
@@ -746,7 +746,7 @@ func (f *Forwarder) AllocateOptimal(brs Bitrates, allowOvershoot bool) VideoAllo
|
|||||||
} else {
|
} else {
|
||||||
// opportunisitically latch on to anything
|
// opportunisitically latch on to anything
|
||||||
alloc.targetLayers = VideoLayers{
|
alloc.targetLayers = VideoLayers{
|
||||||
Spatial: DefaultMaxLayerSpatial,
|
Spatial: int32(math.Max(0, float64(f.numAdvertisedLayers-1))),
|
||||||
Temporal: DefaultMaxLayerTemporal,
|
Temporal: DefaultMaxLayerTemporal,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -197,10 +197,11 @@ func TestForwarderAllocateOptimal(t *testing.T) {
|
|||||||
f.Mute(false)
|
f.Mute(false)
|
||||||
|
|
||||||
// feed dry state, target set to maximum for opportunistic start
|
// feed dry state, target set to maximum for opportunistic start
|
||||||
|
f.SetNumAdvertisedLayers(3)
|
||||||
f.lastAllocation.state = VideoAllocationStateNone
|
f.lastAllocation.state = VideoAllocationStateNone
|
||||||
disable(f)
|
disable(f)
|
||||||
expectedTargetLayers := VideoLayers{
|
expectedTargetLayers := VideoLayers{
|
||||||
Spatial: DefaultMaxLayerSpatial,
|
Spatial: 2,
|
||||||
Temporal: DefaultMaxLayerTemporal,
|
Temporal: DefaultMaxLayerTemporal,
|
||||||
}
|
}
|
||||||
expectedResult = VideoAllocation{
|
expectedResult = VideoAllocation{
|
||||||
|
|||||||
Reference in New Issue
Block a user