Bug 1229987: P4. Stop pre-rolling when encountering WAITING_FOR_DATA. r=cpearce
☠☠ backed out by 672a8b656e19 ☠ ☠
authorJean-Yves Avenard <jyavenard@mozilla.com>
Wed, 09 Dec 2015 08:53:26 -0500
changeset 276093 707a87454058
parent 276092 37003d495f20
child 276094 6d8e9838e366
push id69039
push userjyavenard@mozilla.com
push dateThu, 10 Dec 2015 17:17:43 +0000
treeherdermozilla-inbound@707a87454058 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscpearce
bugs1229987
milestone45.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1229987: P4. Stop pre-rolling when encountering WAITING_FOR_DATA. r=cpearce This allows to start displaying frames even when we have less than 5 frames.
dom/media/MediaDecoderStateMachine.cpp
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -778,16 +778,27 @@ MediaDecoderStateMachine::OnNotDecoded(M
              [self] (MediaData::Type aType) -> void {
                self->WaitRequestRef(aType).Complete();
                self->DispatchDecodeTasksIfNeeded();
              },
              [self] (WaitForDataRejectValue aRejection) -> void {
                self->WaitRequestRef(aRejection.mType).Complete();
              }));
 
+    // We are out of data to decode and will enter buffering mode soon.
+    // We want to play the frames we have already decoded, so we stop pre-rolling
+    // and ensure that loadeddata is fired as required.
+    if (isAudio) {
+      StopPrerollingAudio();
+    } else {
+      StopPrerollingVideo();
+    }
+    if (mState == DECODER_STATE_BUFFERING || mState == DECODER_STATE_DECODING) {
+        MaybeFinishDecodeFirstFrame();
+    }
     return;
   }
 
   if (aReason == MediaDecoderReader::CANCELED) {
     DispatchDecodeTasksIfNeeded();
     return;
   }