From b5ecdc8dee33b7df1df2f6c4da8013013fc92cb9 Mon Sep 17 00:00:00 2001 From: paweldomas Date: Fri, 28 Nov 2014 16:24:33 +0100 Subject: [PATCH] Sends peer connection stats to the focus(written by Boris Grozev). --- rtp_sts.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/rtp_sts.js b/rtp_sts.js index 63eef8702..27270ad08 100644 --- a/rtp_sts.js +++ b/rtp_sts.js @@ -290,6 +290,10 @@ StatsCollector.prototype.addStatsToBeLogged = function (reports) { }; StatsCollector.prototype.logStats = function () { + if (!focusJid) { + return; + } + var deflate = true; var content = JSON.stringify(this.statsToBeLogged); @@ -299,7 +303,7 @@ StatsCollector.prototype.logStats = function () { content = Base64.encode(content); // XEP-0337-ish - var message = $msg(); + var message = $msg({to: focusJid, type: 'normal'}); message.c('log', { xmlns: 'urn:xmpp:eventlog', id: 'PeerConnectionStats'}); message.c('message').t(content).up(); @@ -308,8 +312,7 @@ StatsCollector.prototype.logStats = function () { } message.up(); - //TODO: actually send the message... - console.log(message.toString()); + connection.send(message); // Reset the stats this.statsToBeLogged.stats = {};