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

Unified Diff: chrome/test/data/media/eme_player_js/fps_observer.js

Issue 408993002: Have media content and chrome browser tests load data from media/test/data (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/test/data/media/eme_player_js/fps_observer.js
diff --git a/chrome/test/data/media/eme_player_js/fps_observer.js b/chrome/test/data/media/eme_player_js/fps_observer.js
deleted file mode 100644
index 8226df8bee1db87c3e39c5a105d5b10a74c3a81c..0000000000000000000000000000000000000000
--- a/chrome/test/data/media/eme_player_js/fps_observer.js
+++ /dev/null
@@ -1,67 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// FPSObserver observes a <video> and reports decoded FPS, dropped FPS, and
-// total dropped frames during the video playback.
-var FPSObserver = new function() {
- this.video_ = null;
- this.decodedFrames_ = 0;
- this.droppedFrames_ = 0;
- this.startTime_ = 0;
- this.intID_ = null;
-}
-
-FPSObserver.observe = function(video) {
- this.video_ = video;
- var observer = this;
- this.video_.addEventListener('playing', function() {
- observer.onVideoPlaying();
- });
-
- this.video_.addEventListener('error', function() {
- observer.endTest();
- });
-
- this.video_.addEventListener('ended', function() {
- observer.endTest();
- });
-};
-
-FPSObserver.onVideoPlaying = function() {
- this.decodedFrames_ = 0;
- this.droppedFrames_ = 0;
- this.startTime_ = window.performance.now();
- this.endTest(true);
- var observer = this;
- this.intID_ = window.setInterval(function() {
- observer.calculateStats();}, 1000);
-};
-
-FPSObserver.calculateStats = function() {
- if (this.video_.readyState <= HTMLMediaElement.HAVE_CURRENT_DATA ||
- this.video_.paused || this.video_.ended)
- return;
- var currentTime = window.performance.now();
- var deltaTime = (currentTime - this.startTime_) / 1000;
- this.startTime_ = currentTime;
-
- // Calculate decoded frames per sec.
- var fps = (this.video_.webkitDecodedFrameCount - this.decodedFrames_) /
- deltaTime;
- this.decodedFrames_ = this.video_.webkitDecodedFrameCount;
- fps = fps.toFixed(2);
- decodedFPSElement.innerHTML = fps;
-
- // Calculate dropped frames per sec.
- fps = (this.video_.webkitDroppedFrameCount - this.droppedFrames_) / deltaTime;
- this.droppedFrames_ = this.video_.webkitDroppedFrameCount;
- fps = fps.toFixed(2);
- droppedFPSElement.innerHTML = fps;
-
- droppedFramesElement.innerHTML = this.droppedFrames_;
-};
-
-FPSObserver.endTest = function() {
- window.clearInterval(this.intID_);
-};
« no previous file with comments | « chrome/test/data/media/eme_player_js/file_io_test_player.js ('k') | chrome/test/data/media/eme_player_js/globals.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698