Bug 1091290 - Queue addIceCandidate correctly to not overwrite already-queued callbacks. r=bwc

This commit is contained in:
Jan-Ivar Bruaroey 2014-10-29 19:29:21 -04:00
Родитель f5e0b0d131
Коммит f897a568c9
1 изменённых файлов: 9 добавлений и 4 удалений

Просмотреть файл

@ -835,13 +835,18 @@ RTCPeerConnection.prototype = {
throw new this._win.DOMError("", throw new this._win.DOMError("",
"Invalid candidate passed to addIceCandidate!"); "Invalid candidate passed to addIceCandidate!");
} }
this._queueOrRun({
func: this._addIceCandidate,
args: [cand, onSuccess, onError],
wait: false
});
},
_addIceCandidate: function(cand, onSuccess, onError) {
this._onAddIceCandidateSuccess = onSuccess || null; this._onAddIceCandidateSuccess = onSuccess || null;
this._onAddIceCandidateError = onError || null; this._onAddIceCandidateError = onError || null;
this._queueOrRun({ func: this._addIceCandidate, args: [cand], wait: false });
},
_addIceCandidate: function(cand) {
this._impl.addIceCandidate(cand.candidate, cand.sdpMid || "", this._impl.addIceCandidate(cand.candidate, cand.sdpMid || "",
(cand.sdpMLineIndex === null) ? 0 : (cand.sdpMLineIndex === null) ? 0 :
cand.sdpMLineIndex + 1); cand.sdpMLineIndex + 1);