Bug 1619729 [wpt PR 22071] - Give blink::CueTimeline a timer for precisely handling cue events, a=testonly

Automatic update from web-platform-tests
Give blink::CueTimeline a timer for precisely handling cue events

Cue-related events (enter, exit, cuechange) are fired up to 250ms late,
and there is a similar latency in their display which is quite
noticeable.

The underlying problem is that we only update cues alongside the
`timeupdate` event, which is fixed at 4 Hz.

My solution is to add a separate timer to CueTimeline
(`CueTimeline::cue_event_timer_`) which is given a timeout for the
next cue event based on the current playback position and rate. This
allows for significantly more precise cue timing accuracy without a
significant performance penalty.

Additionally, several web tests were written with the expectation that
the 'time marches on' algorithm is run before video playback begins
(ie, upon loading text track cues). This behavior is not in accordance
with the spec (as outlined in crbug/1050767), so this CL fixes those
expectations and adds a new test to prevent regressing.

Bug: 576310, 1050767
Change-Id: I675f5f030a68ba9cee10e12b3e79a9b174048193
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2008079
Commit-Queue: Will Cassella <cassew@google.com>
Reviewed-by: Fredrik Söderquist <fs@opera.com>
Cr-Commit-Position: refs/heads/master@{#800148}

--

wpt-commits: 093d4eed8ba6b92f205f35d80ad91a750bbd4a2d
wpt-pr: 22071
This commit is contained in:
Will Cassella 2020-08-26 08:51:34 +00:00 коммит произвёл moz-wptsync-bot
Родитель f2e8271638
Коммит 8cba29d20f
2 изменённых файлов: 28 добавлений и 1 удалений

Просмотреть файл

@ -0,0 +1,27 @@
<!DOCTYPE html>
<title>Ensure that the 'cuechange' event is not fired before video playback has begun.</title>
<script src="/common/media.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
promise_test(function(t) {
let video = document.createElement('video');
video.src = getVideoURI('/media/movie_5');
video.preload = 'auto';
// Create a track element. The 'cuechange' event should not be fired.
let track = document.createElement('track');
track.oncuechange = t.unreached_func('The \`cuechange\` event should not be fired');
let videoWatcher = new EventWatcher(t, video, 'canplaythrough');
let trackWatcher = new EventWatcher(t, track, ['cuechange', 'load'])
track.src = 'resources/captions-fast.vtt';
track.kind = 'captions';
track.default = true;
track.track.mode = 'showing';
video.appendChild(track);
return Promise.all([videoWatcher.wait_for('canplaythrough'), trackWatcher.wait_for('load')]);
});
</script>

Просмотреть файл

@ -26,7 +26,7 @@ async_test(function(t) {
trackElement.oncuechange = t.step_func(eventCallback);
video.oncanplaythrough = t.step_func(eventCallback);
video.onerror = t.step_func_done(function() {
video.onerror = t.step_func_done(function(event) {
assert_equals(event.target, video);
assert_not_equals(video.error, null);
assert_equals(video.error.code, MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED);