Commit 8ac85c7f authored by Thomas Guilbert's avatar Thomas Guilbert Committed by Commit Bot

Ensure seek completes before ending test

The fix in 0b6135a7 introduced a new
flake. It's possible for the video.rAF callback to be fired by the
second video's first frame size, before the seek even completes.

This CL fixes the issue by queueing the video.rAF call for the second
frame size after the first frame size has painted.

Bug: 993671
Change-Id: Iecf1601cdc5b76361ddfb9a62a718092ace90468
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2033628
Commit-Queue: Thomas Guilbert <tguilbert@chromium.org>
Auto-Submit: Thomas Guilbert <tguilbert@chromium.org>
Reviewed-by: default avatarDale Curtis <dalecurtis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#741698}
parent f24cf4fa
......@@ -17,7 +17,7 @@
}
let numVideosRendered = 0;
function waitForRender(time, dict) {
function waitForRender() {
if(++numVideosRendered == 2)
testRunner.notifyDone();
}
......@@ -50,21 +50,28 @@
response = await fetch('/media/resources/media-source/webm/test-v-128k-640x480-30fps-10kfr.webm');
let videoData480p = await response.arrayBuffer();
// Set up the first video with content of a single size.
// Queue a requestAnimationFrame() before appending buffers in order not to
// miss any frames.
let singleSizeVideo = document.getElementById('single_size');
singleSizeVideo.requestAnimationFrame(waitForRender);
// Set up the first video with content of a single size.
let ss_sourceBuffer = await setupMse(singleSizeVideo, 'video/webm; codecs="vp8"');
await appendBuffer(ss_sourceBuffer, videoData240p);
singleSizeVideo.requestAnimationFrame(waitForRender);
// Setup the second video with a single size for 1 second, followed by a larger size for 2 additional seconds.
// Wait for a frame of the first size to be painted. Then seek beyond the first size.
let mixedSizeVideo = document.getElementById('mixed_size');
mixedSizeVideo.requestAnimationFrame(_=> {
mixedSizeVideo.requestAnimationFrame(waitForRender);
mixedSizeVideo.currentTime = 2;
});
// Setup the second video with a single size for 1 second, followed by a larger size for 2 additional seconds.
let ms_sourceBuffer = await setupMse(mixedSizeVideo, 'video/webm; codecs="vp8"');
await appendBuffer(ms_sourceBuffer, videoData240p);
ms_sourceBuffer.timestampOffset = 1;
await appendBuffer(ms_sourceBuffer, videoData480p);
// Seek the second video beyond the first size.
mixedSizeVideo.currentTime = 2;
mixedSizeVideo.requestAnimationFrame(waitForRender);
})();
</script>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment