Allow publishers to set layer availability (#51)

* support client message to update active layers

* update to match new protocol
This commit is contained in:
David Zhao
2021-07-13 21:35:08 -07:00
committed by GitHub
parent a3cfebec68
commit 850fecf931
4 changed files with 67 additions and 0 deletions
+12
View File
@@ -12,6 +12,7 @@ import (
"github.com/pion/rtcp"
"github.com/pion/webrtc/v3"
"github.com/pion/webrtc/v3/pkg/rtcerr"
"github.com/thoas/go-funk"
"github.com/livekit/livekit-server/pkg/config"
"github.com/livekit/livekit-server/pkg/logger"
@@ -105,6 +106,17 @@ func (t *MediaTrack) SetMuted(muted bool) {
t.lock.RUnlock()
}
func (t *MediaTrack) SetSimulcastLayers(layers []livekit.VideoQuality) {
t.lock.RLock()
defer t.lock.RUnlock()
if t.receiver != nil {
layers16 := funk.Map(layers, func(l livekit.VideoQuality) uint16 {
return uint16(spatialLayerForQuality(l))
}).([]uint16)
t.receiver.SetAvailableLayers(layers16)
}
}
func (t *MediaTrack) OnClose(f func()) {
t.onClose = f
}