Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to ice restart?

I am developing a voice chatting app based on webRTC using android libjingle.I want to reconnect users by using ice restart when they change their network from wifi to 4g or vice versa, or are disconnected. I have a question about implementing it by using libjingle. I will write down how to implement ice restart function based on what I understood so let me know there is anything wrong.

Q: As I understand, at first I need to set ice start option to be true in the MediaConstraints option without removing peer connection 객체 used for the first connection like below:

mediaConstraints.optional.add(new MediaConstraints.KeyValuePair("IceRestart", "true"));

Secondly, I need to update MediaConstrants using the peer connection 객체(used for the first connection)'s updateIce method like below:

peerConnection.updateIce(iceServers, mediaConstraints);

And finally is it right to send an offer, which is the same with basic webrtc network?

  • I want to double check whether I understand well. And if there is something wrong in what I've written, please let me know!!
like image 458
Hiroo Avatar asked Nov 08 '17 09:11

Hiroo


1 Answers

For doing ice restart, sender should send SDP file with different ice-pwd or ice-ufrag. IceRestart option forces PeerConnection to update those values.

Steps should be:

  1. Put additional constraint: cons.mandatory.add(new MediaConstraints.KeyValuePair("IceRestart", "true"));
  2. Generate sdp file: pc.createOffer(new WebRtcObserver(callbacks), cons);
  3. Set resulted sdp to PeerConnection: pc.setLocalDescription(new WebRtcObserver(callbacks), sdp);
  4. Send it to remote peer.

So steps 2-4 are the same as for regular offer.

like image 109
V.Poddubchak Avatar answered Oct 16 '22 11:10

V.Poddubchak