ICE questions like: when should local ICE candidates be sent to remote?

310 views
Skip to first unread message

Andres Gonzalez

unread,
Jan 8, 2016, 9:20:11 PM1/8/16
to discuss-webrtc
Hi,

I have seen some examples where, for the local RTCPeerConnection, the local ICE candidates are sent to the remote as they are being received inside the RTCPeerConnection.onicecandidate() callback. I have also seen examples of the local Offer SDP where all of the local ICE candidates are appended to the bottom of the Offer SDP. 

Considering a case where the local agent is receive only (is not sending any streams to the remote), when should the local Offer be sent to the remote? That is, should I append each local ICE candidate to the local Offer SDP as they are coming in (in the onicecandidate callback) and then send the complete local Offer to the remote end?   Or should I send the local Offer SDP to the remote agent when I get it (in the createOffer success callback) and separately send each local ICE candidate to the remote agent as they come in (in the onicecandidate callback)?

If appending each ICE candidate to the local Offer before sending the complete Offer to the remote, how do I know when I have received the LAST local ICE candidate?  Currently I am receiving 4 local ICE candidates.  Will I always get 4?  I tried different values of  iceCandidatePoolSize property of the RTCPeerConnection configuration but that did not change the number of ICE candidates I receive.

Thanks,

-Andres


Philipp Hancke

unread,
Jan 9, 2016, 12:25:47 AM1/9/16
to discuss...@googlegroups.com
2016-01-09 3:20 GMT+01:00 Andres Gonzalez <andres.a...@gmail.com>:
Hi,

I have seen some examples where, for the local RTCPeerConnection, the local ICE candidates are sent to the remote as they are being received inside the RTCPeerConnection.onicecandidate() callback. I have also seen examples of the local Offer SDP where all of the local ICE candidates are appended to the bottom of the Offer SDP. 

That is called "trickle ice". https://webrtchacks.com/trickle-ice/ -- both are valid.
 
Considering a case where the local agent is receive only (is not sending any streams to the remote), when should the local Offer be sent to the remote? That is, should I append each local ICE candidate to the local Offer SDP as they are coming in (in the onicecandidate callback) and then send the complete local Offer to the remote end?   Or should I send the local Offer SDP to the remote agent when I get it (in the createOffer success callback) and separately send each local ICE candidate to the remote agent as they come in (in the onicecandidate callback)?

 Trickling candidates is usually faster.
 
If appending each ICE candidate to the local Offer before sending the complete Offer to the remote, how do I know when I have received the LAST local ICE candidate?  Currently I am receiving 4 local ICE candidates.  Will I always get 4?  I tried different values of  iceCandidatePoolSize property of the RTCPeerConnection configuration but that did not change the number of ICE candidates I receive.

onicecandidate will be called with event.candidate unset when all local candidates have been gathered. At that point, you can loop at the peerconnections localDescription.sdp to get the SDP including the candidates. No need to manually append them.
 
Thanks,

-Andres


--

---
You received this message because you are subscribed to the Google Groups "discuss-webrtc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrt...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/discuss-webrtc/8be26b54-ec2a-4990-a51d-53bb670fcdb5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages