Bug 1537554 - part3 : do not collect negative length cue for other cues. r=jya

Cue might have negative length because user can set cue's end time via `TextTrackCue`'s API and the spec doesn't have strong restriction that the end time should be equal or larger than the start time of the cue.

As the negative length cue won't be displayed, we have no need to add it to the `other cues`.

[1] https://html.spec.whatwg.org/multipage/media.html#dom-texttrackcue-endtime

Differential Revision: https://phabricator.services.mozilla.com/D24857

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Alastor Wu 2019-03-27 04:02:35 +00:00
Родитель 2cd2a3b167
Коммит 9a32fc38c2
3 изменённых файлов: 9 добавлений и 8 удалений

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

@ -318,6 +318,13 @@ void TextTrack::GetCurrentCuesAndOtherCues(
cue->StartTime(), cue->EndTime());
aCurrentCues->AddCue(*cue);
} else {
// Negative length cue, which is possible because user can set cue's end
// time arbitrary.
if (cue->EndTime() < cue->StartTime()) {
WEBVTT_LOG("[BAD TIME] skip cue %p [%f:%f] with negative length",
cue, cue->StartTime(), cue->EndTime());
continue;
}
media::TimeInterval cueInterval(
media::TimeUnit::FromSeconds(cue->StartTime()),
media::TimeUnit::FromSeconds(cue->EndTime()));

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

@ -1,6 +0,0 @@
[track-cues-missed.html]
disabled:
if (os == 'win' and processor == 'aarch64'): https://bugzilla.mozilla.org/show_bug.cgi?id=1538303
[Events are triggered for missed (skipped) cues during normal playback]
expected: FAIL

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

@ -45,7 +45,7 @@
video.play();
}
function cueEnteredOrExited() {
function cueEnteredOrExited(event) {
var currentCue = event.target;
assert_equals(testTrack.track.cues.getCueById(cueCount).text, currentCue.text);
assert_equals(currentCue.id, cueCount.toString());
@ -56,4 +56,4 @@
});
</script>
</video>
</video>