Bug 961787 - Buffer more data when using MediaElementAudioSourceNode / mozCaptureStream from a media decoder. r=roc
authorPaul Adenot <paul@paul.cx>
Mon, 27 Jan 2014 19:10:48 +0100
changeset 165624 4cd2059e557fbb459001b38e790cbc7633898474
parent 165623 da8c61077b5ad1af09b9336b26c03a642601c31e
child 165625 535d21847e396c8d5e6dcd49e6dbca38eab3c259
push id4623
push userryanvm@gmail.com
push dateTue, 28 Jan 2014 21:48:39 +0000
treeherderfx-team@7e79536aca0a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs961787
milestone29.0a1
Bug 961787 - Buffer more data when using MediaElementAudioSourceNode / mozCaptureStream from a media decoder. r=roc
content/media/MediaStreamGraph.cpp
--- a/content/media/MediaStreamGraph.cpp
+++ b/content/media/MediaStreamGraph.cpp
@@ -50,18 +50,20 @@ MediaStreamGraphImpl::~MediaStreamGraphI
   STREAM_LOG(PR_LOG_DEBUG, ("MediaStreamGraph %p destroyed", this));
 }
 
 
 StreamTime
 MediaStreamGraphImpl::GetDesiredBufferEnd(MediaStream* aStream)
 {
   StreamTime current = mCurrentTime - aStream->mBufferStartTime;
+  // When waking up media decoders, we need a longer safety margin, as it can
+  // take more time to get new samples. A factor of two seem to work.
   return current +
-      MillisecondsToMediaTime(std::max(AUDIO_TARGET_MS, VIDEO_TARGET_MS));
+      2 * MillisecondsToMediaTime(std::max(AUDIO_TARGET_MS, VIDEO_TARGET_MS));
 }
 
 void
 MediaStreamGraphImpl::FinishStream(MediaStream* aStream)
 {
   if (aStream->mFinished)
     return;
   STREAM_LOG(PR_LOG_DEBUG, ("MediaStream %p will finish", aStream));