Bug 1088481 - stop progress timer in MediaDecoder::Shutdown if necessary. r=cpearce
authorJW Wang <jwwang@mozilla.com>
Mon, 27 Oct 2014 02:47:00 +0100
changeset 212928 b51eff4a2ec02df4c4f48d678ad4225e8769ab74
parent 212927 af957b6bf4213d64d882cf42dc441c395e3b0aa6
child 212929 1128da4be7b3ca18a40baa305f6079b66b27c341
push id27736
push userryanvm@gmail.com
push dateWed, 29 Oct 2014 20:49:13 +0000
treeherdermozilla-central@80e18ff7c7b2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscpearce
bugs1088481
milestone36.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1088481 - stop progress timer in MediaDecoder::Shutdown if necessary. r=cpearce
dom/html/HTMLMediaElement.cpp
dom/media/MediaDecoder.cpp
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -601,21 +601,16 @@ HTMLMediaElement::OnChannelRedirect(nsIC
 
   return NS_OK;
 }
 
 void HTMLMediaElement::ShutdownDecoder()
 {
   RemoveMediaElementFromURITable();
   NS_ASSERTION(mDecoder, "Must have decoder to shut down");
-  // TODO: This should be handled by ChangeNetworkState() so we have only one
-  // place to call StopProgress().
-  if (mNetworkState == nsIDOMHTMLMediaElement::NETWORK_LOADING) {
-    mDecoder->StopProgress();
-  }
   mDecoder->Shutdown();
   mDecoder = nullptr;
 }
 
 void HTMLMediaElement::AbortExistingLoads()
 {
   // Abort any already-running instance of the resource selection algorithm.
   mLoadWaitStatus = NOT_WAITING;
@@ -4034,17 +4029,17 @@ HTMLMediaElement::SetMediaKeys(mozilla::
     promise->MaybeReject(NS_ERROR_DOM_QUOTA_EXCEEDED_ERR);
     return promise.forget();
   }
   if (mMediaKeys) {
     // Existing MediaKeys object. Shut it down.
     mMediaKeys->Shutdown();
     mMediaKeys = nullptr;
   }
-  
+
   mMediaKeys = aMediaKeys;
   if (mMediaKeys) {
     if (NS_FAILED(mMediaKeys->Bind(this))) {
       promise->MaybeReject(NS_ERROR_DOM_INVALID_STATE_ERR);
       mMediaKeys = nullptr;
       return promise.forget();
     }
     if (mDecoder) {
--- a/dom/media/MediaDecoder.cpp
+++ b/dom/media/MediaDecoder.cpp
@@ -494,18 +494,19 @@ void MediaDecoder::Shutdown()
   // Force any outstanding seek and byterange requests to complete
   // to prevent shutdown from deadlocking.
   if (mResource) {
     mResource->Close();
   }
 
   ChangeState(PLAY_STATE_SHUTDOWN);
 
-  // If we hit this assertion, there might be a bug in network state transition.
-  NS_ASSERTION(!mProgressTimer, "Progress timer should've been stopped.");
+  if (mProgressTimer) {
+    StopProgress();
+  }
   mOwner = nullptr;
 
   MediaShutdownManager::Instance().Unregister(this);
 }
 
 MediaDecoder::~MediaDecoder()
 {
   MOZ_ASSERT(NS_IsMainThread());