Bug 1314526. Part 4 - fix HandleEndOfStream(). r=kikuo
authorJW Wang <jwwang@mozilla.com>
Fri, 28 Oct 2016 16:30:52 +0800
changeset 435589 5b6b44bd04957942b18c80caacd3822630d942a7
parent 435588 214d895597a04db686d0be4c459c994153c00eae
child 435590 8bda14acdc2227a8431136d80ca2739a2010901f
push id35078
push usermbrubeck@mozilla.com
push dateTue, 08 Nov 2016 22:02:54 +0000
reviewerskikuo
bugs1314526
milestone52.0a1
Bug 1314526. Part 4 - fix HandleEndOfStream(). r=kikuo MozReview-Commit-ID: Kg3xAuX9FPf
dom/media/MediaDecoderStateMachine.cpp
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -191,18 +191,17 @@ public:
   virtual void Exit() {};  // Exit action.
   virtual void Step() {}   // Perform a 'cycle' of this state object.
   virtual State GetState() const = 0;
 
   // Event handlers for various events.
   virtual void HandleCDMProxyReady() {}
   virtual void HandleAudioDecoded(MediaData* aAudio) {}
   virtual void HandleVideoDecoded(MediaData* aVideo, TimeStamp aDecodeStart) {}
-
-  virtual bool HandleEndOfStream() { return false; }
+  virtual void HandleEndOfStream() {}
 
   virtual bool HandleWaitingForData() { return false; }
 
   virtual RefPtr<MediaDecoder::SeekPromise> HandleSeek(SeekTarget aTarget) = 0;
 
   virtual bool HandleAudioCaptured() { return false; }
 
   virtual RefPtr<ShutdownPromise> HandleShutdown();
@@ -481,20 +480,19 @@ public:
   }
 
   void HandleVideoDecoded(MediaData* aVideo, TimeStamp aDecodeStart) override
   {
     mMaster->Push(aVideo, MediaData::VIDEO_DATA);
     MaybeFinishDecodeFirstFrame();
   }
 
-  bool HandleEndOfStream() override
+  void HandleEndOfStream() override
   {
     MaybeFinishDecodeFirstFrame();
-    return true;
   }
 
   RefPtr<MediaDecoder::SeekPromise> HandleSeek(SeekTarget aTarget) override;
 
   void HandleVideoSuspendTimeout() override
   {
     // Do nothing for we need to decode the 1st video frame to get the dimensions.
   }
@@ -582,17 +580,17 @@ public:
   {
     mMaster->Push(aVideo, MediaData::VIDEO_DATA);
     MaybeStopPrerolling();
     CheckSlowDecoding(aDecodeStart);
   }
 
   RefPtr<MediaDecoder::SeekPromise> HandleSeek(SeekTarget aTarget) override;
 
-  bool HandleEndOfStream() override;
+  void HandleEndOfStream() override;
 
   bool HandleWaitingForData() override
   {
     MaybeStopPrerolling();
     return true;
   }
 
   bool HandleAudioCaptured() override
@@ -966,17 +964,17 @@ public:
   void HandleVideoDecoded(MediaData* aVideo, TimeStamp aDecodeStart) override
   {
     // This might be the sample we need to exit buffering.
     // Schedule Step() to check it.
     mMaster->Push(aVideo, MediaData::VIDEO_DATA);
     mMaster->ScheduleStateMachine();
   }
 
-  bool HandleEndOfStream() override;
+  void HandleEndOfStream() override;
 
   RefPtr<MediaDecoder::SeekPromise> HandleSeek(SeekTarget aTarget) override;
 
   void HandleVideoSuspendTimeout() override
   {
     if (mMaster->HasVideo()) {
       mMaster->mVideoDecodeSuspended = true;
       mMaster->mOnPlaybackEvent.Notify(MediaEventType::EnterVideoSuspend);
@@ -1420,26 +1418,25 @@ MediaDecoderStateMachine::
 DecodingState::HandleSeek(SeekTarget aTarget)
 {
   SLOG("Changed state to SEEKING (to %lld)", aTarget.GetTime().ToMicroseconds());
   SeekJob seekJob;
   seekJob.mTarget = aTarget;
   return SetState<SeekingState>(Move(seekJob));
 }
 
-bool
+void
 MediaDecoderStateMachine::
 DecodingState::HandleEndOfStream()
 {
   if (mMaster->CheckIfDecodeComplete()) {
     SetState<CompletedState>();
   } else {
     MaybeStopPrerolling();
   }
-  return true;
 }
 
 void
 MediaDecoderStateMachine::
 DecodingState::MaybeStartBuffering()
 {
   // Buffering makes senses only after decoding first frames.
   MOZ_ASSERT(mMaster->mSentFirstFrameLoadedEvent);
@@ -1601,27 +1598,26 @@ BufferingState::Step()
          mMaster->OutOfDecodedVideo(), mMaster->VideoRequestStatus());
     return;
   }
 
   SLOG("Buffered for %.3lfs", (now - mBufferingStart).ToSeconds());
   SetState<DecodingState>();
 }
 
-bool
+void
 MediaDecoderStateMachine::
 BufferingState::HandleEndOfStream()
 {
   if (mMaster->CheckIfDecodeComplete()) {
     SetState<CompletedState>();
   } else {
     // Check if we can exit buffering.
     mMaster->ScheduleStateMachine();
   }
-  return true;
 }
 
 RefPtr<MediaDecoder::SeekPromise>
 MediaDecoderStateMachine::
 BufferingState::HandleSeek(SeekTarget aTarget)
 {
   SLOG("Changed state to SEEKING (to %lld)", aTarget.GetTime().ToMicroseconds());
   SeekJob seekJob;