Bug 1113600 - Part 1. Send stream data right away after adding an output stream. r=roc, a=sledru
authorAndreas Pehrson <pehrsons@gmail.com>
Thu, 08 Jan 2015 13:36:29 +0800
changeset 242918 73c3918b169f
parent 242917 54a53a093110
child 242919 e30a4672f03f
push id4341
push userryanvm@gmail.com
push date2015-01-20 15:33 +0000
treeherdermozilla-beta@595835cd60a0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc, sledru
bugs1113600
milestone36.0
Bug 1113600 - Part 1. Send stream data right away after adding an output stream. r=roc, a=sledru
dom/media/MediaDecoderStateMachine.cpp
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -2948,16 +2948,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) {