Bug 1277508: P1. Don't attempt to demux new samples while we're currently draining. r?kamidphish draft
authorJean-Yves Avenard <jyavenard@mozilla.com>
Thu, 02 Jun 2016 20:54:33 +1000
changeset 374918 e71735d3cfee76aec3a68a161c1424205599a8c7
parent 374301 2c17aa4cf2824823f242978f7ea3f20696e76453
child 374919 aab70b265c91bdff5da43c4ceb3bef4865a3a3d9
push id20111
push userbmo:jyavenard@mozilla.com
push dateFri, 03 Jun 2016 00:44:33 +0000
reviewerskamidphish
bugs1277508
milestone49.0a1
Bug 1277508: P1. Don't attempt to demux new samples while we're currently draining. r?kamidphish We should only attempt to demux new samples once all pending decoded frames have been returned. Otherwise, the next demuxing attempt once a resolution change has been detected will reset the state and drop all decoded frames. MozReview-Commit-ID: 2coKQA8lZ8c
dom/media/MediaFormatReader.cpp
--- a/dom/media/MediaFormatReader.cpp
+++ b/dom/media/MediaFormatReader.cpp
@@ -745,17 +745,17 @@ bool
 MediaFormatReader::NeedInput(DecoderData& aDecoder)
 {
   // We try to keep a few more compressed samples input than decoded samples
   // have been output, provided the state machine has requested we send it a
   // decoded sample. To account for H.264 streams which may require a longer
   // run of input than we input, decoders fire an "input exhausted" callback,
   // which overrides our "few more samples" threshold.
   return
-    !aDecoder.mDraining &&
+    !(aDecoder.mDraining || aDecoder.mDrainComplete) &&
     !aDecoder.HasFatalError() &&
     aDecoder.mDecodingRequested &&
     !aDecoder.mDemuxRequest.Exists() &&
     !aDecoder.HasInternalSeekPending() &&
     aDecoder.mOutput.Length() <= aDecoder.mDecodeAhead &&
     (aDecoder.mInputExhausted || !aDecoder.mQueuedSamples.IsEmpty() ||
      aDecoder.mTimeThreshold.isSome() ||
      aDecoder.mNumSamplesInput - aDecoder.mNumSamplesOutput <= aDecoder.mDecodeAhead);