Populate simulcast codec layers. (#2334)

Previously, it was done on read. Missed populating it on write
in the TrackInfo consolidation effort.

Fix by populating layers when adding pending track itself.
As all codecs will have same layers, clone the top level layers and add
it all codecs.
This commit is contained in:
Raja Subramanian authored and GitHub committed 2023-12-21 18:52:49 +05:30
1 parent a4888fcf8f
commit 4c1047d8c3
1 file changed
+6
+6
View File
@@ -1670,9 +1670,15 @@ func (p *ParticipantImpl) addPendingTrackLocked(req *livekit.AddTrackRequest) *l
continue
}
seenCodecs[mime] = struct{}{}
clonedLayers := make([]*livekit.VideoLayer, 0, len(req.Layers))
for _, l := range req.Layers {
clonedLayers = append(clonedLayers, proto.Clone(l).(*livekit.VideoLayer))
}
ti.Codecs = append(ti.Codecs, &livekit.SimulcastCodecInfo{
MimeType: mime,
Cid: codec.Cid,
Layers: clonedLayers,
})
}