From 69dc3b4ea1c2cd73d86f626a1e0d152b29f34812 Mon Sep 17 00:00:00 2001 From: Philipp Hancke Date: Mon, 24 Feb 2014 21:13:04 +0100 Subject: [PATCH] support smarter trickle ice from the focus --- libs/colibri.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/libs/colibri.js b/libs/colibri.js index 159a3e7dd3..1f82d221bc 100644 --- a/libs/colibri.js +++ b/libs/colibri.js @@ -120,11 +120,7 @@ ColibriFocus.prototype.makeConference = function (peers) { console.log('end of candidates'); return; } - if (self.confid === 0) { - self.drip_container.push(event.candidate); - } else { - self.sendIceCandidate(event.candidate); - } + self.sendIceCandidate(event.candidate); }; this._makeConference(); /* @@ -714,12 +710,21 @@ ColibriFocus.prototype.addIceCandidate = function (session, elem) { // send our own candidate to the bridge ColibriFocus.prototype.sendIceCandidate = function (candidate) { + var self = this; //console.log('candidate', candidate); if (!candidate) { console.log('end of candidates'); 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