Support for video dimensions in publications (#36)

* send back video dimensions

* Store video dimensions in MediaTrack and forward in TrackInfo

* use committed protocol
This commit is contained in:
David Zhao
2021-06-18 21:05:56 -07:00
committed by GitHub
parent 515b1f0f7e
commit 38c81e5645
14 changed files with 157 additions and 49 deletions
+12 -1
View File
@@ -46,7 +46,7 @@ func (t *SubscribedTrack) SetPublisherMuted(muted bool) {
func (t *SubscribedTrack) SetVideoQuality(quality livekit.VideoQuality) {
if t.dt.Kind() == webrtc.RTPCodecTypeVideo {
t.dt.SwitchSpatialLayer(int64(quality), true)
t.dt.SwitchSpatialLayer(spatialLayerForQuality(quality), true)
}
}
@@ -54,3 +54,14 @@ func (t *SubscribedTrack) updateDownTrackMute() {
muted := t.subMuted.Get() || t.pubMuted.Get()
t.dt.Mute(muted)
}
func spatialLayerForQuality(quality livekit.VideoQuality) int64 {
switch quality {
case livekit.VideoQuality_LOW:
return 0
case livekit.VideoQuality_MEDIUM:
return 1
default:
return 2
}
}