Select highest layer of equal dimensions (#1841)

* Select highest layer of equal dimensions

* clean up test
This commit is contained in:
lukasIO
2023-07-03 17:32:28 +02:00
committed by GitHub
parent 869f23a054
commit 7e96c98dc3
2 changed files with 65 additions and 2 deletions
+4 -2
View File
@@ -681,11 +681,13 @@ func (t *MediaTrackReceiver) GetQualityForDimension(width, height uint32) liveki
})
}
// finds the lowest layer that could satisfy client demands
// finds the highest layer with smallest dimensions that still satisfy client demands
requestedSize = uint32(float32(requestedSize) * layerSelectionTolerance)
for i, s := range layerSizes {
quality = livekit.VideoQuality(i)
if s >= requestedSize {
if i == len(layerSizes)-1 {
break
} else if s >= requestedSize && s != layerSizes[i+1] {
break
}
}