Bug 1350852 P1 - add a mozvideoonlyseekcompleted event; r?jwwang
MozReview-Commit-ID: wLMawR9Coz
--- a/dom/media/MediaDecoder.cpp
+++ b/dom/media/MediaDecoder.cpp
@@ -567,16 +567,19 @@ MediaDecoder::OnPlaybackEvent(MediaEvent
case MediaEventType::ExitVideoSuspend:
GetOwner()->DispatchAsyncEvent(NS_LITERAL_STRING("mozexitvideosuspend"));
break;
case MediaEventType::StartVideoSuspendTimer:
GetOwner()->DispatchAsyncEvent(NS_LITERAL_STRING("mozstartvideosuspendtimer"));
break;
case MediaEventType::CancelVideoSuspendTimer:
GetOwner()->DispatchAsyncEvent(NS_LITERAL_STRING("mozcancelvideosuspendtimer"));
+ break;
+ case MediaEventType::VideoOnlySeekCompleted:
+ GetOwner()->DispatchAsyncEvent(NS_LITERAL_STRING("mozvideoonlyseekcompleted"));
}
}
void
MediaDecoder::OnPlaybackErrorEvent(const MediaResult& aError)
{
DecodeError(aError);
}
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -2393,16 +2393,22 @@ SeekingState::SeekCompleted()
// Ensure timestamps are up to date.
if (!target.IsVideoOnly()) {
// Don't update playback position for video-only seek.
// Otherwise we might have |newCurrentTime > mMediaSink->GetPosition()|
// and fail the assertion in GetClock() since we didn't stop MediaSink.
mMaster->UpdatePlaybackPositionInternal(newCurrentTime);
}
+ // Dispatch an event so that the UI can change in response to the end of
+ // video-only seek
+ if (target.IsVideoOnly()) {
+ mMaster->mOnPlaybackEvent.Notify(MediaEventType::VideoOnlySeekCompleted);
+ }
+
// Try to decode another frame to detect if we're at the end...
SLOG("Seek completed, mCurrentPosition=%" PRId64,
mMaster->mCurrentPosition.Ref());
if (mMaster->VideoQueue().PeekFront()) {
mMaster->mMediaSink->Redraw(Info().mVideo);
mMaster->mOnPlaybackEvent.Notify(MediaEventType::Invalidate);
}
--- a/dom/media/MediaDecoderStateMachine.h
+++ b/dom/media/MediaDecoderStateMachine.h
@@ -118,17 +118,18 @@ enum class MediaEventType : int8_t
PlaybackStarted,
PlaybackStopped,
PlaybackEnded,
SeekStarted,
Invalidate,
EnterVideoSuspend,
ExitVideoSuspend,
StartVideoSuspendTimer,
- CancelVideoSuspendTimer
+ CancelVideoSuspendTimer,
+ VideoOnlySeekCompleted,
};
enum class VideoDecodeMode : uint8_t
{
Normal,
Suspend
};