Bug 1253928 - adjust the time passed to RequestVideoData() by the start time to avoid incorrectly skipping key frames. r=jya. draft
authorJW Wang <jwwang@mozilla.com>
Mon, 07 Mar 2016 18:44:03 +0800
changeset 337538 7f3fa016f09ade2459e4674abb6bc889eb26a9df
parent 337537 621c7c96c9329b0117ba8dcbfd29b67f95072e95
child 515688 588605dfa237256e92b90b2aa451e93b7a7603ef
push id12386
push userjwwang@mozilla.com
push dateMon, 07 Mar 2016 23:25:41 +0000
reviewersjya
bugs1253928
milestone47.0a1
Bug 1253928 - adjust the time passed to RequestVideoData() by the start time to avoid incorrectly skipping key frames. r=jya. MozReview-Commit-ID: 3Lhglk1EpJv
dom/media/MediaDecoderStateMachine.cpp
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -1768,17 +1768,20 @@ MediaDecoderStateMachine::RequestVideoDa
 
   // Time the video decode, so that if it's slow, we can increase our low
   // audio threshold to reduce the chance of an audio underrun while we're
   // waiting for a video decode to complete.
   TimeStamp videoDecodeStartTime = TimeStamp::Now();
 
   bool skipToNextKeyFrame = mSentFirstFrameLoadedEvent &&
     NeedToSkipToNextKeyframe();
-  int64_t currentTime = mState == DECODER_STATE_SEEKING ? 0 : GetMediaTime();
+
+  int64_t currentTime = mState ==
+    DECODER_STATE_SEEKING || !mStartTimeRendezvous->HaveStartTime()
+      ? 0 : GetMediaTime() + mStartTimeRendezvous->StartTime();
 
   SAMPLE_LOG("Queueing video task - queued=%i, decoder-queued=%o, skip=%i, time=%lld",
              VideoQueue().GetSize(), mReader->SizeOfVideoQueueInFrames(), skipToNextKeyFrame,
              currentTime);
 
   RefPtr<MediaDecoderStateMachine> self = this;
   if (mSentFirstFrameLoadedEvent) {
     mVideoDataRequest.Begin(