Bug 1416799 - Fix crash when seek fails. r=cpearce

This commit is contained in:
JW Wang 2017-11-14 16:12:58 +08:00
Родитель d004fe115e
Коммит a2551c1319
1 изменённых файлов: 28 добавлений и 13 удалений

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

@ -986,9 +986,7 @@ public:
void HandleEndOfAudio() override
{
MOZ_ASSERT(!mDoneAudioSeeking);
AudioQueue().Finish();
mDoneAudioSeeking = true;
HandleEndOfAudioInternal();
MaybeFinishSeek();
}
@ -1006,14 +1004,7 @@ public:
void HandleEndOfVideo() override
{
MOZ_ASSERT(!mDoneVideoSeeking);
if (mFirstVideoFrameAfterSeek) {
// Hit the end of stream. Move mFirstVideoFrameAfterSeek into
// mSeekedVideoData so we have something to display after seeking.
mMaster->PushVideo(mFirstVideoFrameAfterSeek);
}
VideoQueue().Finish();
mDoneVideoSeeking = true;
HandleEndOfVideoInternal();
MaybeFinishSeek();
}
@ -1143,8 +1134,13 @@ protected:
}
if (aReject.mError == NS_ERROR_DOM_MEDIA_END_OF_STREAM) {
HandleEndOfAudio();
HandleEndOfVideo();
if (!mDoneAudioSeeking) {
HandleEndOfAudioInternal();
}
if (!mDoneVideoSeeking) {
HandleEndOfVideoInternal();
}
MaybeFinishSeek();
return;
}
@ -1296,6 +1292,25 @@ protected:
return NS_OK;
}
void HandleEndOfAudioInternal()
{
MOZ_ASSERT(!mDoneAudioSeeking);
AudioQueue().Finish();
mDoneAudioSeeking = true;
}
void HandleEndOfVideoInternal()
{
MOZ_ASSERT(!mDoneVideoSeeking);
if (mFirstVideoFrameAfterSeek) {
// Hit the end of stream. Move mFirstVideoFrameAfterSeek into
// mSeekedVideoData so we have something to display after seeking.
mMaster->PushVideo(mFirstVideoFrameAfterSeek);
}
VideoQueue().Finish();
mDoneVideoSeeking = true;
}
void MaybeFinishSeek()
{
if (mDoneAudioSeeking && mDoneVideoSeeking) {