Bug 1390443. P1 - don't change nextFrameStatus when MDSM reaches the end of playback. r=cpearce

Instead, MediaDecoder::NextFrameStatus() checks IsEnded() and returns
NEXT_FRAME_UNAVAILABLE to ensure we have HAVE_CURRENT_DATA when playback
is ended on the main thread.

This will fix the timing issue (comment 0) which causes 'waiting' to fire.

MozReview-Commit-ID: 7O21x2q0lb8

--HG--
extra : rebase_source : bbd898edfb5f4a47a5062dd2bc916c911caf0c8e
extra : intermediate-source : 2b3e413db02a7aad00d13fdf274b346bccafc414
extra : source : 6f60fad11b65e75b456e128f8414fe2ea545455f
This commit is contained in:
JW Wang 2017-08-16 15:33:58 +08:00
Родитель 49dc0a16e9
Коммит 6ce3e3224c
3 изменённых файлов: 2 добавлений и 12 удалений

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

@ -5824,14 +5824,6 @@ HTMLMediaElement::UpdateReadyStateInternal()
return;
}
if (mDecoder && !mDecoder->IsEnded() &&
!mDecoder->GetResource()->IsExpectingMoreData()) {
LOG(LogLevel::Debug, ("MediaElement %p UpdateReadyStateInternal() "
"Decoder fetched all data for media resource", this));
ChangeReadyState(nsIDOMHTMLMediaElement::HAVE_ENOUGH_DATA);
return;
}
if (nextFrameStatus != MediaDecoderOwner::NEXT_FRAME_AVAILABLE) {
LOG(LogLevel::Debug, ("MediaElement %p UpdateReadyStateInternal() "
"Next frame not available", this));

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

@ -400,8 +400,9 @@ private:
virtual MediaDecoderOwner::NextFrameStatus NextFrameStatus()
{
return mNextFrameStatus;
return !IsEnded() ? mNextFrameStatus : MediaDecoderOwner::NEXT_FRAME_UNAVAILABLE;
}
virtual MediaDecoderOwner::NextFrameStatus NextFrameBufferedStatus();
// Returns a string describing the state of the media player internal

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

@ -2006,9 +2006,6 @@ public:
}
mMaster->UpdatePlaybackPosition(clockTime);
// Ensure readyState is updated before firing the 'ended' event.
mMaster->UpdateNextFrameStatus(MediaDecoderOwner::NEXT_FRAME_UNAVAILABLE);
mMaster->mOnPlaybackEvent.Notify(MediaEventType::PlaybackEnded);
mSentPlaybackEndedEvent = true;