Backed out changeset 5ea64b6ba89b (bug 889201) for too-frequent failures

This commit is contained in:
Phil Ringnalda 2013-07-05 14:24:50 -07:00
parent 1bdf54b41d
commit 1023514931
5 changed files with 14 additions and 115 deletions

View file

@ -262,27 +262,24 @@ already_AddRefed<VideoPlaybackQuality>
HTMLVideoElement::GetVideoPlaybackQuality() HTMLVideoElement::GetVideoPlaybackQuality()
{ {
DOMHighResTimeStamp creationTime = 0; DOMHighResTimeStamp creationTime = 0;
nsPIDOMWindow* window = OwnerDoc()->GetInnerWindow();
if (window) {
nsPerformance* perf = window->GetPerformance();
if (perf) {
creationTime = perf->GetDOMTiming()->TimeStampToDOMHighRes(TimeStamp::Now());
}
}
uint64_t totalFrames = 0; uint64_t totalFrames = 0;
uint64_t droppedFrames = 0; uint64_t droppedFrames = 0;
uint64_t corruptedFrames = 0; uint64_t corruptedFrames = 0;
double playbackJitter = 0.0; double playbackJitter = 0.0;
if (mDecoder && sVideoStatsEnabled) {
if (sVideoStatsEnabled) { MediaDecoder::FrameStatistics& stats = mDecoder->GetFrameStatistics();
nsPIDOMWindow* window = OwnerDoc()->GetInnerWindow(); totalFrames = stats.GetParsedFrames();
if (window) { droppedFrames = totalFrames - stats.GetPresentedFrames();
nsPerformance* perf = window->GetPerformance(); corruptedFrames = totalFrames - stats.GetDecodedFrames();
if (perf) { playbackJitter = stats.GetPlaybackJitter();
creationTime = perf->GetDOMTiming()->TimeStampToDOMHighRes(TimeStamp::Now());
}
}
if (mDecoder) {
MediaDecoder::FrameStatistics& stats = mDecoder->GetFrameStatistics();
totalFrames = stats.GetParsedFrames();
droppedFrames = totalFrames - stats.GetPresentedFrames();
corruptedFrames = totalFrames - stats.GetDecodedFrames();
playbackJitter = stats.GetPlaybackJitter();
}
} }
nsRefPtr<VideoPlaybackQuality> playbackQuality = nsRefPtr<VideoPlaybackQuality> playbackQuality =

View file

@ -141,8 +141,6 @@ MOCHITEST_FILES = \
test_texttrackcue.html \ test_texttrackcue.html \
test_timeupdate_small_files.html \ test_timeupdate_small_files.html \
test_unseekable.html \ test_unseekable.html \
test_VideoPlaybackQuality.html \
test_VideoPlaybackQuality_disabled.html \
test_webvtt_disabled.html \ test_webvtt_disabled.html \
$(NULL) $(NULL)

View file

@ -1,62 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test basic functionality of VideoPlaybackQuality</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<pre id="test">
<script class="testbody" type="text/javascript">
SimpleTest.waitForExplicitFinish();
function test() {
var video = document.createElement("video");
ok(video.getVideoPlaybackQuality, "getVideoPlaybackQuality should be exposed with pref set");
var vpq = video.getVideoPlaybackQuality();
ok(vpq, "getVideoPlaybackQuality should return an object");
ok(vpq.creationTime <= performance.now(), "creationTime should be in the past");
is(vpq.totalVideoFrames, 0, "totalVideoFrames should be 0");
is(vpq.droppedVideoFrames, 0, "droppedVideoFrames should be 0");
is(vpq.corruptedVideoFrames, 0, "corruptedVideoFrames should be 0");
is(vpq.playbackJitter, 0, "playbackJitter should be 0");
var vpq2 = video.getVideoPlaybackQuality();
ok(vpq !== vpq2, "getVideoPlaybackQuality should return a new object");
ok(vpq.creationTime <= vpq2.creationTime, "VideoPlaybackQuality objects should have increasing creationTime");
var audio = document.createElement("audio");
ok(!audio.getVideoPlaybackQuality, "getVideoPlaybackQuality should not be available on Audio elements");
video.src = "seek.webm";
video.play();
video.addEventListener("ended", function () {
vpq = video.getVideoPlaybackQuality();
ok(vpq.creationTime <= performance.now(), "creationTime should be in the past");
ok(vpq.totalVideoFrames > 0, "totalVideoFrames should be > 0");
ok(vpq.droppedVideoFrames >= 0, "droppedVideoFrames should be >= 0");
ok(vpq.corruptedVideoFrames >= 0, "corruptedVideoFrames should be >= 0");
ok(vpq.playbackJitter >= 0, "playbackJitter should be >= 0");
SpecialPowers.pushPrefEnv({"set": [["media.video_stats.enabled", false]]}, function () {
vpq = video.getVideoPlaybackQuality();
is(vpq.creationTime, 0, "creationTime should be 0");
is(vpq.totalVideoFrames, 0, "totalVideoFrames should be 0");
is(vpq.droppedVideoFrames, 0, "droppedVideoFrames should be 0");
is(vpq.corruptedVideoFrames, 0, "corruptedVideoFrames should be 0");
is(vpq.playbackJitter, 0, "playbackJitter should be 0");
});
SimpleTest.finish();
});
}
addLoadEvent(function() {
SpecialPowers.pushPrefEnv({"set": [["media.mediasource.enabled", true]]}, test);
});
</script>
</pre>
</body>
</html>

View file

@ -1,33 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test basic functionality of VideoPlaybackQuality</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<pre id="test">
<script class="testbody" type="text/javascript">
SimpleTest.waitForExplicitFinish();
function test() {
var video = document.createElement("video");
ok(!video.getVideoPlaybackQuality, "getVideoPlaybackQuality should be hidden behind a pref");
var accessThrows = false;
try {
video.getVideoPlaybackQuality();
} catch (e) {
accessThrows = true;
}
ok(accessThrows, "getVideoPlaybackQuality should be hidden behind a pref");
SimpleTest.finish();
}
addLoadEvent(function() {
SpecialPowers.pushPrefEnv({"set": [["media.mediasource.enabled", false]]}, test);
});
</script>
</pre>
</body>
</html>

View file

@ -12,7 +12,6 @@
[Pref="media.mediasource.enabled"] [Pref="media.mediasource.enabled"]
interface VideoPlaybackQuality { interface VideoPlaybackQuality {
readonly attribute DOMHighResTimeStamp creationTime;
readonly attribute unsigned long totalVideoFrames; readonly attribute unsigned long totalVideoFrames;
readonly attribute unsigned long droppedVideoFrames; readonly attribute unsigned long droppedVideoFrames;
readonly attribute unsigned long corruptedVideoFrames; readonly attribute unsigned long corruptedVideoFrames;