Bug 1176218 - Reject resolutions that are too big for Windows - r?jya draft
authorGerald Squelart <gsquelart@mozilla.com>
Thu, 29 Sep 2016 15:13:55 +1000
changeset 419930 517ad67a1a877163d89083c7813507b1f825e749
parent 419929 09d2fdceac121d3b43d3b024ac75dd34006360be
child 532677 1aa2fa821318deb1b0eb58499831fcd60a865527
push id31042
push usergsquelart@mozilla.com
push dateSun, 02 Oct 2016 05:32:25 +0000
reviewersjya
bugs1176218
milestone52.0a1
Bug 1176218 - Reject resolutions that are too big for Windows - r?jya MozReview-Commit-ID: E0jvpgKzsQM
dom/media/fmp4/MP4Decoder.cpp
--- 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;
     }
   }