Bug 1324371. Part 4 - assert NeedMoreVideo() in some functions. r?kaku
Because !mSeekJob.mPromise.IsEmpty() now always implies NeedMoreVideo().
MozReview-Commit-ID: BN0NZzaBlCF
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -1330,32 +1330,32 @@ private:
{
mMaster->Push(aAudio);
}
void HandleVideoDecoded(MediaData* aVideo, TimeStamp aDecodeStart) override
{
MOZ_ASSERT(aVideo);
MOZ_ASSERT(!mSeekJob.mPromise.IsEmpty(), "Seek shouldn't be finished");
+ MOZ_ASSERT(NeedMoreVideo());
if (aVideo->mTime > mCurrentTime) {
mMaster->Push(aVideo);
- }
-
- if (NeedMoreVideo()) {
+ } else {
RequestVideoData();
return;
}
MaybeFinishSeek();
}
void HandleNotDecoded(MediaData::Type aType, const MediaResult& aError) override
{
MOZ_ASSERT(!mSeekJob.mPromise.IsEmpty(), "Seek shouldn't be finished");
+ MOZ_ASSERT(NeedMoreVideo());
switch (aType) {
case MediaData::AUDIO_DATA:
{
// We don't care about audio decode errors in this state which will be
// handled by other states after seeking.
break;
}
@@ -1396,42 +1396,35 @@ private:
void HandleAudioWaited(MediaData::Type aType) override
{
// We don't care about audio in this state.
}
void HandleVideoWaited(MediaData::Type aType) override
{
MOZ_ASSERT(!mSeekJob.mPromise.IsEmpty(), "Seek shouldn't be finished");
-
- if (NeedMoreVideo()) {
- RequestVideoData();
- return;
- }
- MaybeFinishSeek();
+ MOZ_ASSERT(NeedMoreVideo());
+ 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:
{
- if (NeedMoreVideo()) {
- // Error out if we can't finish video seeking.
- mMaster->DecodeError(NS_ERROR_DOM_MEDIA_CANCELED);
- return;
- }
- MaybeFinishSeek();
+ // 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