Bug 1341200. Part 3 - replace mShutdownRequest with a bool as P2.
MozReview-Commit-ID: ERERt0ZyvkC
--- a/dom/media/MediaFormatReader.cpp
+++ b/dom/media/MediaFormatReader.cpp
@@ -1080,17 +1080,17 @@ MediaFormatReader::ShutdownDecoderWithPr
if (!decoder.mFlushed && decoder.mDecoder) {
// The decoder has yet to be flushed.
// 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__);
}
- if (decoder.mFlushing || decoder.mShutdownRequest.Exists()) {
+ 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__);
}
if (!decoder.mDecoder) {
// Shutdown any decoders that may be in the process of being initialized
// in the Decoder Factory.
@@ -1887,17 +1887,17 @@ MediaFormatReader::DecodeDemuxedSamples(
void
MediaFormatReader::HandleDemuxedSamples(
TrackType aTrack, AbstractMediaDecoder::AutoNotifyDecoded& aA)
{
MOZ_ASSERT(OnTaskQueue());
auto& decoder = GetDecoderData(aTrack);
- if (decoder.mFlushing || decoder.mShutdownRequest.Exists()) {
+ if (decoder.mFlushing || decoder.mShuttingDown) {
LOGV("Decoder operation in progress, let it complete.");
return;
}
if (decoder.mQueuedSamples.IsEmpty()) {
return;
}
@@ -2270,17 +2270,17 @@ MediaFormatReader::Update(TrackType aTra
TrackTypeToStr(aTrack),
needInput,
needOutput,
decoder.mNumSamplesInput,
decoder.mNumSamplesOutput,
uint32_t(size_t(decoder.mSizeOfQueue)),
decoder.mDecodeRequest.Exists(),
decoder.mFlushing,
- decoder.mShutdownRequest.Exists(),
+ decoder.mShuttingDown,
uint32_t(decoder.mOutput.Length()),
decoder.mWaitingForData,
decoder.mLastStreamSourceID);
if ((decoder.mWaitingForData
&& (!decoder.mTimeThreshold || decoder.mTimeThreshold.ref().mWaiting))
|| (decoder.mWaitingForKey && decoder.mDecodeRequest.Exists())) {
// Nothing more we can do at present.
--- a/dom/media/MediaFormatReader.h
+++ b/dom/media/MediaFormatReader.h
@@ -217,25 +217,25 @@ private:
void ShutdownDecoder()
{
MutexAutoLock lock(mMutex);
if (mDecoder) {
RefPtr<MediaFormatReader> owner = mOwner;
TrackType type = mType == MediaData::AUDIO_DATA
? TrackType::kAudioTrack
: TrackType::kVideoTrack;
+ mShuttingDown = true;
mDecoder->Shutdown()
->Then(mOwner->OwnerThread(), __func__,
[owner, this, type]() {
- mShutdownRequest.Complete();
+ mShuttingDown = false;
mShutdownPromise.ResolveIfExists(true, __func__);
owner->ScheduleUpdate(type);
},
- []() { MOZ_RELEASE_ASSERT(false, "Can't ever be here"); })
- ->Track(mShutdownRequest);
+ []() { MOZ_RELEASE_ASSERT(false, "Can't ever be here"); });
}
mDescription = "shutdown";
mDecoder = nullptr;
}
// Only accessed from reader's task queue.
bool mUpdateScheduled;
bool mDemuxEOS;
@@ -264,17 +264,17 @@ private:
}
// MediaDataDecoder handler's variables.
MozPromiseRequestHolder<MediaDataDecoder::DecodePromise> mDecodeRequest;
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;
- MozPromiseRequestHolder<ShutdownPromise> mShutdownRequest;
+ bool mShuttingDown = false; // True if shutdown is in action.
MozPromiseRequestHolder<MediaDataDecoder::DecodePromise> mDrainRequest;
DrainState mDrainState;
bool HasPendingDrain() const
{
return mDrainState != DrainState::None;
}
void RequestDrain()