Bug 1330889. Part 5 - remove MDSM::mState.
MozReview-Commit-ID: 648LWr4WU0F
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -290,24 +290,23 @@ protected:
-> decltype(ReturnTypeHelper(&S::Enter))
{
// keep mMaster in a local object because mMaster will become invalid after
// the current state object is deleted.
auto master = mMaster;
auto s = new S(master);
- MOZ_ASSERT(master->mState != s->GetState() ||
- master->mState == DECODER_STATE_SEEKING);
+ MOZ_ASSERT(GetState() != s->GetState() ||
+ GetState() == DECODER_STATE_SEEKING);
SLOG("change state to: %s", ToStateStr(s->GetState()));
Exit();
- master->mState = s->GetState();
master->mStateObj.reset(s);
return s->Enter(Move(aArgs)...);
}
RefPtr<MediaDecoder::SeekPromise>
SetSeekingState(SeekJob&& aSeekJob, EventVisibility aVisibility);
// Take a raw pointer in order not to change the life cycle of MDSM.
@@ -2734,17 +2733,16 @@ nsresult MediaDecoderStateMachine::Init(
&MediaDecoderStateMachine::OnCDMProxyNotReady)
->Track(mCDMProxyPromise);
nsresult rv = mReader->Init();
NS_ENSURE_SUCCESS(rv, rv);
RefPtr<MediaDecoderStateMachine> self = this;
OwnerThread()->Dispatch(NS_NewRunnableFunction([self] () {
- MOZ_ASSERT(self->mState == DECODER_STATE_DECODING_METADATA);
MOZ_ASSERT(!self->mStateObj);
auto s = new DecodeMetadataState(self);
self->mStateObj.reset(s);
s->Enter();
}));
return NS_OK;
}
@@ -2830,17 +2828,17 @@ MediaDecoderStateMachine::ToStateStr(Sta
}
return "UNKNOWN";
}
const char*
MediaDecoderStateMachine::ToStateStr()
{
MOZ_ASSERT(OnTaskQueue());
- return ToStateStr(mState);
+ return ToStateStr(mStateObj->GetState());
}
void MediaDecoderStateMachine::VolumeChanged()
{
MOZ_ASSERT(OnTaskQueue());
mMediaSink->SetVolume(mVolume);
}
@@ -3658,17 +3656,17 @@ MediaDecoderStateMachine::DumpDebugInfo(
// It is fine to capture a raw pointer here because MediaDecoder only call
// this function before shutdown begins.
nsCOMPtr<nsIRunnable> r = NS_NewRunnableFunction([this] () {
mMediaSink->DumpDebugInfo();
mStateObj->DumpDebugInfo();
DUMP_LOG(
"GetMediaTime=%lld GetClock=%lld mMediaSink=%p "
- "mState=%s mPlayState=%d mSentFirstFrameLoadedEvent=%d IsPlaying=%d "
+ "state=%s mPlayState=%d mSentFirstFrameLoadedEvent=%d IsPlaying=%d "
"mAudioStatus=%s mVideoStatus=%s mDecodedAudioEndTime=%lld mDecodedVideoEndTime=%lld "
"mAudioCompleted=%d mVideoCompleted=%d",
GetMediaTime(), mMediaSink->IsStarted() ? GetClock() : -1, mMediaSink.get(),
ToStateStr(), mPlayState.Ref(), mSentFirstFrameLoadedEvent, IsPlaying(),
AudioRequestStatus(), VideoRequestStatus(), mDecodedAudioEndTime, mDecodedVideoEndTime,
mAudioCompleted, mVideoCompleted);
});
--- a/dom/media/MediaDecoderStateMachine.h
+++ b/dom/media/MediaDecoderStateMachine.h
@@ -483,18 +483,16 @@ private:
// Queue of audio frames. This queue is threadsafe, and is accessed from
// the audio, decoder, state machine, and main threads.
MediaQueue<MediaData> mAudioQueue;
// Queue of video frames. This queue is threadsafe, and is accessed from
// the decoder, state machine, and main threads.
MediaQueue<MediaData> mVideoQueue;
- State mState = DECODER_STATE_DECODING_METADATA;
-
UniquePtr<StateObject> mStateObj;
media::TimeUnit Duration() const { MOZ_ASSERT(OnTaskQueue()); return mDuration.Ref().ref(); }
// Recomputes the canonical duration from various sources.
void RecomputeDuration();