From d731caa8dae010fe5c178bc2b90dedf2803729cb Mon Sep 17 00:00:00 2001 From: cnderrauber Date: Mon, 23 Nov 2026 12:49:03 +0800 Subject: [PATCH] Answer dtls server role for ice lite and full (#5260) Full ice also get benefit from this when warp is enabled. --- pkg/rtc/config.go | 3 --- pkg/rtc/transport.go | 4 +--- pkg/rtc/transport_test.go | 4 ++-- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/pkg/rtc/config.go b/pkg/rtc/config.go index 4b963070a..2c698f0af 100644 --- a/pkg/rtc/config.go +++ b/pkg/rtc/config.go @@ -38,7 +38,6 @@ type WebRTCConfig struct { Receiver ReceiverConfig Publisher DirectionConfig Subscriber DirectionConfig - ICELite bool flexFEC config.FlexFECConfig } @@ -103,14 +102,12 @@ func NewWebRTCConfig(conf *config.Config) (*WebRTCConfig, error) { }, Publisher: getPublisherConfig(false, flexFEC), Subscriber: subscriberConfig, - ICELite: rtcConf.UseICELite, flexFEC: flexFEC, }, nil } func (c *WebRTCConfig) DisableICELite() { c.SettingEngine.SetLite(false) - c.ICELite = false } func (c *WebRTCConfig) UpdatePublisherConfig(consolidated bool) { diff --git a/pkg/rtc/transport.go b/pkg/rtc/transport.go index 00fed305d..a5a10e8df 100644 --- a/pkg/rtc/transport.go +++ b/pkg/rtc/transport.go @@ -410,7 +410,6 @@ func newPeerConnection( // se.DisableSRTPReplayProtection(true) se.DisableSRTCPReplayProtection(true) - iceLite := params.Config.ICELite if !params.ProtocolVersion.SupportsICELite() || !params.ClientInfo.SupportsPrflxOverRelay() { // if client don't support prflx over relay which is only Firefox, disable ICE Lite to ensure that // aggressive nomination is handled properly. Firefox does aggressive nomination even if peer is @@ -420,9 +419,8 @@ func newPeerConnection( // ending up with different candidates. // As Firefox does not support migration, ICE Lite can be disabled. se.SetLite(false) - iceLite = false } - if iceLite && params.ClientInfo.SupportsAnswerDTLSRoleServer() { + if params.ClientInfo.SupportsAnswerDTLSRoleServer() { _ = se.SetAnsweringDTLSRole(webrtc.DTLSRoleServer) } // ICE checks already prove the remote address, so the HelloVerifyRequest cookie only adds a round trip. diff --git a/pkg/rtc/transport_test.go b/pkg/rtc/transport_test.go index 1ecb573a3..793e4f5c0 100644 --- a/pkg/rtc/transport_test.go +++ b/pkg/rtc/transport_test.go @@ -1158,13 +1158,13 @@ func TestAnsweringDTLSRole(t *testing.T) { expected sdp.ConnectionRole }{ {name: "ice lite", iceLite: true, clientInfo: sdkInfo(livekit.ClientInfo_JS), expected: sdp.ConnectionRolePassive}, - {name: "no ice lite", clientInfo: sdkInfo(livekit.ClientInfo_JS), expected: sdp.ConnectionRoleActive}, + {name: "no ice lite", clientInfo: sdkInfo(livekit.ClientInfo_JS), expected: sdp.ConnectionRolePassive}, {name: "unknown sdk", iceLite: true, clientInfo: ClientInfo{}, expected: sdp.ConnectionRoleActive}, {name: "esp32", iceLite: true, clientInfo: sdkInfo(livekit.ClientInfo_ESP32), expected: sdp.ConnectionRoleActive}, } for _, c := range cases { t.Run(c.name, func(t *testing.T) { - conf := &WebRTCConfig{ICELite: c.iceLite} + conf := &WebRTCConfig{} conf.SettingEngine.SetLite(c.iceLite) answerer, err := NewPCTransport(TransportParams{ Config: conf,