Bug 1113600 - Part 1. Send stream data right away after adding an output stream. r=roc, a=lmandel
authorAndreas Pehrson <pehrsons@gmail.com>
Thu, 08 Jan 2015 13:36:29 +0800
changeset 249264 ee87294b36507201f91e1daaa09f387ffef4d442
parent 249263 90d3b9c511db62278518515e6ffc7c4f23ee8b9c
child 249265 52f2149040b2884391b72c7bb19d8d55fbe11501
push id4489
push userraliiev@mozilla.com
push dateMon, 23 Feb 2015 15:17:55 +0000
treeherdermozilla-beta@fd7c3dc24146 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc, lmandel
bugs1113600
milestone37.0a2
Bug 1113600 - Part 1. Send stream data right away after adding an output stream. r=roc, a=lmandel
dom/media/MediaDecoderStateMachine.cpp
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -2970,16 +2970,24 @@ void MediaDecoderStateMachine::AdvanceFr
   }
 
   // If playbackRate is 0.0, we should stop the progress, but not be in paused
   // state, per spec.
   if (mPlaybackRate == 0.0) {
     return;
   }
 
+  DecodedStreamData* stream = mDecoder->GetDecodedStream();
+  if (stream && !stream->mStreamInitialized) {
+    // Output streams exist but are not initialized yet.
+    // Send the data we already have to allow stream clock to progress and
+    // avoid stalling playback.
+    SendStreamData();
+  }
+
   const int64_t clock_time = GetClock();
   TimeStamp nowTime = TimeStamp::Now();
   // Skip frames up to the frame at the playback position, and figure out
   // the time remaining until it's time to display the next frame.
   int64_t remainingTime = AUDIO_DURATION_USECS;
   NS_ASSERTION(clock_time >= mStartTime, "Should have positive clock time.");
   nsRefPtr<VideoData> currentFrame;
   if (VideoQueue().GetSize() > 0) {