From 19e6909cbb2a40343efc7cb960cc8450e7b2a330 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Mon, 17 May 2021 11:00:34 -0700 Subject: [PATCH] fix restarting ICE log --- pkg/rtc/transport.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/pkg/rtc/transport.go b/pkg/rtc/transport.go index 5a10a419a..24237d139 100644 --- a/pkg/rtc/transport.go +++ b/pkg/rtc/transport.go @@ -172,14 +172,16 @@ func (t *PCTransport) CreateAndSendOffer(options *webrtc.OfferOptions) error { iceRestart := options != nil && options.ICERestart // if restart is requested, and we are not ready, then continue afterwards - if iceRestart && t.pc.ICEGatheringState() == webrtc.ICEGatheringStateGathering { - logger.Debugw("restart ICE after gathering") - t.restartAfterGathering.Store(true) - return nil + if iceRestart { + if t.pc.ICEGatheringState() == webrtc.ICEGatheringStateGathering { + logger.Debugw("restart ICE after gathering") + t.restartAfterGathering.Store(true) + return nil + } + logger.Debugw("restarting ICE") } state := t.negotiationState.Load().(int) - logger.Debugw("restarting ICE") // when there's an ongoing negotiation, let it finish and not disrupt its state if state == negotiationStateClient {