Browse Source

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

j8
hristoterezov 11 years ago
parent
commit
a694d0fbdf
1 changed files with 16 additions and 6 deletions
  1. 16
    6
      app.js

+ 16
- 6
app.js View File

469
  */
469
  */
470
 function startRtpStatsCollector()
470
 function startRtpStatsCollector()
471
 {
471
 {
472
-    if (config.enableRtpStats && !statsCollector)
472
+    stopRTPStatsCollector();
473
+    if (config.enableRtpStats)
473
     {
474
     {
474
         statsCollector = new StatsCollector(
475
         statsCollector = new StatsCollector(
475
             getConferenceHandler().peerconnection, 200, statsUpdated);
476
             getConferenceHandler().peerconnection, 200, statsUpdated);
479
         statsCollector.start();
480
         statsCollector.start();
480
     }
481
     }
481
 }
482
 }
483
+
484
+/**
485
+ * Stops the {@link StatsCollector}.
486
+ */
487
+function stopRTPStatsCollector()
488
+{
489
+    if (statsCollector)
490
+    {
491
+        statsCollector.stop();
492
+        statsCollector = null;
493
+    }
494
+}
495
+
482
 /**
496
 /**
483
  * Starts the {@link LocalStatsCollector} if the feature is enabled in config.js
497
  * Starts the {@link LocalStatsCollector} if the feature is enabled in config.js
484
  * @param stream the stream that will be used for collecting statistics.
498
  * @param stream the stream that will be used for collecting statistics.
1082
         }
1096
         }
1083
         handler.peerconnection.close();
1097
         handler.peerconnection.close();
1084
     }
1098
     }
1085
-    if (statsCollector)
1086
-    {
1087
-        statsCollector.stop();
1088
-        statsCollector = null;
1089
-    }
1099
+    stopRTPStatsCollector();
1090
     if(!onUnload) {
1100
     if(!onUnload) {
1091
         startLocalRtpStatsCollector(connection.jingle.localAudio);
1101
         startLocalRtpStatsCollector(connection.jingle.localAudio);
1092
     }
1102
     }

Loading…
Cancel
Save