From 39949e0f1f372be6790224e58d42879b46fc9a94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jeremy=20Lain=C3=A9?= Date: Wed, 10 Sep 2014 15:23:55 +0200 Subject: [PATCH] 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'. --- src/RTCSession/RTCMediaHandler.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/RTCSession/RTCMediaHandler.js b/src/RTCSession/RTCMediaHandler.js index 6485503c0..81abe2a7b 100644 --- a/src/RTCSession/RTCMediaHandler.js +++ b/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 {