Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Side by Side Diff: remoting/webapp/base/js/connection_stats.js

Issue 1941983002: Guard against undefined average in stats display. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 } 134 }
135 } 135 }
136 136
137 /** 137 /**
138 * @param {string} type 138 * @param {string} type
139 * @param {number} avg 139 * @param {number} avg
140 * @param {number} max 140 * @param {number} max
141 * @return {string} "type: avg, max; " e.g. "RTT: 8.0, 13; " 141 * @return {string} "type: avg, max; " e.g. "RTT: 8.0, 13; "
142 */ 142 */
143 function formatStat(type, avg, max) { 143 function formatStat(type, avg, max) {
144 return type + ': ' + avg.toFixed(1) + ', ' + max + '; '; 144 var avgStr = (avg == undefined) ? 'n/a' : avg.toFixed(1);
145 return type + ': ' + avgStr + ', ' + max + '; ';
145 } 146 }
146 147
147 var statistics = document.getElementById('statistics'); 148 var statistics = document.getElementById('statistics');
148 this.statsElement_.innerText = ( 149 this.statsElement_.innerText = (
149 '(avg, max in ms) ' + 150 '(avg, max in ms) ' +
150 formatStat('Capture', stats.captureLatency, stats.maxCaptureLatency) + 151 formatStat('Capture', stats.captureLatency, stats.maxCaptureLatency) +
151 formatStat('Encode', stats.encodeLatency, stats.maxEncodeLatency) + 152 formatStat('Encode', stats.encodeLatency, stats.maxEncodeLatency) +
152 formatStat('Decode', stats.decodeLatency, stats.maxDecodeLatency) + 153 formatStat('Decode', stats.decodeLatency, stats.maxDecodeLatency) +
153 formatStat('Render', stats.renderLatency, stats.maxRenderLatency) + 154 formatStat('Render', stats.renderLatency, stats.maxRenderLatency) +
154 formatStat('RTT', stats.roundtripLatency, stats.maxRoundtripLatency) + 155 formatStat('RTT', stats.roundtripLatency, stats.maxRoundtripLatency) +
155 'Bandwidth: ' + formatStatNumber(videoBandwidth, units, 2) + '; ' + 156 'Bandwidth: ' + formatStatNumber(videoBandwidth, units, 2) + '; ' +
156 'Frame Rate: ' + formatStatNumber(stats.videoFrameRate, 'fps', 1) 157 'Frame Rate: ' + formatStatNumber(stats.videoFrameRate, 'fps', 1)
157 ); 158 );
158 }; 159 };
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698