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

MozReview-Commit-ID: AZ9Gb2Y0wDF
This commit is contained in:
bechen
2016-06-20 15:58:58 +08:00
parent 5b4415d6cb
commit 835da4b871
3 changed files with 22 additions and 0 deletions

View File

@@ -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