| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 /** | 5 /** |
| 6 * @fileoverview | 6 * @fileoverview |
| 7 * Module to support debug overlay window with connection stats. | 7 * Module to support debug overlay window with connection stats. |
| 8 */ | 8 */ |
| 9 | 9 |
| 10 'use strict'; | 10 'use strict'; |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 videoBandwidth = videoBandwidth / 1048576; | 116 videoBandwidth = videoBandwidth / 1048576; |
| 117 } else { | 117 } else { |
| 118 units = 'GiBps'; | 118 units = 'GiBps'; |
| 119 videoBandwidth = videoBandwidth / 1073741824; | 119 videoBandwidth = videoBandwidth / 1073741824; |
| 120 } | 120 } |
| 121 } | 121 } |
| 122 | 122 |
| 123 /** | 123 /** |
| 124 * @param {number} value | 124 * @param {number} value |
| 125 * @param {string} units | 125 * @param {string} units |
| 126 * @param {number} digits | 126 * @param {number} number of digits after decimal. |
| 127 * @return {string} Formatted number. | 127 * @return {string} Formatted number. |
| 128 */ | 128 */ |
| 129 function formatStatNumber(value, units, digits) { | 129 function formatStatNumber(value, units, digits) { |
| 130 if (value != undefined) { | 130 if (value != undefined) { |
| 131 return value.toFixed(digits) + ' ' + units; | 131 return value.toFixed(digits) + ' ' + units; |
| 132 } else { | 132 } else { |
| 133 return "n/a"; | 133 return "n/a"; |
| 134 } | 134 } |
| 135 } | 135 } |
| 136 | 136 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 149 '(avg, max in ms) ' + | 149 '(avg, max in ms) ' + |
| 150 formatStat('Capture', stats.captureLatency, stats.maxCaptureLatency) + | 150 formatStat('Capture', stats.captureLatency, stats.maxCaptureLatency) + |
| 151 formatStat('Encode', stats.encodeLatency, stats.maxEncodeLatency) + | 151 formatStat('Encode', stats.encodeLatency, stats.maxEncodeLatency) + |
| 152 formatStat('Decode', stats.decodeLatency, stats.maxDecodeLatency) + | 152 formatStat('Decode', stats.decodeLatency, stats.maxDecodeLatency) + |
| 153 formatStat('Render', stats.renderLatency, stats.maxRenderLatency) + | 153 formatStat('Render', stats.renderLatency, stats.maxRenderLatency) + |
| 154 formatStat('RTT', stats.roundtripLatency, stats.maxRoundtripLatency) + | 154 formatStat('RTT', stats.roundtripLatency, stats.maxRoundtripLatency) + |
| 155 'Bandwidth: ' + formatStatNumber(videoBandwidth, units, 2) + '; ' + | 155 'Bandwidth: ' + formatStatNumber(videoBandwidth, units, 2) + '; ' + |
| 156 'Frame Rate: ' + formatStatNumber(stats.videoFrameRate, 'fps', 1) | 156 'Frame Rate: ' + formatStatNumber(stats.videoFrameRate, 'fps', 1) |
| 157 ); | 157 ); |
| 158 }; | 158 }; |
| OLD | NEW |