Commit 5a91a7aa authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Reset remote connection if SetRemoteDescription fails.

In current versions of pion, SetRemoteDescription fails if ICE is
currently gathering.  Work around the issue by resetting the connection.
parent e0a81e7f
......@@ -463,7 +463,7 @@ func gotOffer(c *webClient, id string, offer webrtc.SessionDescription, renegoti
delUpConn(c, id)
}
up, _, err := addUpConn(c, id)
up, isnew, err := addUpConn(c, id)
if err != nil {
return err
}
......@@ -473,6 +473,11 @@ func gotOffer(c *webClient, id string, offer webrtc.SessionDescription, renegoti
}
err = up.pc.SetRemoteDescription(offer)
if err != nil {
if renegotiate && !isnew {
// create a new PC from scratch
log.Printf("SetRemoteDescription(offer): %v", err)
return gotOffer(c, id, offer, false, labels)
}
return err
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment