fix: skip RTX/FEC when picking a fallback video codec (#4930)

selectAlternativeVideoCodec walked the enabled codecs and returned the
first one with a video/ prefix. video/rtx and video/flexfec-03 both have
that prefix, so when the requested codec was not enabled the track could
fall back to RTX. RTX is a retransmission stream, not a real codec, so
the track got registered as video/rtx and subscribers saw a blank tile.

Skip RTX and FEC entries so the fallback is always a valid video codec.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Raja Subramanian
2026-10-04 21:20:28 +05:30
committed by GitHub
co-authored by Claude Opus 4.8
parent edb19c9e8f
commit c2339b2b85
3 changed files with 53 additions and 0 deletions
+4
View File
@@ -162,6 +162,10 @@ func isCodecEnabledWithFmtp(codecs []*livekit.Codec, cap webrtc.RTPCodecCapabili
func selectAlternativeVideoCodec(enabledCodecs []*livekit.Codec) string {
for _, c := range enabledCodecs {
// RTX and FEC are not real codecs, skip them
if mime.IsMimeTypeStringRTX(c.Mime) || mime.IsMimeTypeStringFlexFEC03(c.Mime) {
continue
}
if mime.IsMimeTypeStringVideo(c.Mime) {
return c.Mime
}