Bug 1244292 - [1.2] Release decoder on init failure. r=snorp
--- 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