Bug 1329891. Part 1 - default Handle{Audio,Video}Canceled() to crash. r=kikuo

1. States (DecodeMetadataState and WaitForCDMState) happen before
DecodingFirstFrameState should never receive this event because they don't
decode at all.
2. DormantState and ShutdownState shouldn't receive this event because
they call ResetDecode() in the entry action.
3. CompletedState should never receive this event because it happens after
HandleEndOf{Audio,Video} which happens before Handle{Audio,Video}Canceled.

MozReview-Commit-ID: LdwpWlFHtRp

--HG--
extra : rebase_source : d48b8c7b2347fa745de006fcd1aff640cb474aa1
extra : intermediate-source : 981305f87ff796060666227cf89a23b51e607b54
extra : source : ee5e78f761568bea438c51b9e70eef9b83e14626
This commit is contained in:
JW Wang 2017-01-09 15:44:18 +08:00
Родитель 37441c2712
Коммит 982fb8390e
1 изменённых файлов: 30 добавлений и 2 удалений

Просмотреть файл

@ -206,7 +206,7 @@ public:
virtual void HandleAudioCanceled()
{
mMaster->EnsureAudioDecodeTaskQueued();
Crash("Unexpected event!", __func__);
}
virtual void HandleEndOfAudio()
@ -221,7 +221,7 @@ public:
virtual void HandleVideoCanceled()
{
mMaster->EnsureVideoDecodeTaskQueued();
Crash("Unexpected event!", __func__);
}
virtual void HandleEndOfVideo()
@ -245,6 +245,14 @@ private:
template <class S, typename R, typename... As>
auto ReturnTypeHelper(R(S::*)(As...)) -> R;
void Crash(const char* aReason, const char* aSite)
{
char buf[1024];
SprintfLiteral(buf, "%s state=%s callsite=%s", aReason, ToStateStr(GetState()), aSite);
MOZ_ReportAssertionFailure(buf, __FILE__, __LINE__);
MOZ_CRASH();
}
protected:
enum class EventVisibility : int8_t
{
@ -659,6 +667,16 @@ public:
CheckSlowDecoding(aDecodeStart);
}
void HandleAudioCanceled() override
{
mMaster->EnsureAudioDecodeTaskQueued();
}
void HandleVideoCanceled() override
{
mMaster->EnsureVideoDecodeTaskQueued();
}
void HandleEndOfAudio() override;
void HandleEndOfVideo() override;
@ -1644,6 +1662,16 @@ public:
mMaster->ScheduleStateMachine();
}
void HandleAudioCanceled() override
{
mMaster->EnsureAudioDecodeTaskQueued();
}
void HandleVideoCanceled() override
{
mMaster->EnsureVideoDecodeTaskQueued();
}
void HandleEndOfAudio() override;
void HandleEndOfVideo() override;