Bug 961787 - Buffer more data when using MediaElementAudioSourceNode / mozCaptureStream from a media decoder. r=roc, a=sledru
authorPaul Adenot <paul@paul.cx>
Mon, 27 Jan 2014 19:10:48 +0100
changeset 175228 2151d583a45cd86c3a08a2d0d85c945d15172e49
parent 175227 4bf8c252e4782e57fdd0bedc9f5d67949cbbb08b
child 175229 fd6042c0a6bdc67ad1fa62f146988494b4850424
push id3224
push userlsblakk@mozilla.com
push dateTue, 04 Feb 2014 01:06:49 +0000
treeherdermozilla-beta@60c04d0987f1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc, sledru
bugs961787
milestone28.0a2
Bug 961787 - Buffer more data when using MediaElementAudioSourceNode / mozCaptureStream from a media decoder. r=roc, a=sledru
content/media/MediaStreamGraph.cpp
--- a/content/media/MediaStreamGraph.cpp
+++ b/content/media/MediaStreamGraph.cpp
@@ -49,18 +49,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));