Bug 1176218 - Reject resolutions that are too big for Windows - r?jya
MozReview-Commit-ID: E0jvpgKzsQM
--- a/dom/media/fmp4/MP4Decoder.cpp
+++ b/dom/media/fmp4/MP4Decoder.cpp
@@ -135,16 +135,32 @@ MP4Decoder::CanHandleMediaType(const Med
codecMimes.AppendElement(NS_LITERAL_CSTRING("video/avc"));
continue;
}
// Some unsupported codec.
return false;
}
}
+#ifdef XP_WIN
+ // 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 (aType.GetWidth() > 4096 || aType.GetHeight() > 2304) {
+ return false;
+ }
+ } else {
+ // Windows <=7 supports at most 1920x1088.
+ if (aType.GetWidth() > 1920 || aType.GetHeight() > 1088) {
+ return false;
+ }
+ }
+#endif // XP_WIN
+
// Verify that we have a PDM that supports the whitelisted types.
RefPtr<PDMFactory> platform = new PDMFactory();
for (const nsCString& codecMime : codecMimes) {
if (!platform->SupportsMimeType(codecMime, aDiagnostics)) {
return false;
}
}