зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1341200. Part 6 - let ShutdownDecoderWithPromise() return void by tracking the shutdown promise. r=jya
MozReview-Commit-ID: GIYdLXZYEyk --HG-- extra : rebase_source : 1e3f48b3bdc351e64b8a9820c8bed4734f7de912 extra : intermediate-source : e2807e0c4457e703161418113efbcce67ca89511 extra : source : 90a3f8649308d65e5da6e931f914c024fa92e66e
This commit is contained in:
Родитель
f0f62f9c3c
Коммит
9b1586e228
|
@ -1113,7 +1113,7 @@ MediaFormatReader::Shutdown()
|
|||
mAudio.mTrackDemuxer->BreakCycles();
|
||||
mAudio.mTrackDemuxer = nullptr;
|
||||
mAudio.ResetState();
|
||||
mShutdownPromisePool->Track(ShutdownDecoderWithPromise(TrackInfo::kAudioTrack));
|
||||
ShutdownDecoderWithPromise(TrackInfo::kAudioTrack);
|
||||
}
|
||||
|
||||
if (HasVideo()) {
|
||||
|
@ -1121,7 +1121,7 @@ MediaFormatReader::Shutdown()
|
|||
mVideo.mTrackDemuxer->BreakCycles();
|
||||
mVideo.mTrackDemuxer = nullptr;
|
||||
mVideo.ResetState();
|
||||
mShutdownPromisePool->Track(ShutdownDecoderWithPromise(TrackInfo::kVideoTrack));
|
||||
ShutdownDecoderWithPromise(TrackInfo::kVideoTrack);
|
||||
}
|
||||
|
||||
mShutdownPromisePool->Track(mDemuxer->Shutdown());
|
||||
|
@ -1137,7 +1137,7 @@ MediaFormatReader::Shutdown()
|
|||
&MediaFormatReader::TearDownDecoders);
|
||||
}
|
||||
|
||||
RefPtr<ShutdownPromise>
|
||||
void
|
||||
MediaFormatReader::ShutdownDecoderWithPromise(TrackType aTrack)
|
||||
{
|
||||
LOGV("%s", TrackTypeToStr(aTrack));
|
||||
|
@ -1148,13 +1148,15 @@ MediaFormatReader::ShutdownDecoderWithPromise(TrackType aTrack)
|
|||
// We always flush the decoder prior to a shutdown to ensure that all the
|
||||
// potentially pending operations on the decoder are completed.
|
||||
decoder.Flush();
|
||||
return decoder.mShutdownPromise.Ensure(__func__);
|
||||
mShutdownPromisePool->Track(decoder.mShutdownPromise.Ensure(__func__));
|
||||
return;
|
||||
}
|
||||
|
||||
if (decoder.mFlushing || decoder.mShuttingDown) {
|
||||
// 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__);
|
||||
mShutdownPromisePool->Track(decoder.mShutdownPromise.Ensure(__func__));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!decoder.mDecoder) {
|
||||
|
@ -1163,12 +1165,12 @@ MediaFormatReader::ShutdownDecoderWithPromise(TrackType aTrack)
|
|||
// This will be a no-op until we're processing the final decoder shutdown
|
||||
// prior to the MediaFormatReader being shutdown.
|
||||
mDecoderFactory->ShutdownDecoder(aTrack);
|
||||
return ShutdownPromise::CreateAndResolve(true, __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
// Finally, let's just shut down the currently active decoder.
|
||||
decoder.ShutdownDecoder();
|
||||
return decoder.mShutdownPromise.Ensure(__func__);
|
||||
mShutdownPromisePool->Track(decoder.mShutdownPromise.Ensure(__func__));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1184,7 +1186,7 @@ MediaFormatReader::ShutdownDecoder(TrackType aTrack)
|
|||
LOGV("Shutdown already in progress");
|
||||
return;
|
||||
}
|
||||
Unused << ShutdownDecoderWithPromise(aTrack);
|
||||
ShutdownDecoderWithPromise(aTrack);
|
||||
}
|
||||
|
||||
RefPtr<ShutdownPromise>
|
||||
|
|
|
@ -549,7 +549,7 @@ private:
|
|||
bool mHasStartTime = false;
|
||||
|
||||
void ShutdownDecoder(TrackType aTrack);
|
||||
RefPtr<ShutdownPromise> ShutdownDecoderWithPromise(TrackType aTrack);
|
||||
void ShutdownDecoderWithPromise(TrackType aTrack);
|
||||
RefPtr<ShutdownPromise> TearDownDecoders();
|
||||
};
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче