Bug 1319035 - handle fast seek without any seeked media sample; r?jwwang draft
authorKaku Kuo <kaku@mozilla.com>
Tue, 22 Nov 2016 15:38:42 +0800
changeset 442280 5f0965a1fba472689d498a4e83de8b72b271f875
parent 442068 0534254e9a40b4bade2577c631fe4cfa0b5db41d
child 537764 c43217896405c56db3e616a0b7df90e6e1d6d172
push id36658
push userbmo:kaku@mozilla.com
push dateTue, 22 Nov 2016 07:40:12 +0000
reviewersjwwang
bugs1319035
milestone53.0a1
Bug 1319035 - handle fast seek without any seeked media sample; r?jwwang MozReview-Commit-ID: DdUmM5hh3Qy
dom/media/AccurateSeekTask.cpp
--- a/dom/media/AccurateSeekTask.cpp
+++ b/dom/media/AccurateSeekTask.cpp
@@ -90,17 +90,22 @@ AccurateSeekTask::CalculateNewCurrentTim
   // the real decoded samples' start time.
   if (mTarget.IsAccurate()) {
     return seekTime;
   }
 
   // For the fast seek, we update the newCurrentTime with the decoded audio and
   // video samples, set it to be the one which is closet to the seekTime.
   if (mTarget.IsFast()) {
-    MOZ_ASSERT(mSeekedAudioData || mSeekedVideoData);
+
+    // A situation that both audio and video approaches the end.
+    if (!mSeekedAudioData && !mSeekedVideoData) {
+      return seekTime;
+    }
+
     const int64_t audioStart = mSeekedAudioData ? mSeekedAudioData->mTime : INT64_MAX;
     const int64_t videoStart = mSeekedVideoData ? mSeekedVideoData->mTime : INT64_MAX;
     const int64_t audioGap = std::abs(audioStart - seekTime);
     const int64_t videoGap = std::abs(videoStart - seekTime);
     return audioGap <= videoGap ? audioStart : videoStart;
   }
 
   MOZ_ASSERT(false, "AccurateSeekTask doesn't handle other seek types.");