Bug 1183519: P2. Reject promise if decoder couldn't be created. r=me
authorJean-Yves Avenard <jyavenard@mozilla.com>
Thu, 16 Jul 2015 15:47:51 +1000
changeset 253147 f0e5f3f89b912fb3faf3ebf036c54820189bcf79
parent 253146 fafc65c08458810737e0f67ca36f60e976d514fc
child 253148 94450f09642abfbf99e9609b28fd503f796ecead
push id29061
push userryanvm@gmail.com
push dateThu, 16 Jul 2015 18:53:45 +0000
treeherdermozilla-central@a0f4a688433d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersme
bugs1183519
milestone42.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 1183519: P2. Reject promise if decoder couldn't be created. r=me Follow-up fix.
dom/media/MediaFormatReader.cpp
--- a/dom/media/MediaFormatReader.cpp
+++ b/dom/media/MediaFormatReader.cpp
@@ -971,19 +971,22 @@ void
 MediaFormatReader::DrainDecoder(TrackType aTrack)
 {
   MOZ_ASSERT(OnTaskQueue());
 
   auto& decoder = GetDecoderData(aTrack);
   if (!decoder.mNeedDraining || decoder.mDraining) {
     return;
   }
+  decoder.mNeedDraining = false;
+  if (!decoder.mDecoder) {
+    return;
+  }
   decoder.mOutputRequested = true;
   decoder.mDecoder->Drain();
-  decoder.mNeedDraining = false;
   decoder.mDraining = true;
   LOG("Requesting %s decoder to drain", TrackTypeToStr(aTrack));
 }
 
 void
 MediaFormatReader::Update(TrackType aTrack)
 {
   MOZ_ASSERT(OnTaskQueue());
@@ -1040,16 +1043,19 @@ MediaFormatReader::Update(TrackType aTra
         decoder.RejectPromise(DECODE_ERROR, __func__);
         return;
       } else if (decoder.mDemuxEOS) {
         decoder.RejectPromise(END_OF_STREAM, __func__);
       } else if (decoder.mWaitingForData) {
         LOG("Waiting For Data");
         decoder.RejectPromise(WAITING_FOR_DATA, __func__);
       }
+    } else if (decoder.mError && !decoder.mDecoder) {
+      decoder.RejectPromise(DECODE_ERROR, __func__);
+      return;
     }
   }
 
   if (decoder.mError || decoder.mDemuxEOS || decoder.mWaitingForData) {
     DrainDecoder(aTrack);
     return;
   }