Move UpdateTrackInfo into MediaTrackReceiver (#329)

This commit is contained in:
Raja Subramanian
2022-01-10 19:07:21 +05:30
committed by GitHub
parent 02eb21c2ce
commit d6deb6cfa4
2 changed files with 12 additions and 1 deletions
+1 -1
View File
@@ -111,7 +111,7 @@ func (t *MediaTrack) SdpCid() string {
}
func (t *MediaTrack) ToProto() *livekit.TrackInfo {
info := t.params.TrackInfo
info := t.MediaTrackReceiver.TrackInfo()
info.Muted = t.IsMuted()
info.Simulcast = t.IsSimulcast()
layers := t.MediaTrackReceiver.GetVideoLayers()
+11
View File
@@ -194,6 +194,17 @@ func (t *MediaTrackReceiver) AddSubscriber(sub types.Participant) error {
return nil
}
func (t *MediaTrackReceiver) UpdateTrackInfo(ti *livekit.TrackInfo) {
t.params.TrackInfo = ti
if ti != nil && t.Kind() == livekit.TrackType_VIDEO {
t.UpdateVideoLayers(ti.Layers)
}
}
func (t *MediaTrackReceiver) TrackInfo() *livekit.TrackInfo {
return t.params.TrackInfo
}
func (t *MediaTrackReceiver) UpdateVideoLayers(layers []*livekit.VideoLayer) {
for _, layer := range layers {
t.layerDimensions.Store(layer.Quality, layer)