SVC with RID -> spatial layer mapping (#3754)

* SVC with RID -> spatial layer mapping

There are cases where an SVC track comes in with a RID.
As there is no RID announced in SDP, it maps to invalid layer.
Seems to happen with older browsers.

* test
This commit is contained in:
Raja Subramanian authored and GitHub committed 2025-06-23 12:45:13 -07:00
1 parent c481396f5b
commit 01bf96855d
3 files changed
+29 -7

No files matched your search

+13
View File
@@ -351,6 +351,19 @@ func GetSpatialLayerForRid(rid string, ti *livekit.TrackInfo) int32 {
if len(ti.Layers) == 1 {
// single layer without RID
return 0
} else if len(ti.Layers) > 1 {
// RID present in codec, but not specified via signalling
// (happens with older browsers setting a rid for SVC codecs)
hasRid := false
for _, layer := range ti.Layers {
if layer.Rid != "" {
hasRid = true
break
}
}
if !hasRid {
return 0
}
}
return InvalidLayerSpatial