Procházet zdrojové kódy

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 před 7 roky
rodič
revize
23827014e5

+ 3
- 2
modules/RTC/TraceablePeerConnection.js Zobrazit soubor

@@ -185,9 +185,10 @@ export default function TraceablePeerConnection(
185 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 192
     const Interop = require('sdp-interop').Interop;
192 193
 
193 194
     this.interop = new Interop();

+ 10
- 0
modules/xmpp/JingleSessionPC.js Zobrazit soubor

@@ -29,6 +29,12 @@ const logger = getLogger(__filename);
29 29
  */
30 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,6 +254,10 @@ export default class JingleSessionPC extends JingleSession {
248 254
 
249 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 261
         if (this.isP2P) {
252 262
             // simulcast needs to be disabled for P2P (121) calls
253 263
             pcOptions.disableSimulcast = true;

Načítá se…
Zrušit
Uložit