Bug 1242783. Part 2 - per comment 12, buffer only 1s when audio is captured. r=kinetik.
authorJW Wang <jwwang@mozilla.com>
Sat, 19 Mar 2016 18:29:44 +0800
changeset 289614 1b7694d14856a0d0d1be59e586c315d4f2e02e1e
parent 289613 1be121a3e746674f2023a82f2a39a9c49a694768
child 289615 8c8ed5ea5eaf988f640dfa38470ef37edaaa0ed4
push id19656
push usergwagner@mozilla.com
push dateMon, 04 Apr 2016 13:43:23 +0000
treeherderb2g-inbound@e99061fde28a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskinetik
bugs1242783
milestone48.0a1
Bug 1242783. Part 2 - per comment 12, buffer only 1s when audio is captured. r=kinetik. MozReview-Commit-ID: 2SUSvQzUSgR
dom/media/MediaDecoderStateMachine.cpp
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -2926,16 +2926,25 @@ MediaDecoderStateMachine::SetAudioCaptur
   mMediaSink->SetPlaybackParams(params);
 
   // We don't need to call StartMediaSink() here because IsPlaying() is now
   // always in sync with the playing state of MediaSink. It will be started in
   // MaybeStartPlayback() in the next cycle if necessary.
 
   mAudioCaptured = aCaptured;
   ScheduleStateMachine();
+
+  // Don't buffer as much when audio is captured because we don't need to worry
+  // about high latency audio devices.
+  mAmpleAudioThresholdUsecs = mAudioCaptured ?
+                              detail::AMPLE_AUDIO_USECS / 2 :
+                              detail::AMPLE_AUDIO_USECS;
+  if (mIsAudioPrerolling && DonePrerollingAudio()) {
+    StopPrerollingAudio();
+  }
 }
 
 uint32_t MediaDecoderStateMachine::GetAmpleVideoFrames() const
 {
   MOZ_ASSERT(OnTaskQueue());
   return (mReader->IsAsync() && mReader->VideoIsHardwareAccelerated())
     ? std::max<uint32_t>(sVideoQueueHWAccelSize, MIN_VIDEO_QUEUE_SIZE)
     : std::max<uint32_t>(sVideoQueueDefaultSize, MIN_VIDEO_QUEUE_SIZE);