Limit check to red + opus when looking for primary codec match. (#3988)

For codec regression, even if track is encrypted, should be able to fall
back to a backup codec and trigger a regression.
This commit is contained in:
Raja Subramanian
2025-10-07 23:28:26 +05:30
committed by GitHub
parent a87f6c4bc8
commit 4f6ed65d61
+12 -2
View File
@@ -464,9 +464,19 @@ func (d *DownTrack) Bind(t webrtc.TrackLocalContext) (webrtc.RTPCodecParameters,
matchedUpstreamCodec = c
break
} else {
// for encrypyted tracks, should match on primary codec, i. e. codec at index 0
// for encrypyted tracks, should match on primary codec,
// i. e. codec at index 0 if the combination of upstream codecs is opus and RED
if d.params.IsEncrypted {
break
isRedAndOpus := true
for _, u := range d.upstreamCodecs {
if !mime.IsMimeTypeStringOpus(u.MimeType) || !mime.IsMimeTypeStringRED(u.MimeType) {
isRedAndOpus = false
break
}
}
if isRedAndOpus {
break
}
}
}
}