fix firefox reconnect with ice-lite enabled (#565)

This commit is contained in:
cnderrauber
2022-03-24 17:38:44 +08:00
committed by GitHub
parent f293de054d
commit 61655c6ff0
2 changed files with 7 additions and 2 deletions
+2 -2
View File
@@ -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()
}
+5
View File
@@ -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 {