Bug 1329891. Part 4 - remove StateObject::HandleNotWaited(). r=kikuo

If the wait promise is rejected, we probably won't be able to finish
decoding after seeking. So we should just raise an error immediately.

MozReview-Commit-ID: GKXo9ZooBfV

--HG--
extra : rebase_source : 257a2724d1d2f3266e17b2de3f7d80fa385a2782
extra : intermediate-source : 150ce8e05dc887b7ed2b71cdc5ab77fb117775d2
extra : source : 6ff0dea0afabd57ea53ea3571020cdea3d4b0eca
This commit is contained in:
JW Wang 2017-01-09 19:34:12 +08:00
parent c5599e5087
commit fedda3a0b4

View File

@ -208,7 +208,6 @@ public:
{
Crash("Unexpected event!", __func__);
}
virtual void HandleNotWaited(const WaitForDataRejectValue& aRejection);
virtual void HandleAudioCaptured() {}
virtual void HandleWaitingForAudio()
@ -924,7 +923,6 @@ public:
void HandleVideoDecoded(MediaData* aVideo, TimeStamp aDecodeStart) override = 0;
void HandleAudioWaited(MediaData::Type aType) override = 0;
void HandleVideoWaited(MediaData::Type aType) override = 0;
void HandleNotWaited(const WaitForDataRejectValue& aRejection) override = 0;
void HandleVideoSuspendTimeout() override
{
@ -1104,11 +1102,6 @@ public:
RequestVideoData();
}
void HandleNotWaited(const WaitForDataRejectValue& aRejection) override
{
MOZ_ASSERT(!mDoneAudioSeeking || !mDoneVideoSeeking, "Seek shouldn't be finished");
}
private:
void DemuxerSeek()
{
@ -1555,28 +1548,6 @@ private:
RequestVideoData();
}
void HandleNotWaited(const WaitForDataRejectValue& aRejection) override
{
MOZ_ASSERT(!mSeekJob.mPromise.IsEmpty(), "Seek shouldn't be finished");
MOZ_ASSERT(NeedMoreVideo());
switch(aRejection.mType) {
case MediaData::AUDIO_DATA:
{
// We don't care about audio in this state.
break;
}
case MediaData::VIDEO_DATA:
{
// Error out if we can't finish video seeking.
mMaster->DecodeError(NS_ERROR_DOM_MEDIA_CANCELED);
break;
}
default:
MOZ_ASSERT_UNREACHABLE("We cannot handle RAW_DATA or NULL_DATA here.");
}
}
int64_t CalculateNewCurrentTime() const override
{
// The HTMLMediaElement.currentTime should be updated to the seek target
@ -1878,13 +1849,6 @@ public:
}
};
void
MediaDecoderStateMachine::
StateObject::HandleNotWaited(const WaitForDataRejectValue& aRejection)
{
}
RefPtr<MediaDecoder::SeekPromise>
MediaDecoderStateMachine::
StateObject::HandleSeek(SeekTarget aTarget)
@ -3168,7 +3132,7 @@ MediaDecoderStateMachine::WaitForData(MediaData::Type aType)
},
[this] (const WaitForDataRejectValue& aRejection) {
mAudioWaitRequest.Complete();
mStateObj->HandleNotWaited(aRejection);
DecodeError(NS_ERROR_DOM_MEDIA_WAITING_FOR_DATA);
})
);
} else {
@ -3182,7 +3146,7 @@ MediaDecoderStateMachine::WaitForData(MediaData::Type aType)
},
[this] (const WaitForDataRejectValue& aRejection) {
mVideoWaitRequest.Complete();
mStateObj->HandleNotWaited(aRejection);
DecodeError(NS_ERROR_DOM_MEDIA_WAITING_FOR_DATA);
})
);
}