Bug 1243608: P1. Only use video time if video frame contains seek target. r=cpearce
authorJean-Yves Avenard <jyavenard@mozilla.com>
Tue, 02 Feb 2016 17:05:40 +1100
changeset 282703 b6c13888e029e9af0bcb40fc75cce1ad09afa046
parent 282663 39f872a217ff48786cfda71241a679b5d36e1408
child 282704 2008d4a61715054b05d1464d5ef022240f3e8ee5
push id29970
push usercbook@mozilla.com
push dateWed, 03 Feb 2016 10:59:33 +0000
treeherdermozilla-central@f2f8fc172f4c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscpearce
bugs1243608, 1112438
milestone47.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1243608: P1. Only use video time if video frame contains seek target. r=cpearce This restrict the behaviour introduced in bug 1112438.
dom/media/MediaDecoderStateMachine.cpp
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -2090,19 +2090,26 @@ MediaDecoderStateMachine::SeekCompleted(
   } else if (HasAudio()) {
     MediaData* audio = AudioQueue().PeekFront();
     // Though we adjust the newCurrentTime in audio-based, and supplemented
     // by video. For better UX, should NOT bind the slide position to
     // the first audio data timestamp directly.
     // While seeking to a position where there's only either audio or video, or
     // seeking to a position lies before audio or video, we need to check if
     // seekTime is bounded in suitable duration. See Bug 1112438.
-    int64_t videoStart = video ? video->mTime : seekTime;
     int64_t audioStart = audio ? audio->mTime : seekTime;
-    newCurrentTime = std::min(audioStart, videoStart);
+    // We only pin the seek time to the video start time if the video frame
+    // contains the seek time. We also perform this operation if there's no
+    // video in order to get around bug 1244639.
+    if (!video || (video->mTime <= seekTime && video->GetEndTime() > seekTime)) {
+      int64_t videoStart = video ? video->mTime : seekTime;
+      newCurrentTime = std::min(audioStart, videoStart);
+    } else {
+      newCurrentTime = audioStart;
+    }
   } else {
     newCurrentTime = video ? video->mTime : seekTime;
   }
 
   // Change state to DECODING or COMPLETED now. SeekingStopped will
   // call MediaDecoderStateMachine::Seek to reset our state to SEEKING
   // if we need to seek again.