Bug 1383541 - Allow 4096x2304 H264 on win7 with recent decoder - r?jya
MozReview-Commit-ID: HD1AcxbGChX
--- 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;
}