Bug 1322087. Part 2 - move readyState to HAVE_ENOUGH_DATA when we have no more data to fetch. r=cpearce
http://searchfox.org/mozilla-central/rev/dc8cf05768b83a6ef0b4039edd6efddd56ee4109/dom/media/MediaDecoderStateMachine.cpp#1065 Changing nextFrameStatus to UNAVAILABLE might change readyState to HAVE_CURRENT_DATA and cause 'waiting' to fire. It doesn't make sense to fire 'waiting' at the end of playback. http://searchfox.org/mozilla-central/rev/dc8cf05768b83a6ef0b4039edd6efddd56ee4109/dom/html/HTMLMediaElement.cpp#5423 Note the check for Ended() doesn't work as expected to prevent 'waiting' from firing at the end of playback because of the way how TailDispatcher schedules stateChange tasks. This patch keeps readyState in HAVE_ENOUGH_DATA when playback is near the end for wanting no more data. readyState will change to HAVE_CURRENT_DATA when the playing state of MediaDecoder is changed to PLAY_STATE_ENDED. MozReview-Commit-ID: 6EspaD2hhx
This commit is contained in:
@@ -5329,6 +5329,12 @@ HTMLMediaElement::UpdateReadyStateInternal()
|
||||
return;
|
||||
}
|
||||
|
||||
if (nextFrameStatus == NEXT_FRAME_UNAVAILABLE_BUFFERING) {
|
||||
// Force HAVE_CURRENT_DATA when buffering.
|
||||
ChangeReadyState(nsIDOMHTMLMediaElement::HAVE_CURRENT_DATA);
|
||||
return;
|
||||
}
|
||||
|
||||
if (mDownloadSuspendedByCache && mDecoder && !mDecoder->IsEnded()) {
|
||||
// The decoder has signaled that the download has been suspended by the
|
||||
// media cache. So move readyState into HAVE_ENOUGH_DATA, in case there's
|
||||
@@ -5345,6 +5351,14 @@ 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));
|
||||
|
||||
Reference in New Issue
Block a user