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

Side by Side Diff: chrome/test/data/media/html/media_fps_perf.html

Issue 9464004: Fix CPU and memory perf PyAuto test running on av_perf. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Run each video once. Created 8 years, 9 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
OLDNEW
1 <!-- Used by media_fps_perf to calculate <video> performance statistics. --> 1 <!-- Used by media_stat_perf to calculate <video> performance statistics. -->
2 2
3 <!DOCTYPE html> 3 <!DOCTYPE html>
4 <html lang="en-US"> 4 <html lang="en-US">
5 <head> 5 <head>
6 <title>FPS Perf Test</title> 6 <title>CPU, Memory, and FPS Perf Test</title>
7 </head> 7 </head>
8 <body> 8 <body>
9 <div id="log"> 9 <div id="log">
10 Decoded frames: 0 Avg: 0<br> 10 Decoded frames: 0 Avg: 0<br>
11 Dropped frames: 0 Avg: 0<br> 11 Dropped frames: 0 Avg: 0<br>
12 </div> 12 </div>
13 <video preload controls></video> 13 <video preload controls></video>
14 </body> 14 </body>
15 15
16 <script type="text/javascript"> 16 <script type="text/javascript">
17 var video = document.querySelector("video"); 17 var video = document.querySelector("video");
18 18 // Set to true to record FPS stats.
DaleCurtis 2012/03/01 02:47:11 Is this necessary anymore?
shadi 2012/03/01 19:17:33 Done.
19 var decodedFrames = 0; 19 var statsEnabled = false;
20 var droppedFrames = 0;
21 var decodedFPS = [];
22 var droppedFPS = [];
23 var startTime = 0;
24 var intID = 0; // interval ID, used to end the window intervals.
25 20
26 function calculateStats() { 21 function calculateStats() {
27 if (video.readyState <= HTMLMediaElement.HAVE_CURRENT_DATA || 22 if (video.readyState <= HTMLMediaElement.HAVE_CURRENT_DATA ||
28 video.paused || video.ended) 23 video.paused || video.ended)
29 return; 24 return;
30 25
31 currentTime = new Date().getTime(); 26 currentTime = new Date().getTime();
32 deltaTime = (currentTime - startTime) / 1000; 27 deltaTime = (currentTime - startTime) / 1000;
33 startTime = currentTime; 28 startTime = currentTime;
34 29
(...skipping 14 matching lines...) Expand all
49 "Dropped frames: " + droppedFrames + 44 "Dropped frames: " + droppedFrames +
50 " Avg: " + droppedFPS + " fps.<br>"; 45 " Avg: " + droppedFPS + " fps.<br>";
51 } 46 }
52 47
53 video.addEventListener("playing", function(event) { 48 video.addEventListener("playing", function(event) {
54 decodedFrames = 0; 49 decodedFrames = 0;
55 droppedFrames = 0; 50 droppedFrames = 0;
56 decodedFPS = []; 51 decodedFPS = [];
57 droppedFPS = []; 52 droppedFPS = [];
58 startTime = new Date().getTime(); 53 startTime = new Date().getTime();
59 intID = window.setInterval(calculateStats, 1000); 54 if (statsEnabled)
55 intID = window.setInterval(calculateStats, 1000);
60 }); 56 });
61 57
62 video.addEventListener("error", function() { endTest(false); }, false); 58 video.addEventListener("error", function() { endTest(false); }, false);
63 video.addEventListener("ended", function() { endTest(true); }, false); 59 video.addEventListener("ended", function() { endTest(true); }, false);
64 60
65 function endTest(successFlag) { 61 function endTest(successFlag) {
66 window.clearInterval(intID); 62 window.clearInterval(intID);
67 // Notify PyAuto that we've completed the test run. 63 // Notify PyAuto that we've completed the test run.
68 if (window.domAutomationController) 64 if (window.domAutomationController)
69 window.domAutomationController.send(successFlag); 65 window.domAutomationController.send(successFlag);
70 } 66 }
71 67
72 function startTest(url) { 68 function startTest(url, recordStats) {
73 // End any previously started tests. 69 statsEnabled = recordStats;
74 window.clearInterval(intID);
75 70
76 video.src = url; 71 video.src = url;
77 video.play(); 72 video.play();
78 } 73 }
79 </script> 74 </script>
80 </html> 75 </html>
OLDNEW
« no previous file with comments | « no previous file | chrome/test/functional/media/media_fps_perf.py » ('j') | chrome/test/functional/media/media_fps_perf.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698