mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-21 17:25:36 +00:00
Bug 1180935: P1. Do not drain decoders when waiting for data. r=cpearce
We made the design decision that it was preferable to decode as much of what we had, even if that meant we couldn't decode some frames upon resume. This can cause significant apparent stalls with some YouTube videos where keyframes are up to 4.2s appart (128 frames).
This commit is contained in:
parent
443f548ac2
commit
398014c093
@ -762,8 +762,8 @@ void
|
||||
MediaFormatReader::NotifyNewOutput(TrackType aTrack, MediaData* aSample)
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
LOGV("Received new sample time:%lld duration:%lld",
|
||||
aSample->mTime, aSample->mDuration);
|
||||
LOGV("Received new %s sample time:%lld duration:%lld",
|
||||
TrackTypeToStr(aTrack), aSample->mTime, aSample->mDuration);
|
||||
auto& decoder = GetDecoderData(aTrack);
|
||||
if (!decoder.mOutputRequested) {
|
||||
LOG("MediaFormatReader produced output while flushing, discarding.");
|
||||
@ -815,7 +815,6 @@ MediaFormatReader::NotifyWaitingForData(TrackType aTrack)
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
auto& decoder = GetDecoderData(aTrack);
|
||||
decoder.mWaitingForData = true;
|
||||
decoder.mNeedDraining = true;
|
||||
ScheduleUpdate(aTrack);
|
||||
}
|
||||
|
||||
@ -979,7 +978,7 @@ MediaFormatReader::DecodeDemuxedSamples(TrackType aTrack,
|
||||
info->GetID());
|
||||
decoder.mNeedDraining = true;
|
||||
decoder.mNextStreamSourceID = Some(info->GetID());
|
||||
DrainDecoder(aTrack);
|
||||
ScheduleUpdate(aTrack);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1094,6 +1093,12 @@ MediaFormatReader::Update(TrackType aTrack)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!decoder.HasPromise() && decoder.mWaitingForData) {
|
||||
// Nothing more we can do at present.
|
||||
LOGV("Still waiting for data.");
|
||||
return;
|
||||
}
|
||||
|
||||
// Record number of frames decoded and parsed. Automatically update the
|
||||
// stats counters using the AutoNotifyDecoded stack-based class.
|
||||
AbstractMediaDecoder::AutoNotifyDecoded a(mDecoder);
|
||||
@ -1138,17 +1143,18 @@ MediaFormatReader::Update(TrackType aTrack)
|
||||
return;
|
||||
} else if (decoder.mDemuxEOS) {
|
||||
decoder.RejectPromise(END_OF_STREAM, __func__);
|
||||
} else if (decoder.mWaitingForData) {
|
||||
LOG("Waiting For Data");
|
||||
decoder.RejectPromise(WAITING_FOR_DATA, __func__);
|
||||
}
|
||||
} else if (decoder.mError && !decoder.mDecoder) {
|
||||
decoder.RejectPromise(DECODE_ERROR, __func__);
|
||||
return;
|
||||
} else if (decoder.mWaitingForData) {
|
||||
LOG("Waiting For Data");
|
||||
decoder.RejectPromise(WAITING_FOR_DATA, __func__);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (decoder.mError || decoder.mDemuxEOS || decoder.mWaitingForData) {
|
||||
if (decoder.mNeedDraining) {
|
||||
DrainDecoder(aTrack);
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user