Skip to content

Commit

Permalink
fix createAnswer / createOffer when ICE state is 'completed'
Browse files Browse the repository at this point in the history
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 39949e0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/RTCSession/RTCMediaHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 39949e0

Please sign in to comment.