Bug 1548923 - part5 : run TimeMarchesOn in correct order r=jya

To run `TimeMarchesOn` in correct spec's steps order.

Differential Revision: https://phabricator.services.mozilla.com/D30391
This commit is contained in:
alwu
2019-05-09 01:34:57 +00:00
parent 49349cef06
commit e3d96b1fe4

View File

@@ -625,12 +625,6 @@ void TextTrackManager::TimeMarchesOn() {
return;
}
nsISupports* parentObject = mMediaElement->OwnerDoc()->GetParentObject();
if (NS_WARN_IF(!parentObject)) {
return;
}
nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(parentObject);
if (mMediaElement->ReadyState() == HTMLMediaElement_Binding::HAVE_NOTHING) {
WEBVTT_LOG(
"TimeMarchesOn return because media doesn't contain any data yet");
@@ -642,6 +636,15 @@ void TextTrackManager::TimeMarchesOn() {
return;
}
// Step 1, 2.
nsISupports* parentObject = mMediaElement->OwnerDoc()->GetParentObject();
if (NS_WARN_IF(!parentObject)) {
return;
}
nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(parentObject);
RefPtr<TextTrackCueList> currentCues = new TextTrackCueList(window);
RefPtr<TextTrackCueList> otherCues = new TextTrackCueList(window);
// Step 3.
auto currentPlaybackTime =
media::TimeUnit::FromSeconds(mMediaElement->CurrentTime());
@@ -653,10 +656,6 @@ void TextTrackManager::TimeMarchesOn() {
mLastTimeMarchesOnCalled.ToSeconds(), currentPlaybackTime.ToSeconds(),
hasNormalPlayback);
// Step 1, 2.
RefPtr<TextTrackCueList> currentCues = new TextTrackCueList(window);
RefPtr<TextTrackCueList> otherCues = new TextTrackCueList(window);
// The reason we collect other cues is (1) to change active cues to inactive,
// (2) find missing cues, so we actually no need to process all cues. We just
// need to handle cues which are in the time interval [lastTime:currentTime]