зеркало из https://github.com/mozilla/gecko-dev.git
Bug 834153 - Queue CreateAnswer State Checks, remove extraneous _executeNext calls. r=jesup
This commit is contained in:
Родитель
a5f42733eb
Коммит
309a81e0a4
|
@ -435,15 +435,40 @@ PeerConnection.prototype = {
|
|||
});
|
||||
},
|
||||
|
||||
createAnswer: function(onSuccess, onError, constraints, provisional) {
|
||||
_createAnswer: function(onSuccess, onError, constraints, provisional) {
|
||||
this._onCreateAnswerSuccess = onSuccess;
|
||||
this._onCreateAnswerFailure = onError;
|
||||
|
||||
if (!this.remoteDescription) {
|
||||
throw new Error("setRemoteDescription not called");
|
||||
this._observer.onCreateAnswerError(3); // PC_INVALID_REMOTE_SDP
|
||||
/*
|
||||
This needs to be matched to spec -- see bug 834270. The final
|
||||
code will be of the form:
|
||||
|
||||
this._observer.onCreateAnswerError(ci.IPeerConnection.kInvalidState,
|
||||
"setRemoteDescription not called");
|
||||
*/
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.remoteDescription.type != "offer") {
|
||||
throw new Error("No outstanding offer");
|
||||
this._observer.onCreateAnswerError(3); // PC_INVALID_REMOTE_SDP
|
||||
/*
|
||||
This needs to be matched to spec -- see bug 834270. The final
|
||||
code will be of the form:
|
||||
|
||||
this._observer.onCreateAnswerError(ci.IPeerConnection.kInvalidState,
|
||||
"No outstanding offer");
|
||||
*/
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: Implement provisional answer.
|
||||
|
||||
this._pc.createAnswer(constraints);
|
||||
},
|
||||
|
||||
createAnswer: function(onSuccess, onError, constraints, provisional) {
|
||||
if (!constraints) {
|
||||
constraints = {};
|
||||
}
|
||||
|
@ -452,17 +477,13 @@ PeerConnection.prototype = {
|
|||
throw new Error("createAnswer passed invalid constraints");
|
||||
}
|
||||
|
||||
this._onCreateAnswerSuccess = onSuccess;
|
||||
this._onCreateAnswerFailure = onError;
|
||||
|
||||
if (!provisional) {
|
||||
provisional = false;
|
||||
}
|
||||
|
||||
// TODO: Implement provisional answer.
|
||||
this._queueOrRun({
|
||||
func: this._pc.createAnswer,
|
||||
args: [constraints],
|
||||
func: this._createAnswer,
|
||||
args: [onSuccess, onError, constraints, provisional],
|
||||
wait: true
|
||||
});
|
||||
},
|
||||
|
@ -770,13 +791,11 @@ PeerConnectionObserver.prototype = {
|
|||
break;
|
||||
case Ci.IPeerConnection.kIceChecking:
|
||||
iceCb("checking");
|
||||
this._dompc._executeNext();
|
||||
break;
|
||||
case Ci.IPeerConnection.kIceConnected:
|
||||
// ICE gathering complete.
|
||||
iceCb("connected");
|
||||
iceGatherCb("complete");
|
||||
this._dompc._executeNext();
|
||||
break;
|
||||
case Ci.IPeerConnection.kIceFailed:
|
||||
iceCb("failed");
|
||||
|
@ -796,7 +815,6 @@ PeerConnectionObserver.prototype = {
|
|||
});
|
||||
} catch(e) {}
|
||||
}
|
||||
this._dompc._executeNext();
|
||||
},
|
||||
|
||||
onRemoveStream: function(stream, type) {
|
||||
|
@ -808,7 +826,6 @@ PeerConnectionObserver.prototype = {
|
|||
});
|
||||
} catch(e) {}
|
||||
}
|
||||
this._dompc._executeNext();
|
||||
},
|
||||
|
||||
foundIceCandidate: function(cand) {
|
||||
|
@ -820,7 +837,6 @@ PeerConnectionObserver.prototype = {
|
|||
});
|
||||
} catch(e) {}
|
||||
}
|
||||
this._dompc._executeNext();
|
||||
},
|
||||
|
||||
notifyDataChannel: function(channel) {
|
||||
|
@ -829,7 +845,6 @@ PeerConnectionObserver.prototype = {
|
|||
this._dompc.ondatachannel.onCallback(channel);
|
||||
} catch(e) {}
|
||||
}
|
||||
this._dompc._executeNext();
|
||||
},
|
||||
|
||||
notifyConnection: function() {
|
||||
|
@ -838,7 +853,6 @@ PeerConnectionObserver.prototype = {
|
|||
this._dompc.onconnection.onCallback();
|
||||
} catch(e) {}
|
||||
}
|
||||
this._dompc._executeNext();
|
||||
},
|
||||
|
||||
notifyClosedConnection: function() {
|
||||
|
@ -847,7 +861,6 @@ PeerConnectionObserver.prototype = {
|
|||
this._dompc.onclosedconnection.onCallback();
|
||||
} catch(e) {}
|
||||
}
|
||||
this._dompc._executeNext();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче