diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /dom/media/mediasource/test/test_BufferingWait.html | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/media/mediasource/test/test_BufferingWait.html')
-rw-r--r-- | dom/media/mediasource/test/test_BufferingWait.html | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/dom/media/mediasource/test/test_BufferingWait.html b/dom/media/mediasource/test/test_BufferingWait.html new file mode 100644 index 000000000..8d45132b4 --- /dev/null +++ b/dom/media/mediasource/test/test_BufferingWait.html @@ -0,0 +1,56 @@ +<!DOCTYPE html> +<html><head> +<meta http-equiv="content-type" content="text/html; charset=windows-1252"> + <title>MSE: Don't get stuck buffering for too long when we have frames to show</title> + <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> + <script type="text/javascript" src="mediasource.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(); + +var receivedSourceOpen = false; +runWithMSE(function(ms, v) { + ms.addEventListener("sourceopen", function() { + ok(true, "Receive a sourceopen event"); + ok(!receivedSourceOpen, "Should only receive one sourceopen for this test"); + receivedSourceOpen = true; + var sb = ms.addSourceBuffer("video/webm"); + ok(sb, "Create a SourceBuffer"); + + fetchWithXHR("seek.webm", function(arrayBuffer) { + sb.addEventListener('error', (e) => { ok(false, "Got Error: " + e); SimpleTest.finish(); }); + loadSegment.bind(null, sb, new Uint8Array(arrayBuffer, 0, 318))().then( + loadSegment.bind(null, sb, new Uint8Array(arrayBuffer, 318, 25523-318))).then( + loadSegment.bind(null, sb, new Uint8Array(arrayBuffer, 25523, 46712-25523))).then( + /* Note - Missing |46712, 67833 - 46712| segment here corresponding to (0.8, 1.2] */ + /* Note - Missing |67833, 88966 - 67833| segment here corresponding to (1.2, 1.6] */ + loadSegment.bind(null, sb, new Uint8Array(arrayBuffer, 88966))).then(function() { + // 0.767 is the time of the last video sample +- 40ms. + var promise = waitUntilTime(v, .767-0.04); + info("Playing video. It should play for a bit, then fire 'waiting'"); + v.play(); + return promise; + }).then(function() { + window.firstStop = Date.now(); + loadSegment(sb, new Uint8Array(arrayBuffer, 46712, 67833 - 46712)); + return waitUntilTime(v, 1.167-0.04); + }).then(function() { + var waitDuration = (Date.now() - window.firstStop) / 1000; + ok(waitDuration < 15, "Should not spend an inordinate amount of time buffering: " + waitDuration); + SimpleTest.finish(); + /* If we allow the rest of the stream to be played, we get stuck at + around 2s. See bug 1093133. + once(v, 'ended', SimpleTest.finish.bind(SimpleTest)); + return loadSegment(sb, new Uint8Array(arrayBuffer, 67833, 88966 - 67833)); + */ + }); + }); + }); +}); +</script> +</pre> +</body> +</html> |