Bug 1242343 - p2. Blacklist msmpeg2vdec.dll 12.0.9200.16426 & .17037 - r=cpearce draft
authorGerald Squelart <gsquelart@mozilla.com>
Wed, 02 Mar 2016 16:22:02 +1100
changeset 336051 d3e737d1143c58737e1dda284c4a33e2397fd777
parent 336050 9e330da9a70eea470b986c2751e3d80f6810d90f
child 515283 ab16cb8caf1c3f1e92c34029a1aaa69ccf6edbae
push id11951
push usergsquelart@mozilla.com
push dateWed, 02 Mar 2016 05:22:20 +0000
reviewerscpearce
bugs1242343, 16426, 17037
milestone47.0a1
Bug 1242343 - p2. Blacklist msmpeg2vdec.dll 12.0.9200.16426 & .17037 - r=cpearce MozReview-Commit-ID: C6osQ3ubhH1
dom/media/platforms/wmf/WMFDecoderModule.cpp
--- a/dom/media/platforms/wmf/WMFDecoderModule.cpp
+++ b/dom/media/platforms/wmf/WMFDecoderModule.cpp
@@ -12,16 +12,17 @@
 #include "mozilla/Preferences.h"
 #include "mozilla/DebugOnly.h"
 #include "mozilla/Services.h"
 #include "WMFMediaDataDecoder.h"
 #include "nsIWindowsRegKey.h"
 #include "nsComponentManagerUtils.h"
 #include "nsServiceManagerUtils.h"
 #include "nsIGfxInfo.h"
+#include "nsWindowsHelpers.h"
 #include "GfxDriverInfo.h"
 #include "gfxWindowsPlatform.h"
 #include "MediaInfo.h"
 #include "prsystem.h"
 #include "mozilla/Maybe.h"
 #include "mozilla/StaticMutex.h"
 
 namespace mozilla {
@@ -158,19 +159,55 @@ CanCreateWMFDecoder()
   StaticMutexAutoLock lock(sMutex);
   static Maybe<bool> result;
   if (result.isNothing()) {
     result.emplace(CanCreateMFTDecoder(aGuid));
   }
   return result.value();
 }
 
+static bool
+IsH264DecoderBlacklisted()
+{
+#ifdef _WIN64
+  WCHAR systemPath[MAX_PATH + 1];
+  if (!ConstructSystem32Path(L"msmpeg2vdec.dll", systemPath, MAX_PATH + 1)) {
+    // Cannot build path -> Assume it's not the blacklisted DLL.
+    return false;
+  }
+
+  DWORD zero;
+  DWORD infoSize = GetFileVersionInfoSizeW(systemPath, &zero);
+  if (infoSize == 0) {
+    // Can't get file info -> Assume we don't have the blacklisted DLL.
+    return false;
+  }
+  auto infoData = MakeUnique<unsigned char[]>(infoSize);
+  VS_FIXEDFILEINFO *vInfo;
+  UINT vInfoLen;
+  if (GetFileVersionInfoW(systemPath, 0, infoSize, infoData.get()) &&
+    VerQueryValueW(infoData.get(), L"\\", (LPVOID*)&vInfo, &vInfoLen))
+  {
+    if ((vInfo->dwFileVersionMS == ((12u << 16) | 0u))
+        && ((vInfo->dwFileVersionLS == ((9200u << 16) | 16426u))
+            || (vInfo->dwFileVersionLS == ((9200u << 16) | 17037u)))) {
+      // 12.0.9200.16426 & .17037 are blacklisted on Win64, see bug 1242343.
+      return true;
+    }
+  }
+#endif // _WIN64
+  return false;
+}
+
 /* static */ bool
 WMFDecoderModule::HasH264()
 {
+  if (IsH264DecoderBlacklisted()) {
+    return false;
+  }
   return CanCreateWMFDecoder<CLSID_CMSH264DecoderMFT>();
 }
 
 /* static */ bool
 WMFDecoderModule::HasAAC()
 {
   return CanCreateWMFDecoder<CLSID_CMSAACDecMFT>();
 }