From de102f32db94a0d050302978e702d8a4e627effb Mon Sep 17 00:00:00 2001 From: Raja Subramanian Date: Wed, 23 Oct 2024 21:30:52 +0530 Subject: [PATCH] Display both pairs on selected candidate pair change (#3133) * Display both pairs on selected canddiate pair change * disable ICE lite for Firefox --- pkg/rtc/transport.go | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/pkg/rtc/transport.go b/pkg/rtc/transport.go index a6db38c5f..fa54d3c5c 100644 --- a/pkg/rtc/transport.go +++ b/pkg/rtc/transport.go @@ -293,7 +293,11 @@ func newPeerConnection(params TransportParams, onBandwidthEstimator func(estimat // se.DisableSRTPReplayProtection(true) se.DisableSRTCPReplayProtection(true) - if !params.ProtocolVersion.SupportsICELite() { + if !params.ProtocolVersion.SupportsICELite() || !params.ClientInfo.SupportPrflxOverRelay() { + // if client don't support prflx over relay which is only Firefox, disable ICE Lite to ensure that + // dropping remote ICE candidates does not get enabled. Firefox does aggressive nomination and + // dropping remote ICE candidates means server would accept all switches and it could end up with + // the lower priority candidate. As Firefox does not support migration, ICE Lite can be disabled. se.SetLite(false) } se.SetDTLSRetransmissionInterval(dtlsRetransmissionInterval) @@ -473,8 +477,12 @@ func (t *PCTransport) createPeerConnection() error { t.pc.SCTP().Transport().ICETransport().OnSelectedCandidatePairChange(func(pair *webrtc.ICECandidatePair) { t.params.Logger.Debugw("selected ICE candidate pair changed", "pair", wrappedICECandidatePairLogger{pair}) t.connectionDetails.SetSelectedPair(pair) - if t.selectedPair.Load() != nil { - t.params.Logger.Infow("ice reconnected or switched pair", "pair", wrappedICECandidatePairLogger{pair}) + existingPair := t.selectedPair.Load() + if existingPair != nil { + t.params.Logger.Infow( + "ice reconnected or switched pair", + "existingPair", wrappedICECandidatePairLogger{existingPair}, + "newPair", wrappedICECandidatePairLogger{pair}) } t.selectedPair.Store(pair) })