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 225607 2151d583a45cd86c3a08a2d0d85c945d15172e49
parent 225606 4bf8c252e4782e57fdd0bedc9f5d67949cbbb08b
child 225608 fd6042c0a6bdc67ad1fa62f146988494b4850424
push id6
push userryanvm@gmail.com
push dateMon, 12 Jan 2015 22:04:06 +0000
treeherdermozilla-b2g37_v2_2@895c8fc7b734 [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));