Bug 1329110. Part 7 - remove StateObject::HandleEndOfStream(). r=kaku

The same reason as P6. We would like to avoid virtual functions calls
inside a virtual function.

MozReview-Commit-ID: EYCk6tKPYSs

--HG--
extra : rebase_source : 8482799473e4cf856238b9fa7897e432b4e3a674
extra : source : 17769cff12ccc2157adc91c4fce7e4030f303b00
This commit is contained in:
JW Wang 2017-01-09 13:18:37 +08:00
Родитель ce97bad770
Коммит 063d3eaeb0
1 изменённых файлов: 33 добавлений и 7 удалений

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

@ -197,7 +197,6 @@ public:
virtual void HandleAudioWaited(MediaData::Type aType); virtual void HandleAudioWaited(MediaData::Type aType);
virtual void HandleVideoWaited(MediaData::Type aType); virtual void HandleVideoWaited(MediaData::Type aType);
virtual void HandleNotWaited(const WaitForDataRejectValue& aRejection); virtual void HandleNotWaited(const WaitForDataRejectValue& aRejection);
virtual void HandleEndOfStream() {}
virtual void HandleAudioCaptured() {} virtual void HandleAudioCaptured() {}
virtual void HandleWaitingForAudio() virtual void HandleWaitingForAudio()
@ -213,7 +212,6 @@ public:
virtual void HandleEndOfAudio() virtual void HandleEndOfAudio()
{ {
AudioQueue().Finish(); AudioQueue().Finish();
HandleEndOfStream();
} }
virtual void HandleWaitingForVideo() virtual void HandleWaitingForVideo()
@ -229,7 +227,6 @@ public:
virtual void HandleEndOfVideo() virtual void HandleEndOfVideo()
{ {
VideoQueue().Finish(); VideoQueue().Finish();
HandleEndOfStream();
} }
virtual RefPtr<MediaDecoder::SeekPromise> HandleSeek(SeekTarget aTarget); virtual RefPtr<MediaDecoder::SeekPromise> HandleSeek(SeekTarget aTarget);
@ -662,7 +659,8 @@ public:
CheckSlowDecoding(aDecodeStart); CheckSlowDecoding(aDecodeStart);
} }
void HandleEndOfStream() override; void HandleEndOfAudio() override;
void HandleEndOfVideo() override;
void HandleWaitingForAudio() override void HandleWaitingForAudio() override
{ {
@ -1646,7 +1644,8 @@ public:
mMaster->ScheduleStateMachine(); mMaster->ScheduleStateMachine();
} }
void HandleEndOfStream() override; void HandleEndOfAudio() override;
void HandleEndOfVideo() override;
void HandleVideoSuspendTimeout() override void HandleVideoSuspendTimeout() override
{ {
@ -2102,8 +2101,21 @@ DecodingState::Enter()
void void
MediaDecoderStateMachine:: MediaDecoderStateMachine::
DecodingState::HandleEndOfStream() DecodingState::HandleEndOfAudio()
{ {
AudioQueue().Finish();
if (mMaster->CheckIfDecodeComplete()) {
SetState<CompletedState>();
} else {
MaybeStopPrerolling();
}
}
void
MediaDecoderStateMachine::
DecodingState::HandleEndOfVideo()
{
VideoQueue().Finish();
if (mMaster->CheckIfDecodeComplete()) { if (mMaster->CheckIfDecodeComplete()) {
SetState<CompletedState>(); SetState<CompletedState>();
} else { } else {
@ -2274,8 +2286,22 @@ BufferingState::Step()
void void
MediaDecoderStateMachine:: MediaDecoderStateMachine::
BufferingState::HandleEndOfStream() BufferingState::HandleEndOfAudio()
{ {
AudioQueue().Finish();
if (mMaster->CheckIfDecodeComplete()) {
SetState<CompletedState>();
} else {
// Check if we can exit buffering.
mMaster->ScheduleStateMachine();
}
}
void
MediaDecoderStateMachine::
BufferingState::HandleEndOfVideo()
{
VideoQueue().Finish();
if (mMaster->CheckIfDecodeComplete()) { if (mMaster->CheckIfDecodeComplete()) {
SetState<CompletedState>(); SetState<CompletedState>();
} else { } else {