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
+11 -1
View File
@@ -464,11 +464,21 @@ func (d *DownTrack) Bind(t webrtc.TrackLocalContext) (webrtc.RTPCodecParameters,
matchedUpstreamCodec = c matchedUpstreamCodec = c
break break
} else { } 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 { if d.params.IsEncrypted {
isRedAndOpus := true
for _, u := range d.upstreamCodecs {
if !mime.IsMimeTypeStringOpus(u.MimeType) || !mime.IsMimeTypeStringRED(u.MimeType) {
isRedAndOpus = false
break break
} }
} }
if isRedAndOpus {
break
}
}
}
} }
if codec.MimeType == "" { if codec.MimeType == "" {