ice candidate iceGatheringState complete

757 views
Skip to first unread message

Bryan Paluch

unread,
Feb 12, 2013, 4:30:53 PM2/12/13
to discuss...@googlegroups.com
I noticed that in Canary 26.0.1410.0 that webkitRTCPeerConnection.onicecandidate callbacks no long emit events that are missing the candidate object to notify the app that candidate gathering is complete. 

I've started using this to detect gathering complete:
var pc = new webkitRTCPeerConnection(pc_config, pc_constraints);

pc.onicecandidate = this._onIceCandidate;

pc.ongatheringchange = function(event){
  if(event.currentTarget.iceGatheringState === "complete"){
    console.log("Ice Gathering complete");
    this.emitSignalingMessage({target: this.get('currentTarget'), type: 'icefinished'}); //Do your custom logic
  }
}

Is this right? It works, I'm just curious if this will change, or if I should actually be testing something else on that event. 

Thanks,
Bryan



Kaiduan Xie

unread,
Feb 12, 2013, 4:33:46 PM2/12/13
to discuss...@googlegroups.com
Try the following code,

function onIceCandidate(event) {
if (event.candidate) {
sendMessage({type: 'candidate',
label: event.candidate.sdpMLineIndex,
id: event.candidate.sdpMid,
candidate: event.candidate.candidate});
} else {
console.log("End of candidates.");
}
}

/Kaiduan
> --
>
> ---
> 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.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Bryan Paluch

unread,
Feb 12, 2013, 4:49:16 PM2/12/13
to discuss...@googlegroups.com
By "callbacks no long emit events that are missing the candidate object to notify the app that candidate gathering is complete"
I mean that function will never fire with an event that will fail the if statement.

If you are running that code and rely on the else statement to do something, (i.e notify the other side that ice candidates are done, so you can create a sip INVITE), then it will not work in the latest canary.

That's how I used to fire my end of candidates event (And still do for backwards support.)

Kaiduan Xie

unread,
Feb 12, 2013, 4:52:52 PM2/12/13
to discuss...@googlegroups.com
Have you tried the above code? This is from apprtc.appspot.com and is
based on webkit source code.

/Kaiduan

Justin Uberti

unread,
Feb 12, 2013, 6:01:52 PM2/12/13
to discuss-webrtc, Mallinath Bareddy
Yeah, I see this too in M26 canary. Can you file a bug?

Mallinath, please take a look.

Benjamin Schwartz

unread,
Feb 12, 2013, 6:07:50 PM2/12/13
to discuss...@googlegroups.com, Mallinath Bareddy
This is a result of the patch at


The OnIceComplete hander has been removed.  I think this was a miscommunication about the desired Chrome behavior.

To maintain the NULL candidate behavior, the code that was previously listening to OnIceComplete could be placed in OnIceGatheringChange, listening to kIceGatheringComplete.

Justin Uberti

unread,
Feb 12, 2013, 7:00:04 PM2/12/13
to discuss-webrtc, Mallinath Bareddy
OK, we'll need to fix that. IceGatheringState is not exposed via its own callback to JS, oncandidate(null) is the way it is implicitly signaled. There is an iceGatheringState accessor though if you want to poll the state.

Bryan Paluch

unread,
Feb 13, 2013, 9:04:36 AM2/13/13
to discuss...@googlegroups.com, Mallinath Bareddy
You can also use the ongatheringchange callback then test event.currentTarget.iceGatheringState. Instead of polling. 

Bryan Paluch

unread,
Feb 13, 2013, 9:14:47 AM2/13/13
to discuss...@googlegroups.com, Mallinath Bareddy
Reply all
Reply to author
Forward
0 new messages