Bug 1244292 - [1.2] Release decoder on init failure. r=snorp
authorEugen Sawin <esawin@mozilla.com>
Tue, 09 Feb 2016 19:50:30 +0100
changeset 283777 9b3787b43a59fbad503822548736b8de75df78e4
parent 283776 66b3222f623ffeb63aa20f30a89d25cc4bc8fbdb
child 283778 d42cc18ad1bd0f4ba94599698cebd8a55f900071
push id71679
push useresawin@mozilla.com
push dateWed, 10 Feb 2016 14:08:08 +0000
treeherdermozilla-inbound@9b3787b43a59 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssnorp
bugs1244292
milestone47.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 1244292 - [1.2] Release decoder on init failure. r=snorp
dom/media/platforms/android/AndroidDecoderModule.cpp
--- a/dom/media/platforms/android/AndroidDecoderModule.cpp
+++ b/dom/media/platforms/android/AndroidDecoderModule.cpp
@@ -735,30 +735,35 @@ MediaCodecDataDecoder::Drain()
 }
 
 
 nsresult
 MediaCodecDataDecoder::Shutdown()
 {
   MonitorAutoLock lock(mMonitor);
 
-  if (!mThread || State() == kStopping) {
+  if (State() == kStopping) {
     // Already shutdown or in the process of doing so
     return NS_OK;
   }
 
   State(kStopping);
   lock.Notify();
 
-  while (State() == kStopping) {
+  while (mThread && State() == kStopping) {
     lock.Wait();
   }
 
-  mThread->Shutdown();
-  mThread = nullptr;
+  if (mThread) {
+    mThread->Shutdown();
+    mThread = nullptr;
+  }
 
-  mDecoder->Stop();
-  mDecoder->Release();
+  if (mDecoder) {
+    mDecoder->Stop();
+    mDecoder->Release();
+    mDecoder = nullptr;
+  }
 
   return NS_OK;
 }
 
 } // mozilla