From a694d0fbdfa10fa95eb9d54dc390426cfc8a787a Mon Sep 17 00:00:00 2001 From: hristoterezov Date: Thu, 3 Jul 2014 14:30:07 +0200 Subject: [PATCH] Fixes issue with StatsCollector when the conference is recreated the peerconnection in the StatsCollector isn't updated. --- app.js | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/app.js b/app.js index 360a8f91c..93ec61035 100644 --- a/app.js +++ b/app.js @@ -469,7 +469,8 @@ function localStatsUpdated(statsCollector) */ function startRtpStatsCollector() { - if (config.enableRtpStats && !statsCollector) + stopRTPStatsCollector(); + if (config.enableRtpStats) { statsCollector = new StatsCollector( getConferenceHandler().peerconnection, 200, statsUpdated); @@ -479,6 +480,19 @@ function startRtpStatsCollector() statsCollector.start(); } } + +/** + * Stops the {@link StatsCollector}. + */ +function stopRTPStatsCollector() +{ + if (statsCollector) + { + statsCollector.stop(); + statsCollector = null; + } +} + /** * Starts the {@link LocalStatsCollector} if the feature is enabled in config.js * @param stream the stream that will be used for collecting statistics. @@ -1082,11 +1096,7 @@ function disposeConference(onUnload) { } handler.peerconnection.close(); } - if (statsCollector) - { - statsCollector.stop(); - statsCollector = null; - } + stopRTPStatsCollector(); if(!onUnload) { startLocalRtpStatsCollector(connection.jingle.localAudio); }