support smarter trickle ice from the focus

This commit is contained in:
Philipp Hancke 2014-02-24 21:13:04 +01:00
parent 55bf5eb119
commit 69dc3b4ea1
1 changed files with 11 additions and 6 deletions

View File

@ -120,11 +120,7 @@ ColibriFocus.prototype.makeConference = function (peers) {
console.log('end of candidates'); console.log('end of candidates');
return; return;
} }
if (self.confid === 0) { self.sendIceCandidate(event.candidate);
self.drip_container.push(event.candidate);
} else {
self.sendIceCandidate(event.candidate);
}
}; };
this._makeConference(); this._makeConference();
/* /*
@ -714,12 +710,21 @@ ColibriFocus.prototype.addIceCandidate = function (session, elem) {
// send our own candidate to the bridge // send our own candidate to the bridge
ColibriFocus.prototype.sendIceCandidate = function (candidate) { ColibriFocus.prototype.sendIceCandidate = function (candidate) {
var self = this;
//console.log('candidate', candidate); //console.log('candidate', candidate);
if (!candidate) { if (!candidate) {
console.log('end of candidates'); console.log('end of candidates');
return; return;
} }
this.sendIceCandidates([candidate]); if (this.drip_container.length === 0) {
// start 20ms callout
window.setTimeout(function () {
if (self.drip_container.length === 0) return;
self.sendIceCandidates(self.drip_container);
self.drip_container = [];
}, 20);
}
this.drip_container.push(candidate);
}; };
// sort and send multiple candidates // sort and send multiple candidates