Bug 1272964: P6. Exclude frames dropped due to internal seeking from calculations. r?cpearce
MozReview-Commit-ID: HKnEaUh3rkV
--- a/dom/media/MediaFormatReader.cpp
+++ b/dom/media/MediaFormatReader.cpp
@@ -668,18 +668,16 @@ MediaFormatReader::NotifyNewOutput(Track
TrackTypeToStr(aTrack), aSample->mTime, aSample->mDuration);
auto& decoder = GetDecoderData(aTrack);
if (!decoder.mOutputRequested) {
LOG("MediaFormatReader produced output while flushing, discarding.");
return;
}
decoder.mOutput.AppendElement(aSample);
decoder.mNumSamplesOutput++;
- decoder.mNumSamplesOutputTotal++;
- decoder.mNumSamplesOutputTotalSinceTelemetry++;
ScheduleUpdate(aTrack);
}
void
MediaFormatReader::NotifyInputExhausted(TrackType aTrack)
{
MOZ_ASSERT(OnTaskQueue());
LOGV("Decoder has requested more %s data", TrackTypeToStr(aTrack));
@@ -1135,39 +1133,42 @@ MediaFormatReader::Update(TrackType aTra
}
if (time < target.Time() || (target.mDropTarget && target.Contains(time))) {
LOGV("Internal Seeking: Dropping %s frame time:%f wanted:%f (kf:%d)",
TrackTypeToStr(aTrack),
media::TimeUnit::FromMicroseconds(output->mTime).ToSeconds(),
target.Time().ToSeconds(),
output->mKeyframe);
decoder.mOutput.RemoveElementAt(0);
+ decoder.mSizeOfQueue -= 1;
}
}
if (decoder.HasPromise()) {
needOutput = true;
if (decoder.mOutput.Length()) {
+ RefPtr<MediaData> 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 =
decoder.mNumSamplesOutputTotal - mLastReportedNumDecodedFrames;
a.mDecoded = static_cast<uint32_t>(delta);
mLastReportedNumDecodedFrames = decoder.mNumSamplesOutputTotal;
nsCString error;
mVideo.mIsHardwareAccelerated =
mVideo.mDecoder && mVideo.mDecoder->IsHardwareAccelerated(error);
}
- RefPtr<MediaData> 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__);
return;
} else if (decoder.mDrainComplete) {
bool wasDraining = decoder.mDraining;
decoder.mDrainComplete = false;
decoder.mDraining = false;