Bug 1399358 - call mDecoder->CanPlayThrough() so MDSM has a chance to exit buffering quickly.
MozReview-Commit-ID: A5e3A8HV2ih
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -5762,16 +5762,23 @@ HTMLMediaElement::UpdateReadyStateIntern
// We haven't yet loaded the first frame, making us unable to determine
// if we have enough valid data at the present stage.
return;
}
if (nextFrameStatus == NEXT_FRAME_UNAVAILABLE_BUFFERING) {
// Force HAVE_CURRENT_DATA when buffering.
ChangeReadyState(nsIDOMHTMLMediaElement::HAVE_CURRENT_DATA);
+ if (mDecoder) {
+ // The side effect of CanPlayThrough() will update mCanPlayThrough of
+ // MDSM so it has a chance to exit buffering quickly.
+ // TODO: This implicit coupling is bad. Refactoring should be done
+ // to remove the side effect of CanPlayThrough().
+ mDecoder->CanPlayThrough();
+ }
return;
}
// TextTracks must be loaded for the HAVE_ENOUGH_DATA and
// HAVE_FUTURE_DATA.
// So force HAVE_CURRENT_DATA if text tracks not loaded.
if (mTextTrackManager && !mTextTrackManager->IsLoaded()) {
ChangeReadyState(nsIDOMHTMLMediaElement::HAVE_CURRENT_DATA);