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:
Raja Subramanian
2023-02-08 11:28:32 +05:30
committed by GitHub
parent 5161dba873
commit a1338b149c
2 changed files with 3 additions and 2 deletions
+1 -1
View File
@@ -746,7 +746,7 @@ func (f *Forwarder) AllocateOptimal(brs Bitrates, allowOvershoot bool) VideoAllo
} else {
// opportunisitically latch on to anything
alloc.targetLayers = VideoLayers{
Spatial: DefaultMaxLayerSpatial,
Spatial: int32(math.Max(0, float64(f.numAdvertisedLayers-1))),
Temporal: DefaultMaxLayerTemporal,
}
}