Bug 1273310 - Simplify DecoderDoctor failure flags. r=gerald draft
authorRalph Giles <giles@mozilla.com>
Mon, 16 May 2016 15:53:17 -0700
changeset 367616 05689bc2d1928d9dc17fe6a8a32318d716f08f7a
parent 367573 a884b96685aa13b65601feddb24e5f85ba861561
child 521057 3197919424afef36cfae73d94343f1b4c972e541
push id18291
push userbmo:giles@thaumas.net
push dateTue, 17 May 2016 00:31:27 +0000
reviewersgerald
bugs1273310
milestone49.0a1
Bug 1273310 - Simplify DecoderDoctor failure flags. r=gerald This is a bit easier to read. Currently there's no difference since Startup is only called once, but it's probably better future-proofing too, since the diagnostics should care more about the current state than whether there's every been a failure. Likewise reset the flags if the decoder is turned off by a preference change. MozReview-Commit-ID: 4zD7rkD6A3J
dom/media/platforms/PDMFactory.cpp
--- a/dom/media/platforms/PDMFactory.cpp
+++ b/dom/media/platforms/PDMFactory.cpp
@@ -250,33 +250,33 @@ PDMFactory::CreatePDMs()
      MediaPrefs::PDMAndroidMediaCodecEnabled()) {
     m = new AndroidDecoderModule();
     StartupPDM(m);
   }
 #endif
 #ifdef XP_WIN
   if (MediaPrefs::PDMWMFEnabled()) {
     m = new WMFDecoderModule();
-    if (!StartupPDM(m)) {
-      mWMFFailedToLoad = true;
-    }
+    mWMFFailedToLoad = !StartupPDM(m);
+  } else {
+    mWMFFailedToLoad = false;
   }
 #endif
 #ifdef MOZ_FFVPX
   if (MediaPrefs::PDMFFVPXEnabled()) {
     m = FFVPXRuntimeLinker::CreateDecoderModule();
     StartupPDM(m);
   }
 #endif
 #ifdef MOZ_FFMPEG
   if (MediaPrefs::PDMFFmpegEnabled()) {
     m = FFmpegRuntimeLinker::CreateDecoderModule();
-    if (!StartupPDM(m)) {
-      mFFmpegFailedToLoad = true;
-    }
+    mFFmpegFailedToLoad = !StartupPDM(m);
+  } else {
+    mFFmpegFailedToLoad = false;
   }
 #endif
 #ifdef MOZ_APPLEMEDIA
   m = new AppleDecoderModule();
   StartupPDM(m);
 #endif
 #ifdef MOZ_GONK_MEDIACODEC
   if (MediaPrefs::PDMGonkDecoderEnabled()) {
@@ -291,19 +291,19 @@ PDMFactory::CreatePDMs()
   }
 #endif
 
   m = new AgnosticDecoderModule();
   StartupPDM(m);
 
   if (MediaPrefs::PDMGMPEnabled()) {
     m = new GMPDecoderModule();
-    if (!StartupPDM(m)) {
-      mGMPPDMFailedToStartup = true;
-    }
+    mGMPPDMFailedToStartup = !StartupPDM(m);
+  } else {
+    mGMPPDMFailedToStartup = false;
   }
 }
 
 bool
 PDMFactory::StartupPDM(PlatformDecoderModule* aPDM)
 {
   if (aPDM && NS_SUCCEEDED(aPDM->Startup())) {
     mCurrentPDMs.AppendElement(aPDM);