diff --git a/pkg/rtc/participant.go b/pkg/rtc/participant.go index 5fba3fec..93e3c118 100644 --- a/pkg/rtc/participant.go +++ b/pkg/rtc/participant.go @@ -982,7 +982,7 @@ func (p *ParticipantImpl) handlePrimaryStateChange(state webrtc.PeerConnectionSt p.SetMigrateState(types.MigrateStateComplete) } p.incActiveCounter() - } else if state == webrtc.PeerConnectionStateDisconnected { + } else if state == webrtc.PeerConnectionStateFailed { // clients support resuming of connections when websocket becomes disconnected p.closeSignalConnection() @@ -1018,7 +1018,7 @@ func (p *ParticipantImpl) handlePrimaryStateChange(state webrtc.PeerConnectionSt // for the secondary peer connection, we still need to handle when they become disconnected // instead of allowing them to silently fail. func (p *ParticipantImpl) handleSecondaryStateChange(state webrtc.PeerConnectionState) { - if state == webrtc.PeerConnectionStateDisconnected { + if state == webrtc.PeerConnectionStateFailed { // clients support resuming of connections when websocket becomes disconnected p.closeSignalConnection() } diff --git a/pkg/rtc/transport.go b/pkg/rtc/transport.go index 9c8597fc..bb2468b6 100644 --- a/pkg/rtc/transport.go +++ b/pkg/rtc/transport.go @@ -28,6 +28,10 @@ import ( const ( negotiationFrequency = 150 * time.Millisecond dtlsRetransmissionInterval = 100 * time.Millisecond + + iceDisconnectedTimeout = 10 * time.Second // compatible for ice-lite with firefox client + iceFailedTimeout = 25 * time.Second // pion's default + iceKeepaliveInterval = 2 * time.Second // pion's default ) const ( @@ -113,6 +117,7 @@ func newPeerConnection(params TransportParams, onBandwidthEstimator func(estimat se.SetLite(false) } se.SetDTLSRetransmissionInterval(dtlsRetransmissionInterval) + se.SetICETimeouts(iceDisconnectedTimeout, iceFailedTimeout, iceKeepaliveInterval) lf := serverlogger.NewLoggerFactory(logr.Logger(params.Logger)) if lf != nil {