author | Kaku Kuo <kaku@mozilla.com> |
Sat, 11 Mar 2017 15:12:38 +0800 | |
changeset 347422 | f4fc110ccde19cdf2ed6c531c91503ad425fac7f |
parent 347421 | 6cc263c1f298f543eea564eb014808c39c597754 |
child 347423 | d450a061b0bef2c56f7055c967530a12d168bb64 |
push id | 31496 |
push user | cbook@mozilla.com |
push date | Tue, 14 Mar 2017 13:21:57 +0000 |
treeherder | mozilla-central@9a26ed658fdc [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | jwwang |
bugs | 1346498 |
milestone | 55.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/dom/media/MediaDecoder.cpp +++ b/dom/media/MediaDecoder.cpp @@ -391,16 +391,17 @@ MediaDecoder::MediaDecoder(MediaDecoderO , mVideoFrameContainer(aOwner->GetVideoFrameContainer()) , mPlaybackStatistics(new MediaChannelStatistics()) , mPinnedForSeek(false) , mMinimizePreroll(false) , mMediaTracksConstructed(false) , mFiredMetadataLoaded(false) , mElementVisible(!aOwner->IsHidden()) , mForcedHidden(false) + , mHasSuspendTaint(false) , INIT_MIRROR(mStateMachineIsShutdown, true) , INIT_MIRROR(mBuffered, TimeIntervals()) , INIT_MIRROR(mNextFrameStatus, MediaDecoderOwner::NEXT_FRAME_UNAVAILABLE) , INIT_MIRROR(mCurrentPosition, 0) , INIT_MIRROR(mStateMachineDuration, NullableTimeUnit()) , INIT_MIRROR(mPlaybackPosition, 0) , INIT_MIRROR(mIsAudioDataAudible, false) , INIT_CANONICAL(mVolume, 0.0) @@ -410,17 +411,16 @@ MediaDecoder::MediaDecoder(MediaDecoderO , 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(mHasSuspendTaint, false) , mTelemetryReported(false) , mIsMediaElement(!!aOwner->GetMediaElement()) , mElement(aOwner->GetMediaElement()) { MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(mAbstractMainThread); MediaMemoryTracker::AddMediaDecoder(this);
--- a/dom/media/MediaDecoder.h +++ b/dom/media/MediaDecoder.h @@ -717,16 +717,20 @@ protected: nsAutoPtr<MediaInfo> mInfo; // Tracks the visiblity status from HTMLMediaElement bool mElementVisible; // If true, forces the decoder to be considered hidden. bool mForcedHidden; + // True if the decoder has a suspend taint - meaning suspend-video-decoder is + // disabled. + bool mHasSuspendTaint; + // A listener to receive metadata updates from MDSM. MediaEventListener mTimedMetadataListener; MediaEventListener mMetadataLoadedListener; MediaEventListener mFirstFrameLoadedListener; MediaEventListener mOnPlaybackEvent; MediaEventListener mOnPlaybackErrorEvent; @@ -806,20 +810,16 @@ protected: Canonical<bool> mPlaybackRateReliable; // Current decoding position in the stream. This is where the decoder // is up to consuming the stream. This is not adjusted during decoder // seek operations, but it's updated at the end when we start playing // back again. Canonical<int64_t> mDecoderPosition; - // True if the decoder has a suspend taint - meaning suspend-video-decoder is - // disabled. - Canonical<bool> mHasSuspendTaint; - public: AbstractCanonical<media::NullableTimeUnit>* CanonicalDurationOrNull() override; AbstractCanonical<double>* CanonicalVolume() { return &mVolume; } AbstractCanonical<bool>* CanonicalPreservesPitch() { return &mPreservesPitch; } AbstractCanonical<media::NullableTimeUnit>* CanonicalEstimatedDuration() @@ -851,17 +851,16 @@ public: AbstractCanonical<bool>* CanonicalPlaybackRateReliable() { return &mPlaybackRateReliable; } AbstractCanonical<int64_t>* CanonicalDecoderPosition() { return &mDecoderPosition; } - AbstractCanonical<bool>* CanonicalHasSuspendTaint() { return &mHasSuspendTaint; } private: // Notify owner when the audible state changed void NotifyAudibleStateChanged(); /* Functions called by ResourceCallback */ // A media stream is assumed to be infinite if the metadata doesn't
--- a/dom/media/MediaDecoderStateMachine.cpp +++ b/dom/media/MediaDecoderStateMachine.cpp @@ -2542,17 +2542,16 @@ ShutdownState::Enter() master->mNextPlayState.DisconnectIfConnected(); master->mVolume.DisconnectIfConnected(); master->mPreservesPitch.DisconnectIfConnected(); master->mSameOriginMedia.DisconnectIfConnected(); master->mMediaPrincipalHandle.DisconnectIfConnected(); master->mPlaybackBytesPerSecond.DisconnectIfConnected(); master->mPlaybackRateReliable.DisconnectIfConnected(); master->mDecoderPosition.DisconnectIfConnected(); - master->mHasSuspendTaint.DisconnectIfConnected(); master->mDuration.DisconnectAll(); master->mIsShutdown.DisconnectAll(); master->mNextFrameStatus.DisconnectAll(); master->mCurrentPosition.DisconnectAll(); master->mPlaybackOffset.DisconnectAll(); master->mIsAudioDataAudible.DisconnectAll(); @@ -2610,17 +2609,16 @@ MediaDecoderStateMachine::MediaDecoderSt INIT_MIRROR(mNextPlayState, MediaDecoder::PLAY_STATE_PAUSED), INIT_MIRROR(mVolume, 1.0), INIT_MIRROR(mPreservesPitch, true), INIT_MIRROR(mSameOriginMedia, false), INIT_MIRROR(mMediaPrincipalHandle, PRINCIPAL_HANDLE_NONE), INIT_MIRROR(mPlaybackBytesPerSecond, 0.0), INIT_MIRROR(mPlaybackRateReliable, true), INIT_MIRROR(mDecoderPosition, 0), - INIT_MIRROR(mHasSuspendTaint, false), INIT_CANONICAL(mDuration, NullableTimeUnit()), INIT_CANONICAL(mIsShutdown, false), INIT_CANONICAL(mNextFrameStatus, MediaDecoderOwner::NEXT_FRAME_UNAVAILABLE), INIT_CANONICAL(mCurrentPosition, 0), INIT_CANONICAL(mPlaybackOffset, 0), INIT_CANONICAL(mIsAudioDataAudible, false) { MOZ_COUNT_CTOR(MediaDecoderStateMachine); @@ -2680,22 +2678,16 @@ MediaDecoderStateMachine::Initialization mWatchManager.Watch(mEstimatedDuration, &MediaDecoderStateMachine::RecomputeDuration); mWatchManager.Watch(mExplicitDuration, &MediaDecoderStateMachine::RecomputeDuration); mWatchManager.Watch(mObservedDuration, &MediaDecoderStateMachine::RecomputeDuration); mWatchManager.Watch(mPlayState, &MediaDecoderStateMachine::PlayStateChanged); - if (MediaPrefs::MDSMSuspendBackgroundVideoEnabled()) { - mHasSuspendTaint.Connect(aDecoder->CanonicalHasSuspendTaint()); - mWatchManager.Watch(mHasSuspendTaint, - &MediaDecoderStateMachine::SuspendTaintChanged); - } - MOZ_ASSERT(!mStateObj); auto* s = new DecodeMetadataState(this); mStateObj.reset(s); s->Enter(); } void MediaDecoderStateMachine::AudioAudibleChanged(bool aAudible) @@ -3009,29 +3001,16 @@ void MediaDecoderStateMachine::PlayState // assume the user is likely to want to keep playing in future. This needs // to happen before we invoke StartDecoding(). mMinimizePreroll = false; } mStateObj->HandlePlayStateChanged(mPlayState); } -void MediaDecoderStateMachine::SuspendTaintChanged() -{ - MOZ_ASSERT(OnTaskQueue()); - MOZ_ASSERT(mHasSuspendTaint); // Suspend taint is only ever set. - - CancelSuspendTimer(); - - // Resume from suspended decoding. - if (mVideoDecodeSuspended) { - mStateObj->HandleResumeVideoDecoding(); - } -} - void MediaDecoderStateMachine::SetVideoDecodeMode(VideoDecodeMode aMode) { nsCOMPtr<nsIRunnable> r = NewRunnableMethod<VideoDecodeMode>(this, &MediaDecoderStateMachine::SetVideoDecodeModeInternal, aMode); OwnerThread()->DispatchStateChange(r.forget()); }
--- a/dom/media/MediaDecoderStateMachine.h +++ b/dom/media/MediaDecoderStateMachine.h @@ -402,19 +402,16 @@ protected: void StartMediaSink(); // Notification method invoked when mPlayState changes. void PlayStateChanged(); // Notification method invoked when mIsVisible changes. void VisibilityChanged(); - // Notification method invoked when mHasSuspendTaint changes. - void SuspendTaintChanged(); - // Sets internal state which causes playback of media to pause. // The decoder monitor must be held. void StopPlayback(); // If the conditions are right, sets internal state which causes playback // of media to begin or resume. // Must be called with the decode monitor held. void MaybeStartPlayback(); @@ -749,18 +746,16 @@ private: Mirror<double> mPlaybackBytesPerSecond; // True if mPlaybackBytesPerSecond is a reliable estimate. Mirror<bool> mPlaybackRateReliable; // Current decoding position in the stream. Mirror<int64_t> mDecoderPosition; - // HasSuspendTaint, mirrored from the media decoder. - Mirror<bool> mHasSuspendTaint; // Duration of the media. This is guaranteed to be non-null after we finish // decoding the first frame. Canonical<media::NullableTimeUnit> mDuration; // Whether we're currently in or transitioning to shutdown state. Canonical<bool> mIsShutdown;