webrtc: fix crash in case of congestion (#3813) (#3815)

This commit is contained in:
Alessandro Ros
2024-09-29 09:56:06 +02:00
committed by GitHub
parent 9f83b57f74
commit 1e30dcb555
@@ -268,6 +268,14 @@ func (co *PeerConnection) Start() error {
switch state {
case webrtc.PeerConnectionStateConnected:
// for some reasons, PeerConnectionStateConnected can arrive twice.
// https://github.com/bluenviron/mediamtx/issues/3813
select {
case <-co.connected:
return
default:
}
co.Log.Log(logger.Info, "peer connection established, local candidate: %v, remote candidate: %v",
co.LocalCandidate(), co.RemoteCandidate())