From ba4e0eb433138d8a549ea98efd3189fbd240e28d Mon Sep 17 00:00:00 2001 From: trav90 Date: Sun, 12 Mar 2017 04:03:12 -0500 Subject: [PATCH] Add additional assertions to the MDSM --- dom/media/MediaDecoderStateMachine.cpp | 7 +++++++ dom/media/MediaDecoderStateMachine.h | 1 + 2 files changed, 8 insertions(+) diff --git a/dom/media/MediaDecoderStateMachine.cpp b/dom/media/MediaDecoderStateMachine.cpp index 4e6fcb6293..c6de81a6de 100644 --- a/dom/media/MediaDecoderStateMachine.cpp +++ b/dom/media/MediaDecoderStateMachine.cpp @@ -797,6 +797,7 @@ MediaDecoderStateMachine::OnAudioDecoded(AudioData* aAudioSample) void MediaDecoderStateMachine::Push(AudioData* aSample) { + MOZ_ASSERT(OnTaskQueue()); MOZ_ASSERT(aSample); // TODO: Send aSample to MSG and recalculate readystate before pushing, // otherwise AdvanceFrame may pop the sample before we have a chance @@ -814,6 +815,7 @@ MediaDecoderStateMachine::Push(AudioData* aSample) void MediaDecoderStateMachine::Push(VideoData* aSample) { + MOZ_ASSERT(OnTaskQueue()); MOZ_ASSERT(aSample); // TODO: Send aSample to MSG and recalculate readystate before pushing, // otherwise AdvanceFrame may pop the sample before we have a chance @@ -1176,6 +1178,7 @@ void MediaDecoderStateMachine::StopPlayback() void MediaDecoderStateMachine::MaybeStartPlayback() { + MOZ_ASSERT(OnTaskQueue()); AssertCurrentThreadInMonitor(); if (IsPlaying()) { // Logging this case is really spammy - don't do it. @@ -1232,6 +1235,7 @@ void MediaDecoderStateMachine::UpdatePlaybackPositionInternal(int64_t aTime) void MediaDecoderStateMachine::UpdatePlaybackPosition(int64_t aTime) { + MOZ_ASSERT(OnTaskQueue()); UpdatePlaybackPositionInternal(aTime); bool fragmentEnded = mFragmentEndTime >= 0 && GetMediaTime() >= mFragmentEndTime; @@ -1727,6 +1731,7 @@ MediaDecoderStateMachine::SetReaderIdle() void MediaDecoderStateMachine::DispatchDecodeTasksIfNeeded() { + MOZ_ASSERT(OnTaskQueue()); AssertCurrentThreadInMonitor(); if (mState != DECODER_STATE_DECODING && @@ -2168,6 +2173,7 @@ MediaDecoderStateMachine::OnMetadataNotRead(ReadMetadataFailureReason aReason) void MediaDecoderStateMachine::EnqueueLoadedMetadataEvent() { + MOZ_ASSERT(OnTaskQueue()); nsAutoPtr info(new MediaInfo()); *info = mInfo; MediaDecoderEventVisibility visibility = mSentLoadedMetadataEvent? @@ -2182,6 +2188,7 @@ MediaDecoderStateMachine::EnqueueLoadedMetadataEvent() void MediaDecoderStateMachine::EnqueueFirstFrameLoadedEvent() { + MOZ_ASSERT(OnTaskQueue()); nsAutoPtr info(new MediaInfo()); *info = mInfo; MediaDecoderEventVisibility visibility = mSentFirstFrameLoadedEvent? diff --git a/dom/media/MediaDecoderStateMachine.h b/dom/media/MediaDecoderStateMachine.h index 5630471c91..a05b6475ce 100644 --- a/dom/media/MediaDecoderStateMachine.h +++ b/dom/media/MediaDecoderStateMachine.h @@ -780,6 +780,7 @@ protected: void Ensure(mozilla::TimeStamp& aTarget) { + MOZ_ASSERT(mSelf->OnTaskQueue()); if (IsScheduled() && mTarget <= aTarget) { return; }