浏览代码

Removes rtp stats option and adds options for disabling/enabling stats and audio levels.

j8
hristoterezov 10 年前
父节点
当前提交
d21f994eee
共有 6 个文件被更改,包括 135 次插入147 次删除
  1. 2
    1
      config.js
  2. 2
    2
      index.html
  3. 66
    72
      libs/app.bundle.js
  4. 1
    1
      modules/statistics/LocalStatsCollector.js
  5. 59
    62
      modules/statistics/RTPStatsCollector.js
  6. 5
    9
      modules/statistics/statistics.js

+ 2
- 1
config.js 查看文件

@@ -20,8 +20,9 @@ var config = {
20 20
     chromeExtensionId: 'diibjkoicjeejcmhdnailmkgecihlobk', // Id of desktop streamer Chrome extension
21 21
     desktopSharingSources: ['screen', 'window'],
22 22
     minChromeExtVersion: '0.1', // Required version of Chrome extension
23
-    enableRtpStats: true, // Enables RTP stats processing
24 23
     openSctp: true, // Toggle to enable/disable SCTP channels
24
+    disableStats: false,
25
+    disableAudioLevels: false,
25 26
     channelLastN: -1, // The default value of the channel attribute last-n.
26 27
     adaptiveLastN: false,
27 28
     adaptiveSimulcast: false,

+ 2
- 2
index.html 查看文件

@@ -10,7 +10,7 @@
10 10
     <meta itemprop="description" content="Join a WebRTC video conference powered by the Jitsi Videobridge"/>
11 11
     <meta itemprop="image" content="/images/jitsilogo.png"/>
12 12
     <script src="libs/jquery-2.1.1.min.js"></script>
13
-    <script src="config.js?v=5"></script><!-- adapt to your needs, i.e. set hosts and bosh path -->
13
+    <script src="config.js?v=6"></script><!-- adapt to your needs, i.e. set hosts and bosh path -->
14 14
     <script src="libs/strophe/strophe.min.js?v=1"></script>
15 15
     <script src="libs/strophe/strophe.disco.min.js?v=1"></script>
16 16
     <script src="libs/strophe/strophe.caps.jsonly.min.js?v=1"></script>
@@ -19,7 +19,7 @@
19 19
     <script src="libs/popover.js?v=1"></script><!-- bootstrap tooltip lib -->
20 20
     <script src="libs/toastr.js?v=1"></script><!-- notifications lib -->
21 21
     <script src="interface_config.js?v=5"></script>
22
-    <script src="libs/app.bundle.js?v=7"></script>
22
+    <script src="libs/app.bundle.js?v=8"></script>
23 23
 
24 24
     <script src="analytics.js?v=1"></script><!-- google analytics plugin -->
25 25
     <link rel="stylesheet" href="css/font.css?v=6"/>

+ 66
- 72
libs/app.bundle.js
文件差异内容过多而无法显示
查看文件


+ 1
- 1
modules/statistics/LocalStatsCollector.js 查看文件

@@ -84,7 +84,7 @@ function LocalStatsCollector(stream, interval, statisticsService, eventEmitter)
84 84
  * Starts the collecting the statistics.
85 85
  */
86 86
 LocalStatsCollector.prototype.start = function () {
87
-    if (!window.AudioContext)
87
+    if (config.disableAudioLevels || !window.AudioContext)
88 88
         return;
89 89
 
90 90
     var context = new AudioContext();

+ 59
- 62
modules/statistics/RTPStatsCollector.js 查看文件

@@ -219,69 +219,66 @@ StatsCollector.prototype.errorCallback = function (error)
219 219
 StatsCollector.prototype.start = function ()
220 220
 {
221 221
     var self = this;
222
-    this.audioLevelsIntervalId = setInterval(
223
-        function ()
224
-        {
225
-            // Interval updates
226
-            self.peerconnection.getStats(
227
-                function (report)
228
-                {
229
-                    var results = null;
230
-                    if(!report || !report.result || typeof report.result != 'function')
231
-                    {
232
-                        results = report;
233
-                    }
234
-                    else
235
-                    {
236
-                        results = report.result();
237
-                    }
238
-                    //console.error("Got interval report", results);
239
-                    self.currentAudioLevelsReport = results;
240
-                    self.processAudioLevelReport();
241
-                    self.baselineAudioLevelsReport =
242
-                        self.currentAudioLevelsReport;
243
-                },
244
-                self.errorCallback
245
-            );
246
-        },
247
-        self.audioLevelsIntervalMilis
248
-    );
249
-
250
-    this.statsIntervalId = setInterval(
251
-        function () {
252
-            // Interval updates
253
-            self.peerconnection.getStats(
254
-                function (report)
255
-                {
256
-                    var results = null;
257
-                    if(!report || !report.result || typeof report.result != 'function')
258
-                    {
259
-                        //firefox
260
-                        results = report;
261
-                    }
262
-                    else
263
-                    {
264
-                        //chrome
265
-                        results = report.result();
266
-                    }
267
-                    //console.error("Got interval report", results);
268
-                    self.currentStatsReport = results;
269
-                    try
270
-                    {
271
-                        self.processStatsReport();
272
-                    }
273
-                    catch (e)
274
-                    {
275
-                        console.error("Unsupported key:" + e, e);
276
-                    }
222
+    if(!config.disableAudioLevels) {
223
+        this.audioLevelsIntervalId = setInterval(
224
+            function () {
225
+                // Interval updates
226
+                self.peerconnection.getStats(
227
+                    function (report) {
228
+                        var results = null;
229
+                        if (!report || !report.result ||
230
+                            typeof report.result != 'function') {
231
+                            results = report;
232
+                        }
233
+                        else {
234
+                            results = report.result();
235
+                        }
236
+                        //console.error("Got interval report", results);
237
+                        self.currentAudioLevelsReport = results;
238
+                        self.processAudioLevelReport();
239
+                        self.baselineAudioLevelsReport =
240
+                            self.currentAudioLevelsReport;
241
+                    },
242
+                    self.errorCallback
243
+                );
244
+            },
245
+            self.audioLevelsIntervalMilis
246
+        );
247
+    }
277 248
 
278
-                    self.baselineStatsReport = self.currentStatsReport;
279
-                },
280
-                self.errorCallback
281
-            );
282
-        },
283
-        self.statsIntervalMilis
284
-    );
249
+    if(!config.disableStats) {
250
+        this.statsIntervalId = setInterval(
251
+            function () {
252
+                // Interval updates
253
+                self.peerconnection.getStats(
254
+                    function (report) {
255
+                        var results = null;
256
+                        if (!report || !report.result ||
257
+                            typeof report.result != 'function') {
258
+                            //firefox
259
+                            results = report;
260
+                        }
261
+                        else {
262
+                            //chrome
263
+                            results = report.result();
264
+                        }
265
+                        //console.error("Got interval report", results);
266
+                        self.currentStatsReport = results;
267
+                        try {
268
+                            self.processStatsReport();
269
+                        }
270
+                        catch (e) {
271
+                            console.error("Unsupported key:" + e, e);
272
+                        }
273
+
274
+                        self.baselineStatsReport = self.currentStatsReport;
275
+                    },
276
+                    self.errorCallback
277
+                );
278
+            },
279
+            self.statsIntervalMilis
280
+        );
281
+    }
285 282
 
286 283
     if (config.logStats) {
287 284
         this.gatherStatsIntervalId = setInterval(

+ 5
- 9
modules/statistics/statistics.js 查看文件

@@ -33,18 +33,14 @@ function stopRemote()
33 33
 }
34 34
 
35 35
 function startRemoteStats (peerconnection) {
36
-    if (config.enableRtpStats)
36
+    if(rtpStats)
37 37
     {
38
-        if(rtpStats)
39
-        {
40
-            rtpStats.stop();
41
-            rtpStats = null;
42
-        }
43
-
44
-        rtpStats = new RTPStats(peerconnection, 200, 2000, eventEmitter);
45
-        rtpStats.start();
38
+        rtpStats.stop();
39
+        rtpStats = null;
46 40
     }
47 41
 
42
+    rtpStats = new RTPStats(peerconnection, 200, 2000, eventEmitter);
43
+    rtpStats.start();
48 44
 }
49 45
 
50 46
 function onStreamCreated(stream)

正在加载...
取消
保存