diff --git a/go.mod b/go.mod index bc75e4ce..f73aa3b9 100644 --- a/go.mod +++ b/go.mod @@ -21,7 +21,7 @@ require ( github.com/jxskiss/base62 v1.1.0 github.com/livekit/mageutil v0.0.0-20250511045019-0f1ff63f7731 github.com/livekit/mediatransportutil v0.0.0-20260608063931-a3417d38cda0 - github.com/livekit/protocol v1.50.5-0.20260728075222-28e604c046c6 + github.com/livekit/protocol v1.50.5-0.20260804001616-e99ee7f1e62d github.com/livekit/psrpc v0.7.2 github.com/mackerelio/go-osstat v0.2.8 github.com/magefile/mage v1.17.2 @@ -77,7 +77,7 @@ require ( github.com/mattn/go-colorable v0.1.15 // indirect github.com/mattn/go-isatty v0.0.22 // indirect github.com/moby/moby/api v1.55.0 // indirect - github.com/nyaruka/phonenumbers v1.8.0 // indirect + github.com/nyaruka/phonenumbers v1.8.1 // indirect github.com/olekukonko/cat v0.0.0-20250911104152-50322a0618f6 // indirect github.com/olekukonko/errors v1.3.0 // indirect github.com/olekukonko/ll v0.1.8 // indirect diff --git a/go.sum b/go.sum index 3b7d805c..83bec71e 100644 --- a/go.sum +++ b/go.sum @@ -160,8 +160,8 @@ github.com/livekit/mageutil v0.0.0-20250511045019-0f1ff63f7731 h1:9x+U2HGLrSw5AT github.com/livekit/mageutil v0.0.0-20250511045019-0f1ff63f7731/go.mod h1:Rs3MhFwutWhGwmY1VQsygw28z5bWcnEYmS1OG9OxjOQ= github.com/livekit/mediatransportutil v0.0.0-20260608063931-a3417d38cda0 h1:XHNNzebIKZRkLimla/hFGrAIX5EMWHctrgt3hLw7s+I= github.com/livekit/mediatransportutil v0.0.0-20260608063931-a3417d38cda0/go.mod h1:o8CFmAdrVwzJNOCsQCLUzXRjokkufNshnQHOe4fRaqU= -github.com/livekit/protocol v1.50.5-0.20260728075222-28e604c046c6 h1:oavqDhmS2U5zFPs3S+jxTL6tEqsHxATxzfw3B/CKC+w= -github.com/livekit/protocol v1.50.5-0.20260728075222-28e604c046c6/go.mod h1:jO+y05AU9Ec4JswDyuzKCZ4bhziOS0CzMqgnbj60Dzs= +github.com/livekit/protocol v1.50.5-0.20260804001616-e99ee7f1e62d h1:MbG82yVhYsn/kxaqemCUvTC77gFhc81tbkGAhrm3f38= +github.com/livekit/protocol v1.50.5-0.20260804001616-e99ee7f1e62d/go.mod h1:DeGUkqNGJhLz16DOP3MfKrJtYn/1PiYfrQMsJb3rzDs= github.com/livekit/psrpc v0.7.2 h1:6oZ+NODJ2pLyaT6VqDq1F4Qc/3TpDUSpyphj/P9MhQc= github.com/livekit/psrpc v0.7.2/go.mod h1:rAI+m2+/cb4x9RXhLRtUx5ZwdfjjXOl4zi46IjEetaw= github.com/mackerelio/go-osstat v0.2.8 h1:I2duicTaCGWoM53XwAwA9OIe1inu0xnVs8/pqOWWVr4= @@ -211,8 +211,8 @@ github.com/nats-io/nkeys v0.4.16 h1:rd5oAuLOb8mnAycB0xleuEBNS1pVVnN0fv/FF34Eypg= github.com/nats-io/nkeys v0.4.16/go.mod h1:llLgWoI0o4z/Q57q2R1kHfmocyhGV6VG/U18Glg1Afs= github.com/nats-io/nuid v1.0.1 h1:5iA8DT8V7q8WK2EScv2padNa/rTESc1KdnPw4TC2paw= github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= -github.com/nyaruka/phonenumbers v1.8.0 h1:TrXNJmbwcAHajzDqin3mLWw57vqLUA6ZjVdeNds0heQ= -github.com/nyaruka/phonenumbers v1.8.0/go.mod h1:fsKPJ70O9JetEA4ggnJadYTFWwtGPvu/lETTXNXq6Cs= +github.com/nyaruka/phonenumbers v1.8.1 h1:2K9YMQuv1dCGqjjzB1DwmdCe89khT4KPBQb2CxAMMlU= +github.com/nyaruka/phonenumbers v1.8.1/go.mod h1:fsKPJ70O9JetEA4ggnJadYTFWwtGPvu/lETTXNXq6Cs= github.com/olekukonko/cat v0.0.0-20250911104152-50322a0618f6 h1:zrbMGy9YXpIeTnGj4EljqMiZsIcE09mmF8XsD5AYOJc= github.com/olekukonko/cat v0.0.0-20250911104152-50322a0618f6/go.mod h1:rEKTHC9roVVicUIfZK7DYrdIoM0EOr8mK1Hj5s3JjH0= github.com/olekukonko/errors v1.3.0 h1:teJvgLGUEqMzBUms+Dj3/3szNqCG/Jdw9iDbum8fR6U= diff --git a/pkg/rtc/mediaengine.go b/pkg/rtc/mediaengine.go index e3fc1ecd..8f44593f 100644 --- a/pkg/rtc/mediaengine.go +++ b/pkg/rtc/mediaengine.go @@ -66,6 +66,14 @@ func registerCodecs(me *webrtc.MediaEngine, codecs []*livekit.Codec, rtcpFeedbac codecsToRegister = append(codecsToRegister, codecToRegister{RTPCodecParameters: codec, strictFmtp: false}) } codecsToRegister = append(codecsToRegister, + codecToRegister{ + RTPCodecParameters: protoCodecs.H264ProfileLevelId42001fPacketizationMode0CodecParameters, + strictFmtp: true, + }, + codecToRegister{ + RTPCodecParameters: protoCodecs.H264ProfileLevelId42001fPacketizationMode1CodecParameters, + strictFmtp: true, + }, codecToRegister{ RTPCodecParameters: protoCodecs.H264ProfileLevelId4d001fPacketizationMode0CodecParameters, strictFmtp: true, diff --git a/pkg/rtc/mediaengine_test.go b/pkg/rtc/mediaengine_test.go index 79af78b8..0b742439 100644 --- a/pkg/rtc/mediaengine_test.go +++ b/pkg/rtc/mediaengine_test.go @@ -29,8 +29,10 @@ import ( ) const ( - h264MainProfilePacketizationMode0Fmtp = "level-asymmetry-allowed=1;packetization-mode=0;profile-level-id=4d001f" - h264MainProfilePacketizationMode1Fmtp = "level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=4d001f" + h264MainProfilePacketizationMode0Fmtp = "level-asymmetry-allowed=1;packetization-mode=0;profile-level-id=4d001f" + h264MainProfilePacketizationMode1Fmtp = "level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=4d001f" + h264BaselineProfilePacketizationMode0Fmtp = "level-asymmetry-allowed=1;packetization-mode=0;profile-level-id=42001f" + h264BaselineProfilePacketizationMode1Fmtp = "level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42001f" ) func TestIsCodecEnabled(t *testing.T) { @@ -148,31 +150,33 @@ func defaultEnabledCodecs() []*livekit.Codec { } func TestRegisterCodecsH264Profiles(t *testing.T) { - t.Run("baseline and constrained baseline are offered by default", func(t *testing.T) { + t.Run("constrained baseline are offered by default", func(t *testing.T) { codecs := offeredVideoCodecs(t, defaultEnabledCodecs(), false) for _, fmtp := range []string{ "level-asymmetry-allowed=1;packetization-mode=0;profile-level-id=42e01f", "level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f", - "level-asymmetry-allowed=1;packetization-mode=0;profile-level-id=42001f", - "level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42001f", "level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=640032", } { require.True(t, hasOfferedFmtp(codecs, mime.MimeTypeH264, fmtp), "missing %q in %v", fmtp, codecs) } }) - t.Run("main profile is not offered unless explicitly enabled", func(t *testing.T) { + t.Run("main/baseline profile is not offered unless explicitly enabled", func(t *testing.T) { codecs := offeredVideoCodecs(t, defaultEnabledCodecs(), false) require.False(t, hasOfferedFmtp(codecs, mime.MimeTypeH264, h264MainProfilePacketizationMode0Fmtp), "%v", codecs) require.False(t, hasOfferedFmtp(codecs, mime.MimeTypeH264, h264MainProfilePacketizationMode1Fmtp), "%v", codecs) + require.False(t, hasOfferedFmtp(codecs, mime.MimeTypeH264, h264BaselineProfilePacketizationMode0Fmtp), "%v", codecs) + require.False(t, hasOfferedFmtp(codecs, mime.MimeTypeH264, h264BaselineProfilePacketizationMode1Fmtp), "%v", codecs) }) - t.Run("main profile is offered when explicitly enabled", func(t *testing.T) { + t.Run("main/baseline profile is offered when explicitly enabled", func(t *testing.T) { for _, fmtp := range []string{ h264MainProfilePacketizationMode0Fmtp, h264MainProfilePacketizationMode1Fmtp, + h264BaselineProfilePacketizationMode0Fmtp, + h264BaselineProfilePacketizationMode1Fmtp, } { t.Run(fmtp, func(t *testing.T) { enabled := append(defaultEnabledCodecs(), &livekit.Codec{ @@ -194,7 +198,7 @@ func TestRegisterCodecsH264Profiles(t *testing.T) { // the other profiles survive the filter require.True(t, hasOfferedFmtp(codecs, mime.MimeTypeH264, - "level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42001f"), "%v", codecs) + "level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f"), "%v", codecs) }) }