mirror of
https://github.com/livekit/livekit.git
synced 2026-03-31 00:15:38 +00:00
* WIP commit * WIP commit * Remove debug * Revert to reduce diff * Fix tests * Determine spatial layer from track info quality if non-simulcast * Adjust for invalid layer on no rid, previously that function was returning 0 for no rid case * Fall back to top level width/height if there are no layers * Use duration from RTPDeltaInfo
34 lines
617 B
Go
34 lines
617 B
Go
package utils
|
|
|
|
import (
|
|
"github.com/livekit/protocol/livekit"
|
|
)
|
|
|
|
func SpatialLayerForQuality(quality livekit.VideoQuality) int32 {
|
|
switch quality {
|
|
case livekit.VideoQuality_LOW:
|
|
return 0
|
|
case livekit.VideoQuality_MEDIUM:
|
|
return 1
|
|
case livekit.VideoQuality_HIGH:
|
|
return 2
|
|
case livekit.VideoQuality_OFF:
|
|
return -1
|
|
default:
|
|
return -1
|
|
}
|
|
}
|
|
|
|
func QualityForSpatialLayer(layer int32) livekit.VideoQuality {
|
|
switch layer {
|
|
case 0:
|
|
return livekit.VideoQuality_LOW
|
|
case 1:
|
|
return livekit.VideoQuality_MEDIUM
|
|
case 2:
|
|
return livekit.VideoQuality_HIGH
|
|
default:
|
|
return livekit.VideoQuality_OFF
|
|
}
|
|
}
|