Fixes issue with StatsCollector when the conference is recreated the peerconnection in the StatsCollector isn't updated.

This commit is contained in:
hristoterezov 2014-07-03 14:30:07 +02:00
parent cef26315c3
commit a694d0fbdf
1 changed files with 16 additions and 6 deletions

22
app.js
View File

@ -469,7 +469,8 @@ function localStatsUpdated(statsCollector)
*/ */
function startRtpStatsCollector() function startRtpStatsCollector()
{ {
if (config.enableRtpStats && !statsCollector) stopRTPStatsCollector();
if (config.enableRtpStats)
{ {
statsCollector = new StatsCollector( statsCollector = new StatsCollector(
getConferenceHandler().peerconnection, 200, statsUpdated); getConferenceHandler().peerconnection, 200, statsUpdated);
@ -479,6 +480,19 @@ function startRtpStatsCollector()
statsCollector.start(); 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 * Starts the {@link LocalStatsCollector} if the feature is enabled in config.js
* @param stream the stream that will be used for collecting statistics. * @param stream the stream that will be used for collecting statistics.
@ -1082,11 +1096,7 @@ function disposeConference(onUnload) {
} }
handler.peerconnection.close(); handler.peerconnection.close();
} }
if (statsCollector) stopRTPStatsCollector();
{
statsCollector.stop();
statsCollector = null;
}
if(!onUnload) { if(!onUnload) {
startLocalRtpStatsCollector(connection.jingle.localAudio); startLocalRtpStatsCollector(connection.jingle.localAudio);
} }