Bug 1330603. Part 1 - remove the call to CheckIfDecodeComplete() from HandleEndOf{Audio,Video}. draft
authorJW Wang <jwwang@mozilla.com>
Mon, 09 Jan 2017 22:35:54 +0800
changeset 459650 a08591de1ab5d230f4eee2ae25cb886ccab35499
parent 459494 38f1ee8f5349f7b546c5529d3511b8cc763c8907
child 459651 b31a25c7a236e99f6209383038357c8e6383335d
push id41284
push userjwwang@mozilla.com
push dateThu, 12 Jan 2017 11:07:37 +0000
bugs1330603
milestone53.0a1
Bug 1330603. Part 1 - remove the call to CheckIfDecodeComplete() from HandleEndOf{Audio,Video}. 1. in HandleEndOfAudio, we surely have !IsAudioDecoding(). So we only need to check !IsVideoDecoding(). 2. likewise, we only need to check !IsAudioDecoding() in HandleEndOfVideo(). MozReview-Commit-ID: A3pj1LC2okB
dom/media/MediaDecoderStateMachine.cpp
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -2120,29 +2120,29 @@ DecodingState::Enter()
   }
 }
 
 void
 MediaDecoderStateMachine::
 DecodingState::HandleEndOfAudio()
 {
   AudioQueue().Finish();
-  if (mMaster->CheckIfDecodeComplete()) {
+  if (!mMaster->IsVideoDecoding()) {
     SetState<CompletedState>();
   } else {
     MaybeStopPrerolling();
   }
 }
 
 void
 MediaDecoderStateMachine::
 DecodingState::HandleEndOfVideo()
 {
   VideoQueue().Finish();
-  if (mMaster->CheckIfDecodeComplete()) {
+  if (!mMaster->IsAudioDecoding()) {
     SetState<CompletedState>();
   } else {
     MaybeStopPrerolling();
   }
 }
 
 void
 MediaDecoderStateMachine::
@@ -2376,30 +2376,30 @@ BufferingState::Step()
   SetState<DecodingState>();
 }
 
 void
 MediaDecoderStateMachine::
 BufferingState::HandleEndOfAudio()
 {
   AudioQueue().Finish();
-  if (mMaster->CheckIfDecodeComplete()) {
+  if (!mMaster->IsVideoDecoding()) {
     SetState<CompletedState>();
   } else {
     // Check if we can exit buffering.
     mMaster->ScheduleStateMachine();
   }
 }
 
 void
 MediaDecoderStateMachine::
 BufferingState::HandleEndOfVideo()
 {
   VideoQueue().Finish();
-  if (mMaster->CheckIfDecodeComplete()) {
+  if (!mMaster->IsAudioDecoding()) {
     SetState<CompletedState>();
   } else {
     // Check if we can exit buffering.
     mMaster->ScheduleStateMachine();
   }
 }
 
 RefPtr<ShutdownPromise>