in 2020/media/sphericalOnCobaltTest.js [107:163]
test.prototype.start = function(runner, video) {
var self = this;
var frameRateCount = 0;
var averageFps = 0;
if (!util.isCobalt()) {
runner.fail('Device is not Cobalt.');
} else if (!checkForMapToMeshSupport()) {
runner.fail("No map-to-mesh support on Cobalt.");
}
if (!isTypeSupported(videoStream))
runner.fail('Format is not supported.');
var videoPerfMetrics = new VideoPerformanceMetrics(video);
if (!videoPerfMetrics.supportsVideoPerformanceMetrics()) {
runner.fail('UserAgent needs to support ' +
'\'video.getVideoPlaybackQuality\' or the combined ' +
'\'video.webkitDecodedFrameCount\'' +
'and video.webkitDroppedFrameCount to execute this test.');
}
setUpStyle(video);
setupMse(video, runner, videoStream, Media.AAC.AudioNormal);
video.addEventListener('timeupdate', function onTimeUpdate(e) {
frameRateCount++;
averageFps += getFPS();
if (!video.paused && video.currentTime >= 15) {
video.removeEventListener('timeupdate', onTimeUpdate);
video.pause();
averageFps = averageFps / frameRateCount;
var droppedFrames = videoPerfMetrics.getDroppedVideoFrames();
var minFps = Math.min(
(videoPerfMetrics.getTotalDecodedVideoFrames() - droppedFrames) /
video.currentTime,
averageFps);
test.prototype.status =
'(' + droppedFrames.toFixed(2) + ', ' + minFps.toFixed(2) + ')';
runner.updateStatus();
if (minFps <= 0) {
runner.fail('UserAgent was unable to render any frames.');
}
// Screen refresh rates are capped at 60 so we shouldn't expect
// greater than 60 fps perfomance.
if (videoStream.get('fps') < 56) {
var threshold = 0.994;
runner.checkGE(
minFps, videoStream.get('fps') * threshold, 'Video frame rate');
} else {
runner.checkGE(minFps, 56, 'Video frame rate');
}
runner.checkLE(droppedFrames, 1, 'Total dropped frames');
runner.succeed();
}
});
video.play();
};