Bug 1280814 - Prevent the media::Interval crash due to the unexpected playback position. r=rillian

MozReview-Commit-ID: AZ9Gb2Y0wDF

--HG--
extra : transplant_source : %8F%FD%8EW%F2%23%0Ck%A5%A4x%FAB%3D%C3%25%09%89%84%A5
This commit is contained in:
bechen 2016-06-20 15:58:58 +08:00
Родитель de8073afbb
Коммит 385d3a7e3b
3 изменённых файлов: 22 добавлений и 0 удалений

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

@ -797,6 +797,10 @@ void HTMLMediaElement::AbortExistingLoads()
AddRemoveSelfReference();
mIsRunningSelectResource = false;
if (mTextTrackManager) {
mTextTrackManager->NotifyReset();
}
}
void HTMLMediaElement::NoSupportedMediaSourceError()

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

@ -527,6 +527,11 @@ TextTrackManager::TimeMarchesOn()
mTimeMarchesOnDispatched = false;
// Early return if we don't have any TextTracks.
if (mTextTracks->Length() == 0) {
return;
}
nsISupports* parentObject =
mMediaElement->OwnerDoc()->GetParentObject();
if (NS_WARN_IF(!parentObject)) {
@ -564,6 +569,11 @@ TextTrackManager::TimeMarchesOn()
}
// Populate otherCues with 'non-active" cues.
if (hasNormalPlayback) {
if (currentPlaybackTime < mLastTimeMarchesOnCalled) {
// TODO: Add log and find the root cause why the
// playback position goes backward.
mLastTimeMarchesOnCalled = currentPlaybackTime;
}
media::Interval<double> interval(mLastTimeMarchesOnCalled,
currentPlaybackTime);
otherCues = mNewCues->GetCueListByTimeInterval(interval);;
@ -718,5 +728,11 @@ TextTrackManager::NotifyCueUpdated(TextTrackCue *aCue)
DispatchTimeMarchesOn();
}
void
TextTrackManager::NotifyReset()
{
mLastTimeMarchesOnCalled = 0.0;
}
} // namespace dom
} // namespace mozilla

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

@ -100,6 +100,8 @@ public:
void NotifyCueUpdated(TextTrackCue *aCue);
void NotifyReset();
private:
/**
* Converts the TextTrackCue's cuetext into a tree of DOM objects