Bug 1329110. Part 2 - add HandleAudioCanceled(). r=kaku

MozReview-Commit-ID: IlzcucZOHpo

--HG--
extra : rebase_source : 7ee390235f6813117c7400bcbec13b376e7ef72a
extra : intermediate-source : 4ac81f01d3804c3e41b18ce3dcb5f19ab9cda69d
extra : source : 48a4f61f58bca7e48ac970494f0749417d8d5c4e
This commit is contained in:
JW Wang 2017-01-06 17:49:11 +08:00
Родитель 849a835855
Коммит 49a2f5c842
1 изменённых файлов: 32 добавлений и 3 удалений

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

@ -209,6 +209,11 @@ public:
HandleWaitingForData();
}
virtual void HandleAudioCanceled()
{
mMaster->EnsureAudioDecodeTaskQueued();
}
virtual RefPtr<MediaDecoder::SeekPromise> HandleSeek(SeekTarget aTarget);
virtual RefPtr<ShutdownPromise> HandleShutdown();
@ -509,6 +514,11 @@ public:
mMaster->WaitForData(MediaData::AUDIO_DATA);
}
void HandleAudioCanceled() override
{
mMaster->RequestAudioData();
}
void HandleAudioNotDecoded(const MediaResult& aError) override;
void HandleVideoNotDecoded(const MediaResult& aError) override;
@ -953,6 +963,14 @@ public:
}
}
void HandleAudioCanceled() override
{
if (!mSeekJob.mTarget->IsVideoOnly()) {
MOZ_ASSERT(!mDoneAudioSeeking);
RequestAudioData();
}
}
void HandleAudioNotDecoded(const MediaResult& aError) override;
void HandleVideoNotDecoded(const MediaResult& aError) override;
@ -1375,6 +1393,14 @@ private:
// handled by other states after seeking.
}
void HandleAudioCanceled() override
{
MOZ_ASSERT(!mSeekJob.mPromise.IsEmpty(), "Seek shouldn't be finished");
MOZ_ASSERT(NeedMoreVideo());
// We don't care about audio decode errors in this state which will be
// handled by other states after seeking.
}
void HandleAudioNotDecoded(const MediaResult& aError) override;
void HandleVideoNotDecoded(const MediaResult& aError) override;
@ -1725,7 +1751,7 @@ StateObject::HandleAudioNotDecoded(const MediaResult& aError)
MOZ_ASSERT(false);
break;
case NS_ERROR_DOM_MEDIA_CANCELED:
mMaster->EnsureAudioDecodeTaskQueued();
MOZ_ASSERT(false);
break;
case NS_ERROR_DOM_MEDIA_END_OF_STREAM:
AudioQueue().Finish();
@ -1962,7 +1988,7 @@ DecodingFirstFrameState::HandleAudioNotDecoded(const MediaResult& aError)
MOZ_ASSERT(false);
break;
case NS_ERROR_DOM_MEDIA_CANCELED:
mMaster->RequestAudioData();
MOZ_ASSERT(false);
break;
case NS_ERROR_DOM_MEDIA_END_OF_STREAM:
AudioQueue().Finish();
@ -2185,7 +2211,7 @@ AccurateSeekingState::HandleAudioNotDecoded(const MediaResult& aError)
MOZ_ASSERT(false);
break;
case NS_ERROR_DOM_MEDIA_CANCELED:
RequestAudioData();
MOZ_ASSERT(false);
break;
case NS_ERROR_DOM_MEDIA_END_OF_STREAM:
AudioQueue().Finish();
@ -3041,6 +3067,9 @@ MediaDecoderStateMachine::RequestAudioData()
case NS_ERROR_DOM_MEDIA_WAITING_FOR_DATA:
mStateObj->HandleWaitingForAudio();
break;
case NS_ERROR_DOM_MEDIA_CANCELED:
mStateObj->HandleAudioCanceled();
break;
default:
mStateObj->HandleAudioNotDecoded(aError);
}