From f34ec0ab66a86037e640447c3581b1214c4ec30d Mon Sep 17 00:00:00 2001 From: Juliusz Chroboczek Date: Tue, 2 Feb 2021 22:57:56 +0100 Subject: [PATCH] Don't hide mismatches in the PeerConnection state automaton. The previous behaviour led to silent failures, which was confusing. --- rtpconn/webclient.go | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/rtpconn/webclient.go b/rtpconn/webclient.go index 4ae264a..345290f 100644 --- a/rtpconn/webclient.go +++ b/rtpconn/webclient.go @@ -569,16 +569,12 @@ func gotAnswer(c *webClient, id string, sdp string) error { return ErrUnknownId } - if down.pc.SignalingState() == webrtc.SignalingStateStable { - log.Printf("Got answer in stable state -- this shouldn't happen") - } else { - err := down.pc.SetRemoteDescription(webrtc.SessionDescription{ - Type: webrtc.SDPTypeAnswer, - SDP: sdp, - }) - if err != nil { - return err - } + err := down.pc.SetRemoteDescription(webrtc.SessionDescription{ + Type: webrtc.SDPTypeAnswer, + SDP: sdp, + }) + if err != nil { + return err } for _, t := range down.tracks { @@ -590,7 +586,7 @@ func gotAnswer(c *webClient, id string, sdp string) error { } } - err := down.flushICECandidates() + err = down.flushICECandidates() if err != nil { log.Printf("ICE: %v", err) }