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

Unified Diff: tools/perf/metrics/media.js

Issue 70333004: Telemetry: make media perf tests log errors rather than timing out (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/perf/metrics/media.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/perf/metrics/media.js
diff --git a/tools/perf/metrics/media.js b/tools/perf/metrics/media.js
index f2d466f615d282e8897ea46d95d5d2f15b23cd1c..4a1f6c7c3e0f33fbab92fc8c2f4463decc9aadd2 100644
--- a/tools/perf/metrics/media.js
+++ b/tools/perf/metrics/media.js
@@ -123,12 +123,17 @@
};
HTMLMediaMetric.prototype.getMetrics = function() {
- this.metrics['decoded_frame_count'] = this.element.webkitDecodedFrameCount;
- this.metrics['dropped_frame_count'] = this.element.webkitDroppedFrameCount;
+ var decodedFrames = this.element.webkitDecodedFrameCount;
+ var droppedFrames = this.element.webkitDroppedFrameCount;
+ // Audio media does not report decoded/dropped frame count
+ if (decodedFrames != undefined)
+ this.metrics['decoded_frame_count'] = decodedFrames;
+ if (droppedFrames != undefined)
+ this.metrics['dropped_frame_count'] = droppedFrames;
this.metrics['decoded_video_bytes'] =
- this.element.webkitVideoDecodedByteCount;
+ this.element.webkitVideoDecodedByteCount || 0;
this.metrics['decoded_audio_bytes'] =
- this.element.webkitAudioDecodedByteCount;
+ this.element.webkitAudioDecodedByteCount || 0;
return this.metrics;
};
@@ -157,10 +162,16 @@
function checkElementIsNotBound(element) {
if (!element)
return;
+ if (getMediaMetric(element))
+ throw new Error('Can not create MediaMetric for same element twice.');
+ }
+
+ function getMediaMetric(element) {
for (var i = 0; i < window.__mediaMetrics.length; i++) {
if (window.__mediaMetrics[i].element == element)
- throw new Error('Can not create MediaMetric for same element twice.');
+ return window.__mediaMetrics[i];
}
+ return null;
}
function createMediaMetricsForDocument() {
@@ -192,6 +203,7 @@
window.__globalCounter = 0;
window.__mediaMetrics = [];
+ window.__getMediaMetric = getMediaMetric;
window.__getAllMetrics = getAllMetrics;
window.__createMediaMetricsForDocument = createMediaMetricsForDocument;
})();
« no previous file with comments | « no previous file | tools/perf/metrics/media.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698