Bug 1349253 - modify the assertion; r?jwwang draft
authorKaku Kuo <kaku@mozilla.com>
Wed, 07 Jun 2017 18:52:36 +0800
changeset 590815 24ea77474e419f58fa6d432a3dabf6ff0b33bda1
parent 589301 2c6289f56812c30254acfdddabcfec1e149c0336
child 632311 68c75e502993b476cd9145bd82dda638e6f958f0
push id62834
push userbmo:kaku@mozilla.com
push dateThu, 08 Jun 2017 04:02:08 +0000
reviewersjwwang
bugs1349253
milestone55.0a1
Bug 1349253 - modify the assertion; r?jwwang While MDSM calls MFR::Seek(), MFR tries to do video seek first and then the audio seek. Video-seek and audio-seek are applied sequentially, and if something wrong in video-seek, MFR discards the whole seek operation without applying audio-seek. video | audio | waiting | waiting | What MDSM receives ----------------------------------------------------------------------------- X | X | resove mSeekRequest ----------------------------------------------------------------------------- O | X | reject mSeekRequest with type=VIDEO, error=WAITING ----------------------------------------------------------------------------- X | O | reject mSeekRequest with type=AUDIO, error=WAITING ----------------------------------------------------------------------------- O | O | reject mSeekRequest with type=VIDEO, error=WAITING ----------------------------------------------------------------------------- So, here, AccurateSeekingState::OnSeekRejected() has a unified code to handle WAITING_FOR_DATA error for both video and audio type, and it uses the aReject.mType variable to distinguish different types. But, it mixes the assertions. We should also apply assertions according to the type that is in concern. MozReview-Commit-ID: F7RpnFghcKk
dom/media/MediaDecoderStateMachine.cpp
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -1282,20 +1282,21 @@ private:
   }
 
   void OnSeekRejected(const SeekRejectValue& aReject)
   {
     mSeekRequest.Complete();
 
     if (aReject.mError == NS_ERROR_DOM_MEDIA_WAITING_FOR_DATA) {
       SLOG("OnSeekRejected reason=WAITING_FOR_DATA type=%d", aReject.mType);
-      MOZ_ASSERT(!mMaster->IsRequestingAudioData());
-      MOZ_ASSERT(!mMaster->IsRequestingVideoData());
-      MOZ_ASSERT(!mMaster->IsWaitingAudioData());
-      MOZ_ASSERT(!mMaster->IsWaitingVideoData());
+      MOZ_ASSERT_IF(aReject.mType == MediaData::AUDIO_DATA, !mMaster->IsRequestingAudioData());
+      MOZ_ASSERT_IF(aReject.mType == MediaData::VIDEO_DATA, !mMaster->IsRequestingVideoData());
+      MOZ_ASSERT_IF(aReject.mType == MediaData::AUDIO_DATA, !mMaster->IsWaitingAudioData());
+      MOZ_ASSERT_IF(aReject.mType == MediaData::VIDEO_DATA, !mMaster->IsWaitingVideoData());
+
       // Fire 'waiting' to notify the player that we are waiting for data.
       mMaster->UpdateNextFrameStatus(
         MediaDecoderOwner::NEXT_FRAME_UNAVAILABLE_SEEKING);
       Reader()
         ->WaitForData(aReject.mType)
         ->Then(OwnerThread(), __func__,
                [this](MediaData::Type aType) {
                  SLOG("OnSeekRejected wait promise resolved");