Bug 1378085 P2 - override Enter(); r?jwwang
MozReview-Commit-ID: AuwpbiaQzML
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -963,22 +963,16 @@ public:
// in the middle of seeking and won't have a valid video frame to show
// when seek is done.
if (mMaster->mVideoDecodeSuspended) {
mMaster->mVideoDecodeSuspended = false;
mMaster->mOnPlaybackEvent.Notify(MediaEventType::ExitVideoSuspend);
Reader()->SetVideoBlankDecode(false);
}
- // Dispatch a mozvideoonlyseekbegin event to indicate UI for corresponding
- // changes.
- if (mSeekJob.mTarget->IsVideoOnly()) {
- mMaster->mOnPlaybackEvent.Notify(MediaEventType::VideoOnlySeekBegin);
- }
-
// Suppressed visibility comes from two cases: (1) leaving dormant state,
// and (2) resuming suspended video decoder. We want both cases to be
// transparent to the user. So we only notify the change when the seek
// request is from the user.
if (mVisibility == EventVisibility::Observable) {
// Don't stop playback for a video-only seek since we want to keep playing
// audio and we don't need to stop playback while leaving dormant for the
// playback should has been stopped.
@@ -1768,16 +1762,33 @@ private:
}
};
class MediaDecoderStateMachine::VideoOnlySeekingState
: public MediaDecoderStateMachine::AccurateSeekingState
{
public:
explicit VideoOnlySeekingState(Master* aPtr) : AccurateSeekingState(aPtr) { }
+
+ RefPtr<MediaDecoder::SeekPromise> Enter(SeekJob&& aSeekJob,
+ EventVisibility aVisibility)
+ {
+ MOZ_ASSERT(aSeekJob.mTarget->IsVideoOnly());
+ MOZ_ASSERT(aVisibility == EventVisibility::Suppressed);
+
+ RefPtr<MediaDecoder::SeekPromise> p =
+ AccurateSeekingState::Enter(Move(aSeekJob), aVisibility);
+
+ // Dispatch a mozvideoonlyseekbegin event to indicate UI for corresponding
+ // changes.
+ mMaster->mOnPlaybackEvent.Notify(MediaEventType::VideoOnlySeekBegin);
+
+ return p.forget();
+ }
+
};
RefPtr<MediaDecoder::SeekPromise>
MediaDecoderStateMachine::DormantState::HandleSeek(SeekTarget aTarget)
{
if (aTarget.IsNextFrame()) {
// NextFrameSeekingState doesn't reset the decoder unlike
// AccurateSeekingState. So we first must come out of dormant by seeking to