Bug 1309494 part 1 - add mozvideodecoderresumed event; r?jwwang draft
authorKaku Kuo <kaku@mozilla.com>
Tue, 18 Oct 2016 18:54:38 +0800
changeset 426476 045391de5d618167f18774237de96bb6de1d56a9
parent 426204 d741d5ce94166ea4e3558e99e401d840d21d4958
child 426477 0e5add843a7a430a92d4fb7f8572142479840ad2
child 426821 8e21c79f15ff17011141738c8707336bcd77e9b2
push id32697
push userbmo:kaku@mozilla.com
push dateTue, 18 Oct 2016 12:16:14 +0000
reviewersjwwang
bugs1309494
milestone52.0a1
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
dom/media/MediaDecoder.cpp
dom/media/MediaDecoderStateMachine.cpp
dom/media/MediaDecoderStateMachine.h
--- 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