提交 6b0396d6 authored 作者: Anthony Minessale II's avatar Anthony Minessale II

Merge pull request #469 in FS/freeswitch from bugfix/FS-8117 to master

* commit '93b2fb47':
  FS-8117 #resolve [VC ignoring useSTUN settings]
...@@ -29,11 +29,6 @@ ...@@ -29,11 +29,6 @@
* *
*/ */
var iceTimerSent = 0;
var iceTimerCompleted = 0;
var iceTimer;
(function($) { (function($) {
// Find the line in sdpLines that starts with |prefix|, and, if specified, // Find the line in sdpLines that starts with |prefix|, and, if specified,
...@@ -604,6 +599,7 @@ var iceTimer; ...@@ -604,6 +599,7 @@ var iceTimer;
window.moz = !!navigator.mozGetUserMedia; window.moz = !!navigator.mozGetUserMedia;
function RTCPeerConnection(options) { function RTCPeerConnection(options) {
var gathering = false, done = false;
var w = window, var w = window,
PeerConnection = w.mozRTCPeerConnection || w.webkitRTCPeerConnection, PeerConnection = w.mozRTCPeerConnection || w.webkitRTCPeerConnection,
...@@ -655,24 +651,16 @@ var iceTimer; ...@@ -655,24 +651,16 @@ var iceTimer;
openOffererChannel(); openOffererChannel();
var x = 0; var x = 0;
peer.onicecandidate = function(event) { function ice_handler() {
if (event.candidate) {
options.onICE(event.candidate);
clearTimeout(iceTimer);
iceTimer = setTimeout(function() {
iceTimerSent = 1;
if (iceTimerCompleted == 0) { done = true;
gathering = null;
if (options.onICEComplete) { if (options.onICEComplete) {
options.onICEComplete(); options.onICEComplete();
} }
if (options.type == "offer") { if (options.type == "offer") {
/* new mozilla now tries to be like chrome but it takes them 10 seconds to complete the ICE
Booooooooo! This trickle thing is a waste of time...... We'll all have to re-code our engines
to handle partial setups to maybe save 100m
*/
if ((!moz || (!options.sentICESDP && peer.localDescription.sdp.match(/a=candidate/)) && !x && options.onICESDP)) { if ((!moz || (!options.sentICESDP && peer.localDescription.sdp.match(/a=candidate/)) && !x && options.onICESDP)) {
options.onICESDP(peer.localDescription); options.onICESDP(peer.localDescription);
//x = 1; //x = 1;
...@@ -704,52 +692,30 @@ var iceTimer; ...@@ -704,52 +692,30 @@ var iceTimer;
} }
} }
} }
}, 1000);
} else {
if (iceTimerSent == 0) {
clearTimeout(iceTimer);
iceTimerCompleted = 1;
if (options.onICEComplete) { peer.onicecandidate = function(event) {
options.onICEComplete();
if (done) {
return;
} }
if (options.type == "offer") { if (!gathering) {
/* new mozilla now tries to be like chrome but it takes them 10 seconds to complete the ICE gathering = setTimeout(ice_handler, 1000);
Booooooooo! This trickle thing is a waste of time...... We'll all have to re-code our engines
to handle partial setups to maybe save 100m
*/
if ((!moz || (!options.sentICESDP && peer.localDescription.sdp.match(/a=candidate/)) && !x && options.onICESDP)) {
options.onICESDP(peer.localDescription);
//x = 1;
/*
x = 1;
peer.createOffer(function(sessionDescription) {
sessionDescription.sdp = serializeSdp(sessionDescription.sdp);
peer.setLocalDescription(sessionDescription);
if (options.onICESDP) {
options.onICESDP(sessionDescription);
} }
}, onSdpError, constraints);
*/ if (event) {
if (event.candidate) {
options.onICE(event.candidate);
} }
} else { } else {
if (!x && options.onICESDP) { done = true;
options.onICESDP(peer.localDescription);
//x = 1; if (gathering) {
/* clearTimeout(gathering);
x = 1; gathering = null;
peer.createAnswer(function(sessionDescription) {
sessionDescription.sdp = serializeSdp(sessionDescription.sdp);
peer.setLocalDescription(sessionDescription);
if (options.onICESDP) {
options.onICESDP(sessionDescription);
}
}, onSdpError, constraints);
*/
}
}
} }
ice_handler();
} }
}; };
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论