Bug 1383541 - Allow 4096x2304 H264 on win7 with recent decoder - r=jya
authorGerald Squelart <gsquelart@mozilla.com>
Tue, 25 Jul 2017 16:59:24 +1200
changeset 422032 599f374f8da1b16c07be040c0589b45ed2eebb7b
parent 422031 d856479d5d9a6663b8cd0091a0c35ca023826da1
child 422033 7ae1f73aacdb276fdc0d370994ef9e570cb326b7
push id1517
push userjlorenzo@mozilla.com
push dateThu, 14 Sep 2017 16:50:54 +0000
treeherdermozilla-release@3b41fd564418 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjya
bugs1383541
milestone56.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 1383541 - Allow 4096x2304 H264 on win7 with recent decoder - r=jya MozReview-Commit-ID: HD1AcxbGChX
dom/media/platforms/wmf/WMFDecoderModule.cpp
--- a/dom/media/platforms/wmf/WMFDecoderModule.cpp
+++ b/dom/media/platforms/wmf/WMFDecoderModule.cpp
@@ -154,45 +154,44 @@ CanCreateWMFDecoder()
   static Maybe<bool> result;
   if (result.isNothing()) {
     result.emplace(CanCreateMFTDecoder(aGuid));
   }
   return result.value();
 }
 
 static bool
-IsH264DecoderBlacklisted()
+IsWin7H264Decoder4KCapable()
 {
-#ifdef BLACKLIST_CRASHY_H264_DECODERS
   WCHAR systemPath[MAX_PATH + 1];
   if (!ConstructSystem32Path(L"msmpeg2vdec.dll", systemPath, MAX_PATH + 1)) {
-    // Cannot build path -> Assume it's not the blacklisted DLL.
+    // Cannot build path -> Assume it's the old DLL or it's missing.
     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.
+    // Can't get file info -> Assume it's the old DLL or it's missing.
     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;
-    }
+    uint64_t version =
+      uint64_t(vInfo->dwFileVersionMS) << 32 | uint64_t(vInfo->dwFileVersionLS);
+    // 12.0.9200.16426 & later allow for >1920x1088 resolutions.
+    const uint64_t minimum =
+      (uint64_t(12) << 48) | (uint64_t(9200) << 16) | uint64_t(16426);
+    return version >= minimum;
   }
-#endif // BLACKLIST_CRASHY_H264_DECODERS
+  // Can't get file version -> Assume it's the old DLL.
   return false;
 }
 
 /* static */ bool
 WMFDecoderModule::HasH264()
 {
   return CanCreateWMFDecoder<CLSID_CMSH264DecoderMFT>();
 }
@@ -226,24 +225,25 @@ WMFDecoderModule::Supports(const TrackIn
   }
   if (MP4Decoder::IsH264(aTrackInfo.mMimeType)
       && WMFDecoderModule::HasH264()) {
     if (!MediaPrefs::PDMWMFAllowUnsupportedResolutions()) {
       const VideoInfo* videoInfo = aTrackInfo.GetAsVideoInfo();
       MOZ_ASSERT(videoInfo);
       // Check Windows format constraints, based on:
       // https://msdn.microsoft.com/en-us/library/windows/desktop/dd797815(v=vs.85).aspx
-      if (IsWin8OrLater()) {
-        // Windows >7 supports at most 4096x2304.
+      if (IsWin8OrLater() || IsWin7H264Decoder4KCapable()) {
+        // Windows >7, and Win7 with recent-enough decoder, support at most
+        // 4096x2304.
         if (videoInfo->mImage.width > 4096
             || videoInfo->mImage.height > 2304) {
           return false;
         }
       } else {
-        // Windows <=7 supports at most 1920x1088.
+        // Windows <=7 (with original decoder) supports at most 1920x1088.
         if (videoInfo->mImage.width > 1920
             || videoInfo->mImage.height > 1088) {
           return false;
         }
       }
     }
     return true;
   }