소스 검색

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

master
paweldomas 9 년 전
부모
커밋
600cb75560
1개의 변경된 파일14개의 추가작업 그리고 2개의 파일을 삭제
  1. 14
    2
      modules/statistics/statistics.js

+ 14
- 2
modules/statistics/statistics.js 파일 보기

124
     if(this.callStatsIntegrationEnabled)
124
     if(this.callStatsIntegrationEnabled)
125
         loadCallStatsAPI();
125
         loadCallStatsAPI();
126
     this.callStats = null;
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
      * Send the stats already saved in rtpStats to be logged via the focus.
132
      * Send the stats already saved in rtpStats to be logged via the focus.
252
  * /modules/settings/Settings.js
255
  * /modules/settings/Settings.js
253
  */
256
  */
254
 Statistics.prototype.startCallStats = function (session, settings) {
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
         this.callstats = new CallStats(session, settings, this.options);
266
         this.callstats = new CallStats(session, settings, this.options);
257
         Statistics.callsStatsInstances.push(this.callstats);
267
         Statistics.callsStatsInstances.push(this.callstats);
268
+        this.callStatsStarted = true;
258
     }
269
     }
259
 };
270
 };
260
 
271
 
262
  * Removes the callstats.io instances.
273
  * Removes the callstats.io instances.
263
  */
274
  */
264
 Statistics.prototype.stopCallStats = function () {
275
 Statistics.prototype.stopCallStats = function () {
265
-    if(this.callstats) {
276
+    if(this.callStatsStarted) {
266
         var index = Statistics.callsStatsInstances.indexOf(this.callstats);
277
         var index = Statistics.callsStatsInstances.indexOf(this.callstats);
267
         if(index > -1)
278
         if(index > -1)
268
             Statistics.callsStatsInstances.splice(index, 1);
279
             Statistics.callsStatsInstances.splice(index, 1);
270
         // feedback even after the conference has been destroyed.
281
         // feedback even after the conference has been destroyed.
271
         // this.callstats = null;
282
         // this.callstats = null;
272
         CallStats.dispose();
283
         CallStats.dispose();
284
+        this.callStatsStarted = false;
273
     }
285
     }
274
 };
286
 };
275
 
287
 

Loading…
취소
저장