Inconsistent Ice candidate generation.

185 views
Skip to first unread message

Yan Hong

unread,
Jun 20, 2014, 6:41:41 AM6/20/14
to discuss...@googlegroups.com
Hi,

Here's what I have implemented so far:
1) Peer A creates an offer, sets its local description, and then sends the offer to to Peer B
2) Peer B sets its remote description, creates an answer, sets its local description, and then sends the answer to peer A 
3) Peer A sets its remote description and then calls the function containing the onicecandidate handler to trigger ice candidate gathering. These ice candidates are sent to Peer B
4) Peer B adds the ice candidates from Peer A until it encounters a null ice candidate (indicating that Peer A is done ice gathering). When Peer B receives a null ice candidate from Peer A, it then calls a function containing the onicecandidate handler to trigger ice candidate gathering.These ice candidates are sent to Peer A.
5) Peer A adds the ice candidates from Peer B.

For testing, I open two tabs open in Chrome 35.0.1916.153 with my signaling server listening on 127.0.0.1.

TEST #1) When I test the above implementation out using just one ice server (stun.l.google.com:19302), Peer A is always able to generate non-null ice candidates but peer B always generates only one, null ice candidate and no non-null ice candidates. Steps 1, 2, and 3 are working properly -- I checked the peerconnection object of both peers and confirmed that their local and remote descriptions are right. Part of step 4 works -- Peer B adds all of Peer A's ice candidates and after it does so, it begins the ice gathering process but is only able to find one ice candidate -- a null ice candidate and no non-null ice candidates.  The iceconnectionstate for Peer B stays stuck at "checking" while for Peer A it stays stuck at "new". The icegathering state for Peer B stays stuck at "gathering" while for Peer A it stays stuck at "complete".

TEST #2) When I test the above implementation out after adding TURN server (numb.viagenie.ca), the above problem *sometimes* occur while other times the peerconnection between peer A and peer B is successful. Is this inconsistency normal? The above problem occurs more frequently than successful peer connections. 

I tried apprtc.appspot.com and it works consistently for me.

I don't really understand what I'm doing wrong here. Any ideas? I attached my javascript file which isn't very long. Thanks.
client.js

Yan Hong

unread,
Jun 20, 2014, 2:39:10 PM6/20/14
to discuss...@googlegroups.com
Nevermind, I fixed it. Turns out I'm supposed to start sending ICE candidates right after setting local description. Works fine now.
Reply all
Reply to author
Forward
0 new messages