Bug 1106547 - Return EOS after drain is complete, rather than before. r=cpearce

This commit is contained in:
Andreas Pehrson 2014-12-01 22:10:00 +01:00
parent 62d78cde2c
commit fd315ba8ff
2 changed files with 10 additions and 11 deletions

View File

@ -583,7 +583,6 @@ MP4Reader::Update(TrackType aTrack)
bool needInput = false;
bool needOutput = false;
bool eos = false;
auto& decoder = GetDecoderData(aTrack);
nsRefPtr<MediaData> output;
{
@ -599,7 +598,6 @@ MP4Reader::Update(TrackType aTrack)
output = decoder.mOutput[0];
decoder.mOutput.RemoveElementAt(0);
}
eos = decoder.mEOS;
}
VLOG("Update(%s) ni=%d no=%d iex=%d or=%d fl=%d",
TrackTypeToStr(aTrack),
@ -617,16 +615,15 @@ MP4Reader::Update(TrackType aTrack)
{
MonitorAutoLock lock(decoder.mMonitor);
MOZ_ASSERT(!decoder.mEOS);
eos = decoder.mEOS = true;
decoder.mEOS = true;
}
// DrainComplete takes care of reporting EOS upwards
decoder.mDecoder->Drain();
}
}
if (needOutput) {
if (output) {
ReturnOutput(output, aTrack);
} else if (eos) {
ReturnEOS(aTrack);
}
}
}
@ -730,9 +727,14 @@ void
MP4Reader::DrainComplete(TrackType aTrack)
{
DecoderData& data = GetDecoderData(aTrack);
MonitorAutoLock mon(data.mMonitor);
data.mDrainComplete = true;
mon.NotifyAll();
bool eos;
{
MonitorAutoLock mon(data.mMonitor);
eos = data.mEOS;
}
if (eos) {
ReturnEOS(aTrack);
}
}
void
@ -771,7 +773,6 @@ MP4Reader::Flush(TrackType aTrack)
{
MonitorAutoLock mon(data.mMonitor);
data.mIsFlushing = true;
data.mDrainComplete = false;
data.mEOS = false;
}
data.mDecoder->Flush();

View File

@ -156,7 +156,6 @@ private:
, mInputExhausted(false)
, mError(false)
, mIsFlushing(false)
, mDrainComplete(false)
, mOutputRequested(false)
, mUpdateScheduled(false)
, mEOS(false)
@ -186,7 +185,6 @@ private:
bool mInputExhausted;
bool mError;
bool mIsFlushing;
bool mDrainComplete;
bool mOutputRequested;
bool mUpdateScheduled;
bool mEOS;