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
2025-06-23 12:45:13 -07:00
committed by GitHub
parent c481396f5b
commit 01bf96855d
3 changed files with 29 additions and 7 deletions
+9
View File
@@ -43,6 +43,7 @@ var (
ErrDownTrackAlreadyExist = errors.New("DownTrack already exist")
ErrBufferNotFound = errors.New("buffer not found")
ErrDuplicateLayer = errors.New("duplicate layer")
ErrInvalidLayer = errors.New("invalid layer")
)
// --------------------------------------
@@ -384,6 +385,14 @@ func (w *WebRTCReceiver) AddUpTrack(track TrackRemote, buff *buffer.Buffer) erro
if w.Kind() == webrtc.RTPCodecTypeVideo && !w.isSVC {
layer = buffer.GetSpatialLayerForRid(track.RID(), w.trackInfo.Load())
}
if layer < 0 {
w.logger.Warnw(
"invalid layer", nil,
"rid", track.RID(),
"trackInfo", logger.Proto(w.trackInfo.Load()),
)
return ErrInvalidLayer
}
buff.SetLogger(w.logger.WithValues("layer", layer))
buff.SetAudioLevelParams(audio.AudioLevelParams{
Config: w.audioConfig.AudioLevelConfig,