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:
co-authored by
Claude Opus 4.8
parent
edb19c9e8f
commit
c2339b2b85
@@ -73,6 +73,23 @@ func TestIsCodecEnabled(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
func TestSelectAlternativeVideoCodec(t *testing.T) {
|
||||
// RTX and FEC have the video/ prefix but are not real codecs. The fallback must skip them.
|
||||
t.Run("skips rtx and fec, picks real codec", func(t *testing.T) {
|
||||
enabled := []*livekit.Codec{
|
||||
{Mime: mime.MimeTypeRTX.String()},
|
||||
{Mime: mime.MimeTypeFlexFEC03.String()},
|
||||
{Mime: mime.MimeTypeH264.String()},
|
||||
}
|
||||
require.Equal(t, mime.MimeTypeH264.String(), selectAlternativeVideoCodec(enabled))
|
||||
})
|
||||
|
||||
t.Run("falls back to vp8 when only rtx is enabled", func(t *testing.T) {
|
||||
enabled := []*livekit.Codec{{Mime: mime.MimeTypeRTX.String()}}
|
||||
require.Equal(t, mime.MimeTypeVP8.String(), selectAlternativeVideoCodec(enabled))
|
||||
})
|
||||
}
|
||||
|
||||
type offeredCodec struct {
|
||||
payloadType webrtc.PayloadType
|
||||
name string
|
||||
|
||||
Reference in New Issue
Block a user