зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1341200. Part 2 - replace mFlushRequest with a bool for mFlushRequest.Disconnect() is never used and a bool is sufficient to do the job. r=jya
MozReview-Commit-ID: GFnSvunqtGq --HG-- extra : rebase_source : 81b168157e04c455d8876c8e2504fad79b889cb8 extra : intermediate-source : aa57748660c8b5858c64ae07e77a60a5114a33fc extra : source : 20371ccdf3c1f19ae2836e693a8b669a40f9e7a4
This commit is contained in:
Родитель
4a63e253b1
Коммит
f903aff319
|
@ -1085,7 +1085,7 @@ MediaFormatReader::ShutdownDecoderWithPromise(TrackType aTrack)
|
|||
return decoder.mShutdownPromise.Ensure(__func__);
|
||||
}
|
||||
|
||||
if (decoder.mFlushRequest.Exists() || decoder.mShutdownRequest.Exists()) {
|
||||
if (decoder.mFlushing || decoder.mShutdownRequest.Exists()) {
|
||||
// Let the current flush or shutdown operation complete, Flush will continue
|
||||
// shutting down the current decoder now that the shutdown promise is set.
|
||||
return decoder.mShutdownPromise.Ensure(__func__);
|
||||
|
@ -1892,7 +1892,7 @@ MediaFormatReader::HandleDemuxedSamples(
|
|||
|
||||
auto& decoder = GetDecoderData(aTrack);
|
||||
|
||||
if (decoder.mFlushRequest.Exists() || decoder.mShutdownRequest.Exists()) {
|
||||
if (decoder.mFlushing || decoder.mShutdownRequest.Exists()) {
|
||||
LOGV("Decoder operation in progress, let it complete.");
|
||||
return;
|
||||
}
|
||||
|
@ -2274,7 +2274,7 @@ MediaFormatReader::Update(TrackType aTrack)
|
|||
decoder.mNumSamplesOutput,
|
||||
uint32_t(size_t(decoder.mSizeOfQueue)),
|
||||
decoder.mDecodeRequest.Exists(),
|
||||
decoder.mFlushRequest.Exists(),
|
||||
decoder.mFlushing,
|
||||
decoder.mShutdownRequest.Exists(),
|
||||
uint32_t(decoder.mOutput.Length()),
|
||||
decoder.mWaitingForData,
|
||||
|
|
|
@ -185,6 +185,7 @@ private:
|
|||
, mWaitingForData(false)
|
||||
, mWaitingForKey(false)
|
||||
, mReceivedNewData(false)
|
||||
, mFlushing(false)
|
||||
, mFlushed(true)
|
||||
, mDrainState(DrainState::None)
|
||||
, mNumOfConsecutiveError(0)
|
||||
|
@ -264,7 +265,7 @@ private:
|
|||
|
||||
// MediaDataDecoder handler's variables.
|
||||
MozPromiseRequestHolder<MediaDataDecoder::DecodePromise> mDecodeRequest;
|
||||
MozPromiseRequestHolder<MediaDataDecoder::FlushPromise> mFlushRequest;
|
||||
bool mFlushing; // True if flush is in action.
|
||||
// Set to true if the last operation run on the decoder was a flush.
|
||||
bool mFlushed;
|
||||
MozPromiseHolder<ShutdownPromise> mShutdownPromise;
|
||||
|
@ -342,7 +343,7 @@ private:
|
|||
// Following a flush, the decoder is ready to accept any new data.
|
||||
void Flush()
|
||||
{
|
||||
if (mFlushRequest.Exists() || mFlushed) {
|
||||
if (mFlushing || mFlushed) {
|
||||
// Flush still pending or already flushed, nothing more to do.
|
||||
return;
|
||||
}
|
||||
|
@ -359,10 +360,11 @@ private:
|
|||
TrackType type = mType == MediaData::AUDIO_DATA
|
||||
? TrackType::kAudioTrack
|
||||
: TrackType::kVideoTrack;
|
||||
mFlushing = true;
|
||||
mDecoder->Flush()
|
||||
->Then(mOwner->OwnerThread(), __func__,
|
||||
[owner, type, this]() {
|
||||
mFlushRequest.Complete();
|
||||
mFlushing = false;
|
||||
if (!mShutdownPromise.IsEmpty()) {
|
||||
ShutdownDecoder();
|
||||
return;
|
||||
|
@ -370,14 +372,13 @@ private:
|
|||
owner->ScheduleUpdate(type);
|
||||
},
|
||||
[owner, type, this](const MediaResult& aError) {
|
||||
mFlushRequest.Complete();
|
||||
mFlushing = false;
|
||||
if (!mShutdownPromise.IsEmpty()) {
|
||||
ShutdownDecoder();
|
||||
return;
|
||||
}
|
||||
owner->NotifyError(type, aError);
|
||||
})
|
||||
->Track(mFlushRequest);
|
||||
});
|
||||
}
|
||||
mFlushed = true;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче