Bug 1319992: P5. Don't attempt to estimate readyState when ended. r?jwwang draft
authorJean-Yves Avenard <jyavenard@mozilla.com>
Wed, 14 Dec 2016 17:35:36 +1100
changeset 450149 d8e6bf15eab77b285db253add184e81af8055564
parent 450148 180bdc2b76d3b967ae6dc9b57a287a5f16edb968
child 539671 6d10d0fc61efed847fc6e598d5d3726a2eb431ab
push id38763
push userbmo:jyavenard@mozilla.com
push dateFri, 16 Dec 2016 02:12:02 +0000
reviewersjwwang
bugs1319992
milestone53.0a1
Bug 1319992: P5. Don't attempt to estimate readyState when ended. r?jwwang Buffered range is now calculated asynchronously. It may not be up to date by the time the MDSM has entered ended mode. There's no point estimating readyState in ended mode anyway: we know what it is... MozReview-Commit-ID: ErGsAwBzeXI
dom/html/HTMLMediaElement.cpp
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -5469,17 +5469,17 @@ HTMLMediaElement::UpdateReadyStateIntern
       }
       // 5. Set the readyState of media element to HAVE_METADATA.
       // NOTE: We'll change to HAVE_CURRENT_DATA or HAVE_METADATA
       // depending on whether we've loaded the first frame or not
       // below.
       // 6. Suspend playback.
       // Note: Playback will already be stalled, as the next frame is
       // unavailable.
-    } else if (mDecoder) {
+    } else if (mDecoder && !mDecoder->IsEnded()) {
       nextFrameStatus = mDecoder->NextFrameBufferedStatus();
     }
   }
 
   if (nextFrameStatus == MediaDecoderOwner::NEXT_FRAME_UNAVAILABLE_SEEKING) {
     LOG(LogLevel::Debug, ("MediaElement %p UpdateReadyStateInternal() "
                           "NEXT_FRAME_UNAVAILABLE_SEEKING; Forcing HAVE_METADATA", this));
     ChangeReadyState(nsIDOMHTMLMediaElement::HAVE_METADATA);