Bug 848994 - p2. Detect when WMF is not found - r=cpearce
authorGerald Squelart <gsquelart@mozilla.com>
Fri, 22 Apr 2016 13:42:11 +1000
changeset 332307 cf1b1f91f522f42c5987a95b4960a7c13431373d
parent 332306 c2c86d1fa8a140e6fc182453bca2f18864d85541
child 332308 826d477a117b93d745f8dddb2ca3e1a3f2bc77eb
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscpearce
bugs848994
milestone48.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 848994 - p2. Detect when WMF is not found - r=cpearce MozReview-Commit-ID: IHvgJNjuyQA
dom/media/DecoderDoctorDiagnostics.cpp
dom/media/DecoderDoctorDiagnostics.h
dom/media/platforms/PDMFactory.cpp
dom/media/platforms/PDMFactory.h
--- a/dom/media/DecoderDoctorDiagnostics.cpp
+++ b/dom/media/DecoderDoctorDiagnostics.cpp
@@ -441,16 +441,19 @@ DecoderDoctorDiagnostics::StoreFormatDia
 nsCString
 DecoderDoctorDiagnostics::GetDescription() const
 {
   nsCString s;
   if (!mFormat.IsEmpty()) {
     s = "format='";
     s += NS_ConvertUTF16toUTF8(mFormat).get();
     s += mCanPlay ? "', can play" : "', cannot play";
+    if (mWMFFailedToLoad) {
+      s += ", Windows platform decoder failed to load";
+    }
     if (mFFmpegFailedToLoad) {
       s += ", Linux platform decoder failed to load";
     }
   } else {
     s = "?";
   }
   return s;
 }
--- a/dom/media/DecoderDoctorDiagnostics.h
+++ b/dom/media/DecoderDoctorDiagnostics.h
@@ -43,22 +43,26 @@ public:
   // Description string, for logging purposes.
   nsCString GetDescription() const;
 
   // Methods to record diagnostic information:
 
   const nsAString& Format() const { return mFormat; }
   bool CanPlay() const { return mCanPlay; }
 
+  void SetWMFFailedToLoad() { mWMFFailedToLoad = true; }
+  bool DidWMFFailToLoad() const { return mWMFFailedToLoad; }
+
   void SetFFmpegFailedToLoad() { mFFmpegFailedToLoad = true; }
   bool DidFFmpegFailToLoad() const { return mFFmpegFailedToLoad; }
 
 private:
   nsString mFormat;
   // True if there is at least one decoder that can play that format.
   bool mCanPlay = false;
 
+  bool mWMFFailedToLoad = false;
   bool mFFmpegFailedToLoad = false;
 };
 
 } // namespace mozilla
 
 #endif
--- a/dom/media/platforms/PDMFactory.cpp
+++ b/dom/media/platforms/PDMFactory.cpp
@@ -160,16 +160,19 @@ PDMFactory::CreateDecoder(const TrackInf
                                 aDiagnostics,
                                 aLayersBackend,
                                 aImageContainer);
   }
 
   if (aDiagnostics) {
     // If libraries failed to load, the following loop over mCurrentPDMs
     // will not even try to use them. So we record failures now.
+    if (mWMFFailedToLoad) {
+      aDiagnostics->SetWMFFailedToLoad();
+    }
     if (mFFmpegFailedToLoad) {
       aDiagnostics->SetFFmpegFailedToLoad();
     }
   }
 
   for (auto& current : mCurrentPDMs) {
     if (!current->SupportsMimeType(aConfig.mMimeType, aDiagnostics)) {
       continue;
@@ -285,17 +288,19 @@ PDMFactory::CreatePDMs()
   if(sAndroidMCDecoderPreferred && sAndroidMCDecoderEnabled) {
     m = new AndroidDecoderModule();
     StartupPDM(m);
   }
 #endif
 #ifdef XP_WIN
   if (sWMFDecoderEnabled) {
     m = new WMFDecoderModule();
-    StartupPDM(m);
+    if (!StartupPDM(m)) {
+      mWMFFailedToLoad = true;
+    }
   }
 #endif
 #ifdef MOZ_FFVPX
   if (sFFVPXDecoderEnabled) {
     m = FFVPXRuntimeLinker::CreateDecoderModule();
     StartupPDM(m);
   }
 #endif
@@ -345,16 +350,19 @@ PDMFactory::StartupPDM(PlatformDecoderMo
 
 already_AddRefed<PlatformDecoderModule>
 PDMFactory::GetDecoder(const nsACString& aMimeType,
                        DecoderDoctorDiagnostics* aDiagnostics) const
 {
   if (aDiagnostics) {
     // If libraries failed to load, the following loop over mCurrentPDMs
     // will not even try to use them. So we record failures now.
+    if (mWMFFailedToLoad) {
+      aDiagnostics->SetWMFFailedToLoad();
+    }
     if (mFFmpegFailedToLoad) {
       aDiagnostics->SetFFmpegFailedToLoad();
     }
   }
 
   RefPtr<PlatformDecoderModule> pdm;
   for (auto& current : mCurrentPDMs) {
     if (current->SupportsMimeType(aMimeType, aDiagnostics)) {
--- a/dom/media/platforms/PDMFactory.h
+++ b/dom/media/platforms/PDMFactory.h
@@ -90,14 +90,15 @@ private:
 #endif
   static bool sEnableFuzzingWrapper;
   static uint32_t sVideoOutputMinimumInterval_ms;
   static bool sDontDelayInputExhausted;
 
   nsTArray<RefPtr<PlatformDecoderModule>> mCurrentPDMs;
   RefPtr<PlatformDecoderModule> mEMEPDM;
 
+  bool mWMFFailedToLoad = false;
   bool mFFmpegFailedToLoad = false;
 };
 
 } // namespace mozilla
 
 #endif /* PDMFactory_h_ */