Apply ICE preference when switching to TCP on unstable UDP (#4703)

onMediaLossUpdate notified the participant handler directly, which only
sends a leave request with resume action. handleConnectionFailed that
actually switches the ICE preference to TCP/TLS was never called on
this path, so the client reconnected over UDP again and the fallback
kept firing every 30-60s without ever migrating.

Fixes livekit/livekit#4702
This commit is contained in:
Nikita Davydov
2026-08-04 13:04:36 +05:30
committed by GitHub
parent 4d177cb01b
commit 2a9bb36ee0
+5
View File
@@ -976,6 +976,11 @@ func (t *TransportManager) onMediaLossUpdate(loss uint8) {
t.lock.Unlock()
t.params.Logger.Infow("udp connection unstable, switch to tcp", "signalingRTT", t.signalingRTT)
// switch ICE preference to TCP before asking the client to resume,
// the raw params handler only sends a leave request and does not
// reconfigure the transport, so the client would reconnect over UDP
// again and this path would keep firing
t.handleConnectionFailed(true)
if t.params.UseSinglePeerConnection {
t.params.PublisherHandler.OnFailed(true, t.publisher.GetICEConnectionInfo())
} else {