--- a/dom/media/MediaDecoder.cpp
+++ b/dom/media/MediaDecoder.cpp
@@ -494,16 +494,21 @@ MediaDecoder::SetInfinite(bool aInfinite
bool
MediaDecoder::IsInfinite() const
{
MOZ_ASSERT(NS_IsMainThread());
return mInfiniteStream;
}
+#define INIT_MIRROR(name, val) \
+ name(AbstractThread::MainThread(), val, "MediaDecoder::" #name " (Mirror)")
+#define INIT_CANONICAL(name, val) \
+ name(AbstractThread::MainThread(), val, "MediaDecoder::" #name " (Canonical)")
+
MediaDecoder::MediaDecoder(MediaDecoderOwner* aOwner)
: mWatchManager(this, AbstractThread::MainThread())
, mDormantSupported(false)
, mLogicalPosition(0.0)
, mDuration(std::numeric_limits<double>::quiet_NaN())
, mResourceCallback(new ResourceCallback())
#ifdef MOZ_EME
, mCDMProxyPromise(mCDMProxyPromiseHolder.Ensure(__func__))
@@ -521,63 +526,39 @@ MediaDecoder::MediaDecoder(MediaDecoderO
, mFiredMetadataLoaded(false)
, mIsDormant(false)
, mIsHeuristicDormantSupported(
Preferences::GetBool("media.decoder.heuristic.dormant.enabled", false))
, mHeuristicDormantTimeout(
Preferences::GetInt("media.decoder.heuristic.dormant.timeout",
DEFAULT_HEURISTIC_DORMANT_TIMEOUT_MSECS))
, mIsHeuristicDormant(false)
- , mStateMachineIsShutdown(AbstractThread::MainThread(), true,
- "MediaDecoder::mStateMachineIsShutdown (Mirror)")
- , mBuffered(AbstractThread::MainThread(), TimeIntervals(),
- "MediaDecoder::mBuffered (Mirror)")
- , mNextFrameStatus(AbstractThread::MainThread(),
- MediaDecoderOwner::NEXT_FRAME_UNINITIALIZED,
- "MediaDecoder::mNextFrameStatus (Mirror)")
- , mCurrentPosition(AbstractThread::MainThread(), 0,
- "MediaDecoder::mCurrentPosition (Mirror)")
- , mStateMachineDuration(AbstractThread::MainThread(), NullableTimeUnit(),
- "MediaDecoder::mStateMachineDuration (Mirror)")
- , mPlaybackPosition(AbstractThread::MainThread(), 0,
- "MediaDecoder::mPlaybackPosition (Mirror)")
- , mIsAudioDataAudible(AbstractThread::MainThread(), false,
- "MediaDecoder::mIsAudioDataAudible (Mirror)")
- , mVolume(AbstractThread::MainThread(), 0.0,
- "MediaDecoder::mVolume (Canonical)")
- , mPlaybackRate(AbstractThread::MainThread(), 1.0,
- "MediaDecoder::mPlaybackRate (Canonical)")
- , mPreservesPitch(AbstractThread::MainThread(), true,
- "MediaDecoder::mPreservesPitch (Canonical)")
- , mEstimatedDuration(AbstractThread::MainThread(), NullableTimeUnit(),
- "MediaDecoder::mEstimatedDuration (Canonical)")
- , mExplicitDuration(AbstractThread::MainThread(), Maybe<double>(),
- "MediaDecoder::mExplicitDuration (Canonical)")
- , mPlayState(AbstractThread::MainThread(), PLAY_STATE_LOADING,
- "MediaDecoder::mPlayState (Canonical)")
- , mNextState(AbstractThread::MainThread(), PLAY_STATE_PAUSED,
- "MediaDecoder::mNextState (Canonical)")
- , mLogicallySeeking(AbstractThread::MainThread(), false,
- "MediaDecoder::mLogicallySeeking (Canonical)")
- , mSameOriginMedia(AbstractThread::MainThread(), false,
- "MediaDecoder::mSameOriginMedia (Canonical)")
- , mMediaPrincipalHandle(AbstractThread::MainThread(), PRINCIPAL_HANDLE_NONE,
- "MediaDecoder::mMediaPrincipalHandle (Canonical)")
- , mPlaybackBytesPerSecond(AbstractThread::MainThread(), 0.0,
- "MediaDecoder::mPlaybackBytesPerSecond (Canonical)")
- , mPlaybackRateReliable(AbstractThread::MainThread(), true,
- "MediaDecoder::mPlaybackRateReliable (Canonical)")
- , mDecoderPosition(AbstractThread::MainThread(), 0,
- "MediaDecoder::mDecoderPosition (Canonical)")
- , mMediaSeekable(AbstractThread::MainThread(), true,
- "MediaDecoder::mMediaSeekable (Canonical)")
- , mMediaSeekableOnlyInBufferedRanges(AbstractThread::MainThread(), false,
- "MediaDecoder::mMediaSeekableOnlyInBufferedRanges (Canonical)")
- , mIsVisible(AbstractThread::MainThread(), !aOwner->IsHidden(),
- "MediaDecoder::mIsVisible (Canonical)")
+ , INIT_MIRROR(mStateMachineIsShutdown, true)
+ , INIT_MIRROR(mBuffered, TimeIntervals())
+ , INIT_MIRROR(mNextFrameStatus, MediaDecoderOwner::NEXT_FRAME_UNINITIALIZED)
+ , INIT_MIRROR(mCurrentPosition, 0)
+ , INIT_MIRROR(mStateMachineDuration, NullableTimeUnit())
+ , INIT_MIRROR(mPlaybackPosition, 0)
+ , INIT_MIRROR(mIsAudioDataAudible, false)
+ , INIT_CANONICAL(mVolume, 0.0)
+ , INIT_CANONICAL(mPlaybackRate, 1.0)
+ , INIT_CANONICAL(mPreservesPitch, true)
+ , INIT_CANONICAL(mEstimatedDuration, NullableTimeUnit())
+ , INIT_CANONICAL(mExplicitDuration, Maybe<double>())
+ , INIT_CANONICAL(mPlayState, PLAY_STATE_LOADING)
+ , INIT_CANONICAL(mNextState, PLAY_STATE_PAUSED)
+ , INIT_CANONICAL(mLogicallySeeking, false)
+ , INIT_CANONICAL(mSameOriginMedia, false)
+ , INIT_CANONICAL(mMediaPrincipalHandle, PRINCIPAL_HANDLE_NONE)
+ , INIT_CANONICAL(mPlaybackBytesPerSecond, 0.0)
+ , INIT_CANONICAL(mPlaybackRateReliable, true)
+ , INIT_CANONICAL(mDecoderPosition, 0)
+ , INIT_CANONICAL(mMediaSeekable, true)
+ , INIT_CANONICAL(mMediaSeekableOnlyInBufferedRanges, false)
+ , INIT_CANONICAL(mIsVisible, !aOwner->IsHidden())
, mTelemetryReported(false)
{
MOZ_COUNT_CTOR(MediaDecoder);
MOZ_ASSERT(NS_IsMainThread());
MediaMemoryTracker::AddMediaDecoder(this);
mAudioChannel = AudioChannelService::GetDefaultAudioChannel();
mResourceCallback->Connect(this);
@@ -607,16 +588,19 @@ MediaDecoder::MediaDecoder(MediaDecoderO
// mIgnoreProgressData
mWatchManager.Watch(mLogicallySeeking, &MediaDecoder::SeekingChanged);
mWatchManager.Watch(mIsAudioDataAudible, &MediaDecoder::NotifyAudibleStateChanged);
MediaShutdownManager::Instance().Register(this);
}
+#undef INIT_MIRROR
+#undef INIT_CANONICAL
+
void
MediaDecoder::Shutdown()
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(!IsShutdown());
// Unwatch all watch targets to prevent further notifications.
mWatchManager.Shutdown();