Bug 1304314. Part 3 - take mPlaybackRate into account. r=kikuo
authorJW Wang <jwwang@mozilla.com>
Wed, 21 Sep 2016 16:30:45 +0800
changeset 417643 7b8ab6891c497ae6cc0b4cf96092c9e8a99404d5
parent 417642 2bd3bdee7d08d427b043e621d0b4d40c48a7442f
child 417644 4e0816190900801896f62fd78c7c1d824fadcc8b
push id30444
push userbmo:pbrosset@mozilla.com
push dateMon, 26 Sep 2016 14:07:09 +0000
reviewerskikuo
bugs1304314
milestone52.0a1
Bug 1304314. Part 3 - take mPlaybackRate into account. r=kikuo MozReview-Commit-ID: 9AQSUJl82fA
dom/media/MediaDecoderStateMachine.cpp
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -2317,25 +2317,25 @@ MediaDecoderStateMachine::StartMediaSink
   }
 }
 
 bool
 MediaDecoderStateMachine::HasLowDecodedAudio()
 {
   MOZ_ASSERT(OnTaskQueue());
   return IsAudioDecoding() &&
-         GetDecodedAudioDuration() < EXHAUSTED_DATA_MARGIN_USECS;
+         GetDecodedAudioDuration() < EXHAUSTED_DATA_MARGIN_USECS * mPlaybackRate;
 }
 
 bool
 MediaDecoderStateMachine::HasLowDecodedVideo()
 {
   MOZ_ASSERT(OnTaskQueue());
   return IsVideoDecoding() &&
-         static_cast<uint32_t>(VideoQueue().GetSize()) < LOW_VIDEO_FRAMES;
+         VideoQueue().GetSize() < LOW_VIDEO_FRAMES * mPlaybackRate;
 }
 
 bool
 MediaDecoderStateMachine::HasLowDecodedData()
 {
   MOZ_ASSERT(OnTaskQueue());
   MOZ_ASSERT(mReader->UseBufferingHeuristics());
   return HasLowDecodedAudio() || HasLowDecodedVideo();