Browse Source

fix(statistics): create new CallStats instance after it was stopped

dev1
paweldomas 9 years ago
parent
commit
600cb75560
1 changed files with 14 additions and 2 deletions
  1. 14
    2
      modules/statistics/statistics.js

+ 14
- 2
modules/statistics/statistics.js View File

@@ -124,6 +124,9 @@ function Statistics(xmpp, options) {
124 124
     if(this.callStatsIntegrationEnabled)
125 125
         loadCallStatsAPI();
126 126
     this.callStats = null;
127
+    // Flag indicates whether or not the CallStats have been started for this
128
+    // Statistics instance
129
+    this.callStatsStarted = false;
127 130
 
128 131
     /**
129 132
      * Send the stats already saved in rtpStats to be logged via the focus.
@@ -252,9 +255,17 @@ Statistics.prototype.stopRemoteStats = function () {
252 255
  * /modules/settings/Settings.js
253 256
  */
254 257
 Statistics.prototype.startCallStats = function (session, settings) {
255
-    if(this.callStatsIntegrationEnabled && !this.callstats) {
258
+    if(this.callStatsIntegrationEnabled && !this.callStatsStarted) {
259
+        // Here we overwrite the previous instance, but it must be bound to
260
+        // the new PeerConnection
261
+        // FIXME CallStats does not show the participant after
262
+        // stopCallStats/startCallStats, the issue is being investigated on both
263
+        // our and CallStats side, but given how rare this situation should
264
+        // be, we need to have this change merged. Without it "invalid pcHash"
265
+        // error is reported(lib calls are made for the old PeerConnection).
256 266
         this.callstats = new CallStats(session, settings, this.options);
257 267
         Statistics.callsStatsInstances.push(this.callstats);
268
+        this.callStatsStarted = true;
258 269
     }
259 270
 };
260 271
 
@@ -262,7 +273,7 @@ Statistics.prototype.startCallStats = function (session, settings) {
262 273
  * Removes the callstats.io instances.
263 274
  */
264 275
 Statistics.prototype.stopCallStats = function () {
265
-    if(this.callstats) {
276
+    if(this.callStatsStarted) {
266 277
         var index = Statistics.callsStatsInstances.indexOf(this.callstats);
267 278
         if(index > -1)
268 279
             Statistics.callsStatsInstances.splice(index, 1);
@@ -270,6 +281,7 @@ Statistics.prototype.stopCallStats = function () {
270 281
         // feedback even after the conference has been destroyed.
271 282
         // this.callstats = null;
272 283
         CallStats.dispose();
284
+        this.callStatsStarted = false;
273 285
     }
274 286
 };
275 287
 

Loading…
Cancel
Save