Bug 1045591 - Fix media element's autoplay for audio-only stream. r=cpearce, a=sledru
authorJean-Yves Avenard <jyavenard@mozilla.com>
Mon, 18 Aug 2014 18:09:19 +1000
changeset 217526 392aca6fddc206cd7900195e56e31b56635e8f89
parent 217525 de49ce4ac5f556e38c8d27db50b063cb857c78c5
child 217527 f0bdcf487ac4e263bef5a9153e811a0d27107076
push id515
push userraliiev@mozilla.com
push dateMon, 06 Oct 2014 12:51:51 +0000
treeherdermozilla-release@267c7a481bef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscpearce, sledru
bugs1045591
milestone33.0a2
Bug 1045591 - Fix media element's autoplay for audio-only stream. r=cpearce, a=sledru
content/media/MediaDecoderStateMachine.cpp
--- a/content/media/MediaDecoderStateMachine.cpp
+++ b/content/media/MediaDecoderStateMachine.cpp
@@ -250,17 +250,19 @@ bool MediaDecoderStateMachine::HasFuture
   AssertCurrentThreadInMonitor();
   NS_ASSERTION(HasAudio(), "Should only call HasFutureAudio() when we have audio");
   // We've got audio ready to play if:
   // 1. We've not completed playback of audio, and
   // 2. we either have more than the threshold of decoded audio available, or
   //    we've completely decoded all audio (but not finished playing it yet
   //    as per 1).
   return !mAudioCompleted &&
-         (AudioDecodedUsecs() > LOW_AUDIO_USECS * mPlaybackRate || AudioQueue().IsFinished());
+         (AudioDecodedUsecs() >
+            mLowAudioThresholdUsecs * mPlaybackRate ||
+          AudioQueue().IsFinished());
 }
 
 bool MediaDecoderStateMachine::HaveNextFrameData() {
   AssertCurrentThreadInMonitor();
   return (!HasAudio() || HasFutureAudio()) &&
          (!HasVideo() || VideoQueue().GetSize() > 0);
 }