Преглед на файлове

feat: Adds a config.gatherStats parameter.

This PR exposes the functionality that's already built-in the
TraceablePeerConnection that has it gather stats from the wrapped
PeerConnection.
master
George Politis преди 7 години
родител
ревизия
23827014e5
променени са 2 файла, в които са добавени 13 реда и са изтрити 2 реда
  1. 3
    2
      modules/RTC/TraceablePeerConnection.js
  2. 10
    0
      modules/xmpp/JingleSessionPC.js

+ 3
- 2
modules/RTC/TraceablePeerConnection.js Целия файл

185
     this.statsinterval = null;
185
     this.statsinterval = null;
186
 
186
 
187
     /**
187
     /**
188
-     * @type {number}
188
+     * @type {number} The max number of stats to keep in this.stats. Limit to
189
+     * 300 values, i.e. 5 minutes; set to 0 to disable
189
      */
190
      */
190
-    this.maxstats = 0;
191
+    this.maxstats = options.maxstats;
191
     const Interop = require('sdp-interop').Interop;
192
     const Interop = require('sdp-interop').Interop;
192
 
193
 
193
     this.interop = new Interop();
194
     this.interop = new Interop();

+ 10
- 0
modules/xmpp/JingleSessionPC.js Целия файл

29
  */
29
  */
30
 const IQ_TIMEOUT = 10000;
30
 const IQ_TIMEOUT = 10000;
31
 
31
 
32
+/*
33
+ * The default number of samples (per stat) to keep when webrtc stats gathering
34
+ * is enabled in TraceablePeerConnection.
35
+ */
36
+const DEFAULT_MAX_STATS = 300;
37
+
32
 /**
38
 /**
33
  *
39
  *
34
  */
40
  */
248
 
254
 
249
         const pcOptions = { disableRtx: this.room.options.disableRtx };
255
         const pcOptions = { disableRtx: this.room.options.disableRtx };
250
 
256
 
257
+        if (this.room.options.gatherStats) {
258
+            pcOptions.maxstats = DEFAULT_MAX_STATS;
259
+        }
260
+
251
         if (this.isP2P) {
261
         if (this.isP2P) {
252
             // simulcast needs to be disabled for P2P (121) calls
262
             // simulcast needs to be disabled for P2P (121) calls
253
             pcOptions.disableSimulcast = true;
263
             pcOptions.disableSimulcast = true;

Loading…
Отказ
Запис