From 778a01fa9e1480b365aad35b82175c9d5b8b7c51 Mon Sep 17 00:00:00 2001 From: Jean-Yves Avenard Date: Thu, 19 May 2016 17:03:39 +0800 Subject: [PATCH] Bug 1272964: P6. Exclude frames dropped due to internal seeking from calculations. r=cpearce MozReview-Commit-ID: HKnEaUh3rkV --HG-- extra : rebase_source : adb5d9313ffa66b949991e96f9a48df835ae6451 --- dom/media/MediaFormatReader.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/dom/media/MediaFormatReader.cpp b/dom/media/MediaFormatReader.cpp index 86cdfcc5bb8a..b8452894825c 100644 --- a/dom/media/MediaFormatReader.cpp +++ b/dom/media/MediaFormatReader.cpp @@ -673,8 +673,6 @@ MediaFormatReader::NotifyNewOutput(TrackType aTrack, MediaData* aSample) } decoder.mOutput.AppendElement(aSample); decoder.mNumSamplesOutput++; - decoder.mNumSamplesOutputTotal++; - decoder.mNumSamplesOutputTotalSinceTelemetry++; ScheduleUpdate(aTrack); } @@ -1145,12 +1143,22 @@ MediaFormatReader::Update(TrackType aTrack) target.Time().ToSeconds(), output->mKeyframe); decoder.mOutput.RemoveElementAt(0); + decoder.mSizeOfQueue -= 1; } } if (decoder.HasPromise()) { needOutput = true; if (decoder.mOutput.Length()) { + RefPtr output = decoder.mOutput[0]; + decoder.mOutput.RemoveElementAt(0); + decoder.mSizeOfQueue -= 1; + decoder.mLastSampleTime = + Some(TimeInterval(TimeUnit::FromMicroseconds(output->mTime), + TimeUnit::FromMicroseconds(output->GetEndTime()))); + decoder.mNumSamplesOutputTotal++; + decoder.mNumSamplesOutputTotalSinceTelemetry++; + ReturnOutput(output, aTrack); // We have a decoded sample ready to be returned. if (aTrack == TrackType::kVideoTrack) { uint64_t delta = @@ -1161,13 +1169,6 @@ MediaFormatReader::Update(TrackType aTrack) mVideo.mIsHardwareAccelerated = mVideo.mDecoder && mVideo.mDecoder->IsHardwareAccelerated(error); } - RefPtr output = decoder.mOutput[0]; - decoder.mOutput.RemoveElementAt(0); - decoder.mSizeOfQueue -= 1; - decoder.mLastSampleTime = - Some(TimeInterval(TimeUnit::FromMicroseconds(output->mTime), - TimeUnit::FromMicroseconds(output->GetEndTime()))); - ReturnOutput(output, aTrack); } else if (decoder.mError) { LOG("Rejecting %s promise: DECODE_ERROR", TrackTypeToStr(aTrack)); decoder.RejectPromise(DECODE_ERROR, __func__);