Skip to content
Permalink
Browse files

fix createAnswer / createOffer when ICE state is 'completed'

RTCMediaHandler's createAnswer and createOffer methods never invoke the
success callback if the ICE state is 'completed'. This happens because the
onSetLocalDescriptionSuccess callbacks check whether the ICE state is
'connected' instead of 'connected' or 'completed'. As a consequence of this,
hold and unhold no longer works once ICE reaches the 'completed' state.

This change fixes the ICE state test to allow both 'connected' and 'completed'.
  • Loading branch information
jlaine committed Sep 10, 2014
1 parent 36c77f9 commit 39949e0f1f372be6790224e58d42879b46fc9a94
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/RTCSession/RTCMediaHandler.js
@@ -30,7 +30,7 @@ RTCMediaHandler.prototype = {
var self = this;

function onSetLocalDescriptionSuccess() {
if (self.peerConnection.iceGatheringState === 'complete' && self.peerConnection.iceConnectionState === 'connected') {
if (self.peerConnection.iceGatheringState === 'complete' && (self.peerConnection.iceConnectionState === 'connected' || self.peerConnection.iceConnectionState === 'completed')) {
self.ready = true;
onSuccess(self.peerConnection.localDescription.sdp);
} else {
@@ -69,7 +69,7 @@ RTCMediaHandler.prototype = {
var self = this;

function onSetLocalDescriptionSuccess() {
if (self.peerConnection.iceGatheringState === 'complete' && self.peerConnection.iceConnectionState === 'connected') {
if (self.peerConnection.iceGatheringState === 'complete' && (self.peerConnection.iceConnectionState === 'connected' || self.peerConnection.iceConnectionState === 'completed')) {
self.ready = true;
onSuccess(self.peerConnection.localDescription.sdp);
} else {

0 comments on commit 39949e0

Please sign in to comment.
You can’t perform that action at this time.