Bug 1309494 part 1 - add mozvideodecoderresumed event; r?jwwang
mozvideodecoderresumed is used to indicate UI that video decoder has been resumed.
MozReview-Commit-ID: GqRbJ3zPQ6v
--- a/dom/media/MediaDecoder.cpp
+++ b/dom/media/MediaDecoder.cpp
@@ -665,16 +665,18 @@ MediaDecoder::OnPlaybackEvent(MediaEvent
mOwner->DispatchAsyncEvent(NS_LITERAL_STRING("mozexitvideosuspend"));
break;
case MediaEventType::BeginVideoSuspend:
mOwner->DispatchAsyncEvent(NS_LITERAL_STRING("mozbeginvideosuspend"));
break;
case MediaEventType::CancelVideoSuspend:
mOwner->DispatchAsyncEvent(NS_LITERAL_STRING("mozcancelvideosuspend"));
break;
+ case MediaEventType::VideoDecoderResumed:
+ mOwner->DispatchAsyncEvent(NS_LITERAL_STRING("mozvideodecoderresumed"));
}
}
void
MediaDecoder::OnPlaybackErrorEvent(const MediaResult& aError)
{
DecodeError(aError);
}
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -2385,16 +2385,18 @@ MediaDecoderStateMachine::SetWaitForFram
}
void
MediaDecoderStateMachine::MarkWaitForFrameDone()
{
DECODER_LOG("MarkWaitForFrameDone: state = %p", mWaitForFrameState);
MOZ_ASSERT(OnTaskQueue());
+ mOnPlaybackEvent.Notify(MediaEventType::VideoDecoderResumed);
+
WaitForFrame* state = mWaitForFrameState;
if (state) {
MonitorAutoLock lock(state->mMon);
mWaitForFrameState = nullptr;
state->mDone = true;
lock.NotifyAll();
}
}
--- 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,
BeginVideoSuspend,
- CancelVideoSuspend
+ CancelVideoSuspend,
+ VideoDecoderResumed
};
/*
The state machine class. This manages the decoding and seeking in the
MediaDecoderReader on the decode task queue, and A/V sync on the shared
state machine thread, and controls the audio "push" thread.
All internal state is synchronised via the decoder monitor. State changes