Bug 1185886: P2. Don't unnecessarily drain decoders when there's no frames pending. r=cpearce

This commit is contained in:
Jean-Yves Avenard 2015-07-26 21:52:22 +10:00
parent 906996fe29
commit 0259a11e37

View File

@ -715,6 +715,7 @@ MediaFormatReader::NotifyDrainComplete(TrackType aTrack)
{
MOZ_ASSERT(OnTaskQueue());
auto& decoder = GetDecoderData(aTrack);
LOG("%s", TrackTypeToStr(aTrack));
if (!decoder.mOutputRequested) {
LOG("MediaFormatReader called DrainComplete() before flushing, ignoring.");
return;
@ -983,6 +984,11 @@ MediaFormatReader::DrainDecoder(TrackType aTrack)
return;
}
decoder.mOutputRequested = true;
if (decoder.mNumSamplesInput == decoder.mNumSamplesOutput) {
// No frames to drain.
NotifyDrainComplete(aTrack);
return;
}
decoder.mDecoder->Drain();
decoder.mDraining = true;
LOG("Requesting %s decoder to drain", TrackTypeToStr(aTrack));