OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Maximum numer of lines to record in the debug log. | 5 // Maximum numer of lines to record in the debug log. |
6 // Only the most recent <n> lines are displayed. | 6 // Only the most recent <n> lines are displayed. |
7 var MAX_DEBUG_LOG_SIZE = 1000; | 7 var MAX_DEBUG_LOG_SIZE = 1000; |
8 var remoting = chrome.extension.getBackgroundPage().remoting; | 8 var remoting = chrome.extension.getBackgroundPage().remoting; |
9 | 9 |
10 // Message id so that we can identify (and ignore) message fade operations for | 10 // Message id so that we can identify (and ignore) message fade operations for |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 | 300 |
301 function updateStatusBarStats() { | 301 function updateStatusBarStats() { |
302 if (remoting.plugin.status != remoting.plugin.STATUS_CONNECTED) | 302 if (remoting.plugin.status != remoting.plugin.STATUS_CONNECTED) |
303 return; | 303 return; |
304 var videoBandwidth = remoting.plugin.videoBandwidth; | 304 var videoBandwidth = remoting.plugin.videoBandwidth; |
305 var videoCaptureLatency = remoting.plugin.videoCaptureLatency; | 305 var videoCaptureLatency = remoting.plugin.videoCaptureLatency; |
306 var videoEncodeLatency = remoting.plugin.videoEncodeLatency; | 306 var videoEncodeLatency = remoting.plugin.videoEncodeLatency; |
307 var videoDecodeLatency = remoting.plugin.videoDecodeLatency; | 307 var videoDecodeLatency = remoting.plugin.videoDecodeLatency; |
308 var videoRenderLatency = remoting.plugin.videoRenderLatency; | 308 var videoRenderLatency = remoting.plugin.videoRenderLatency; |
309 | 309 |
| 310 var units = ''; |
| 311 if (videoBandwidth < 1024) { |
| 312 units = 'Bps'; |
| 313 } else if (videoBandwidth < 1048576) { |
| 314 units = 'KBps'; |
| 315 videoBandwidth = videoBandwidth / 1024; |
| 316 } else if (videoBandwidth < 1073741824) { |
| 317 units = 'MBps'; |
| 318 videoBandwidth = videoBandwidth / 1048576; |
| 319 } else { |
| 320 units = 'GBps'; |
| 321 videoBandwidth = videoBandwidth / 1073741824; |
| 322 } |
| 323 |
310 setClientStateMessage( | 324 setClientStateMessage( |
311 'Video stats: bandwidth: ' + videoBandwidth.toFixed(2) + 'Kbps' + | 325 'Video stats: bandwidth: ' + videoBandwidth.toFixed(2) + units + |
312 ', Latency: capture: ' + videoCaptureLatency.toFixed(2) + 'ms' + | 326 ', Latency: capture: ' + videoCaptureLatency.toFixed(2) + 'ms' + |
313 ', encode: ' + videoEncodeLatency.toFixed(2) + 'ms' + | 327 ', encode: ' + videoEncodeLatency.toFixed(2) + 'ms' + |
314 ', decode: ' + videoDecodeLatency.toFixed(2) + 'ms' + | 328 ', decode: ' + videoDecodeLatency.toFixed(2) + 'ms' + |
315 ', render: ' + videoRenderLatency.toFixed(2) + 'ms'); | 329 ', render: ' + videoRenderLatency.toFixed(2) + 'ms'); |
316 | 330 |
317 // Update the stats once per second. | 331 // Update the stats once per second. |
318 window.setTimeout('updateStatusBarStats()', 1000); | 332 window.setTimeout('updateStatusBarStats()', 1000); |
319 } | 333 } |
OLD | NEW |