Bug 1409649 - shut down the decoder when MEDIA_ERR_ABORTED is received. r=gerald
authorJW Wang <jwwang@mozilla.com>
Wed, 18 Oct 2017 16:08:33 +0800
changeset 683861 6a815fb0b667075041404ebd0b1ee7b87f46e3a2
parent 683860 f0832773e45106bccf83d35fec16066670e5823a
child 683862 58190ad9f36d303669e45fd91b6793ae1dea9a01
push id85474
push userbmo:emilio@crisal.io
push dateFri, 20 Oct 2017 10:02:12 +0000
reviewersgerald
bugs1409649
milestone58.0a1
Bug 1409649 - shut down the decoder when MEDIA_ERR_ABORTED is received. r=gerald http://searchfox.org/mozilla-central/rev/dca019c94bf3a840ed7ff50261483410cfece24f/dom/html/HTMLMediaElement.cpp#1395-1400 We need to shut down the decoder after setting network state to EMPTY. Otherwise the decoder will keep loading and change ready state to HAVE_METADATA or greater and then fail the assertion in AssertReadyStateIsNothing(). MozReview-Commit-ID: FpMDVAJHTS5
dom/html/HTMLMediaElement.cpp
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -1394,16 +1394,19 @@ public:
       mOwner->DispatchAsyncEvent(NS_LITERAL_STRING("error"));
       if (mOwner->ReadyState() == HAVE_NOTHING &&
           aErrorCode == MEDIA_ERR_ABORTED) {
         // https://html.spec.whatwg.org/multipage/embedded-content.html#media-data-processing-steps-list
         // "If the media data fetching process is aborted by the user"
         mOwner->DispatchAsyncEvent(NS_LITERAL_STRING("abort"));
         mOwner->ChangeNetworkState(nsIDOMHTMLMediaElement::NETWORK_EMPTY);
         mOwner->DispatchAsyncEvent(NS_LITERAL_STRING("emptied"));
+        if (mOwner->mDecoder) {
+          mOwner->ShutdownDecoder();
+        }
       } else if (aErrorCode == MEDIA_ERR_SRC_NOT_SUPPORTED) {
         mOwner->ChangeNetworkState(nsIDOMHTMLMediaElement::NETWORK_NO_SOURCE);
       } else {
         mOwner->ChangeNetworkState(nsIDOMHTMLMediaElement::NETWORK_IDLE);
       }
     }
   }