Bug 1368619: Flush decoder on Android. r=jolin
authorJean-Yves Avenard <jyavenard@mozilla.com>
Tue, 30 May 2017 00:31:11 +0200
changeset 409595 92b3f353c684426466201b8b66e3e97ccf47b6b0
parent 409594 17792fad126f6b6737f4282f9f52af58b9246792
child 409596 55a1612e3e5823cab4cea3e453e1a678434ea47d
push id7391
push usermtabara@mozilla.com
push dateMon, 12 Jun 2017 13:08:53 +0000
treeherdermozilla-beta@2191d7f87e2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjolin
bugs1368619, 1345898
milestone55.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 1368619: Flush decoder on Android. r=jolin In the situation described in bug 1345898, on android where the decoder is recycled rather than shut down, we would have potentially returned multiple frames with the same timestamp. It is necessary to flush the decoder. MozReview-Commit-ID: 6ovaD9PEdOG
dom/media/MediaFormatReader.cpp
--- a/dom/media/MediaFormatReader.cpp
+++ b/dom/media/MediaFormatReader.cpp
@@ -2041,16 +2041,18 @@ MediaFormatReader::HandleDemuxedSamples(
         LOG("Decoder does not support recycling, recreate decoder.");
         // If flushing is required, it will clear our array of queued samples.
         // So make a copy now.
         nsTArray<RefPtr<MediaRawData>> samples{ Move(decoder.mQueuedSamples) };
         ShutdownDecoder(aTrack);
         if (sample->mKeyframe) {
           decoder.mQueuedSamples.AppendElements(Move(samples));
         }
+      } else if (decoder.HasWaitingPromise()) {
+        decoder.Flush();
       }
 
       decoder.mInfo = info;
 
       if (sample->mKeyframe) {
         ScheduleUpdate(aTrack);
       } else {
         auto time = TimeInterval(sample->mTime, sample->GetEndTime());