Bug 1372715 - TimeMarchesOn step 1, fix the EndTime check for "current cue". r=rillian draft
authorbechen <bechen@mozilla.com>
Fri, 16 Jun 2017 10:48:14 +0800
changeset 595111 5396f932da54cf175fe330f0caf85472ac9f7e42
parent 593717 b266a8d8fd595b84a7d6218d7b8c6b7af0b5027c
child 596360 2a218845954cdd2d603298f9b48e5a5737617666
push id64255
push userbechen@mozilla.com
push dateFri, 16 Jun 2017 02:48:53 +0000
reviewersrillian
bugs1372715
milestone56.0a1
Bug 1372715 - TimeMarchesOn step 1, fix the EndTime check for "current cue". r=rillian Cue whose start times are less than or equal to the current playback position and whose end times are greater than the current playback position. MozReview-Commit-ID: 2I5lgjUUtgB
dom/media/TextTrack.cpp
--- a/dom/media/TextTrack.cpp
+++ b/dom/media/TextTrack.cpp
@@ -200,27 +200,27 @@ TextTrack::UpdateActiveCueList()
     mDirty = false;
     mActiveCueList->RemoveAll();
   }
 
   double playbackTime = mediaElement->CurrentTime();
   // Remove all the cues from the active cue list whose end times now occur
   // earlier then the current playback time.
   for (uint32_t i = mActiveCueList->Length(); i > 0; i--) {
-    if ((*mActiveCueList)[i - 1]->EndTime() < playbackTime) {
+    if ((*mActiveCueList)[i - 1]->EndTime() <= playbackTime) {
       mActiveCueList->RemoveCueAt(i - 1);
     }
   }
   // Add all the cues, starting from the position of the last cue that was
   // added, that have valid start and end times for the current playback time.
   // We can stop iterating safely once we encounter a cue that does not have
   // a valid start time as the cue list is sorted.
   for (; mCuePos < mCueList->Length() &&
          (*mCueList)[mCuePos]->StartTime() <= playbackTime; mCuePos++) {
-    if ((*mCueList)[mCuePos]->EndTime() >= playbackTime) {
+    if ((*mCueList)[mCuePos]->EndTime() > playbackTime) {
       mActiveCueList->AddCue(*(*mCueList)[mCuePos]);
     }
   }
 }
 
 TextTrackCueList*
 TextTrack::GetActiveCues() {
   if (mMode != TextTrackMode::Disabled) {