diff --git a/config-sample.yaml b/config-sample.yaml index 55f6de2e5..dd7ce5868 100644 --- a/config-sample.yaml +++ b/config-sample.yaml @@ -32,8 +32,8 @@ rtc: # max_bitrate: 3145728 # # number of packets to buffer in the SFU, defaults to 500 # packet_buffer_size: 500 -# # optional stun servers to use. by default LiveKit uses Google's public STUN servers -# # LiveKit will automatically configure connected clients to use the same STUN servers +# # optional STUN servers for LiveKit clients to use. Clients will be configured to use these STUN servers automatically. +# # by default LiveKit clients use Google's public STUN servers # stun_servers: # - server1 # # minimum amount of time between pli/fir rtcp packets being sent to an individual diff --git a/pkg/rtc/config.go b/pkg/rtc/config.go index 307a0c986..dd52c0209 100644 --- a/pkg/rtc/config.go +++ b/pkg/rtc/config.go @@ -2,7 +2,6 @@ package rtc import ( "errors" - "fmt" "net" "syscall" @@ -47,15 +46,6 @@ func NewWebRTCConfig(conf *config.Config, externalIP string) (*WebRTCConfig, err loggerFactory := logging.NewDefaultLoggerFactory() lkLogger := loggerFactory.NewLogger("livekit-mux") - iceUrls := make([]string, 0) - for _, stunServer := range rtcConf.StunServers { - iceUrls = append(iceUrls, fmt.Sprintf("stun:%s", stunServer)) - } - c.ICEServers = []webrtc.ICEServer{ - { - URLs: iceUrls, - }, - } if rtcConf.UseExternalIP && externalIP != "" { s.SetNAT1To1IPs([]string{externalIP}, webrtc.ICECandidateTypeHost) } @@ -74,6 +64,7 @@ func NewWebRTCConfig(conf *config.Config, externalIP string) (*WebRTCConfig, err var udpMux *ice.UDPMuxDefault var udpMuxConn *net.UDPConn var err error + if rtcConf.UDPPort != 0 { udpMuxConn, err = net.ListenUDP("udp4", &net.UDPAddr{ Port: int(rtcConf.UDPPort), diff --git a/pkg/rtc/participant.go b/pkg/rtc/participant.go index 8e1bba288..b2ca0bd04 100644 --- a/pkg/rtc/participant.go +++ b/pkg/rtc/participant.go @@ -851,7 +851,8 @@ func (p *ParticipantImpl) handlePublisherICEStateChange(state webrtc.ICEConnecti // "participant", p.identity) if state == webrtc.ICEConnectionStateConnected { p.updateState(livekit.ParticipantInfo_ACTIVE) - } else if state == webrtc.ICEConnectionStateDisconnected || state == webrtc.ICEConnectionStateFailed { + } else if state == webrtc.ICEConnectionStateFailed { + // only close when failed, to allow clients opportunity to reconnect go func() { _ = p.Close() }() diff --git a/pkg/rtc/participant_internal_test.go b/pkg/rtc/participant_internal_test.go index 537ca650d..1e5ac8ec5 100644 --- a/pkg/rtc/participant_internal_test.go +++ b/pkg/rtc/participant_internal_test.go @@ -54,7 +54,7 @@ func TestICEStateChange(t *testing.T) { p.onClose = func(participant types.Participant) { close(closeChan) } - p.handlePublisherICEStateChange(webrtc.ICEConnectionStateDisconnected) + p.handlePublisherICEStateChange(webrtc.ICEConnectionStateFailed) select { case <-closeChan: