Bug 1279865 - Don't run TimeMarchesOn if the MediaElement is not played. r=rillian

1. If mHasUserInteraction MediaElement is false, don't run the TimeMarchesOn because the element is not played. 2. Update the activeCueList only in TimeMarchesOn(). 3. Run TimeMarchesOn() at the beginning of play. r=rillian

MozReview-Commit-ID: BhwsIfRm3B2
This commit is contained in:
bechen
2016-06-30 13:31:56 +08:00
parent 329077ec22
commit a475af3cfd
4 changed files with 12 additions and 6 deletions

View File

@@ -524,7 +524,8 @@ TextTrackManager::DispatchTimeMarchesOn()
// enqueue the current playback position and whether only that changed
// through its usual monotonic increase during normal playback; current
// executing call upon completion will check queue for further 'work'.
if (!mTimeMarchesOnDispatched && !mShutdown) {
if (!mTimeMarchesOnDispatched && !mShutdown &&
(mMediaElement->GetHasUserInteraction() || mMediaElement->IsCurrentlyPlaying())) {
NS_DispatchToMainThread(NewRunnableMethod(this, &TextTrackManager::TimeMarchesOn));
mTimeMarchesOnDispatched = true;
}
@@ -570,6 +571,7 @@ TextTrackManager::TimeMarchesOn()
TextTrack* ttrack = mTextTracks->IndexedGetter(index, dummy);
if (ttrack && dummy) {
// TODO: call GetCueListByTimeInterval on mNewCues?
ttrack->UpdateActiveCueList();
TextTrackCueList* activeCueList = ttrack->GetActiveCues();
if (activeCueList) {
for (uint32_t i = 0; i < activeCueList->Length(); ++i) {