Bug 1334230 - media.wmf.allow-unsupported-resolutions=true should not disable H264. r=jya, a=lizzard
authorGerald Squelart <gsquelart@mozilla.com>
Fri, 27 Jan 2017 06:58:41 +1100
changeset 375718 13b5876f5d0ca6e12e65806530b230148c8cd54e
parent 375717 af6f4d39c3f061041425c840d021e8a2d70f12eb
child 375719 3caba858e4528c868f1e14dd0b652e842fdb4f01
push id6996
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 20:48:21 +0000
treeherdermozilla-beta@d89512dab048 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjya, lizzard
bugs1334230
milestone53.0a2
Bug 1334230 - media.wmf.allow-unsupported-resolutions=true should not disable H264. r=jya, a=lizzard Previously the combined tests meant that if a track was H264, and we supported H264, BUT media.wmf.allow-unsupported-resolutions==true, we would just skip the whole block, meaning we would return 'false' (unsupported) in the end. Instead, if a track is H264, and we support H264, we should return 'true' (supported), unless media.wmf.allow-unsupported-resolutions==false and the resolution is too high. MozReview-Commit-ID: 5YUhlxmfPIO
dom/media/platforms/wmf/WMFDecoderModule.cpp
--- a/dom/media/platforms/wmf/WMFDecoderModule.cpp
+++ b/dom/media/platforms/wmf/WMFDecoderModule.cpp
@@ -205,32 +205,32 @@ bool
 WMFDecoderModule::Supports(const TrackInfo& aTrackInfo,
                            DecoderDoctorDiagnostics* aDiagnostics) const
 {
   if ((aTrackInfo.mMimeType.EqualsLiteral("audio/mp4a-latm") ||
        aTrackInfo.mMimeType.EqualsLiteral("audio/mp4")) &&
        WMFDecoderModule::HasAAC()) {
     return true;
   }
-  if (MP4Decoder::IsH264(aTrackInfo.mMimeType) &&
-      WMFDecoderModule::HasH264() &&
-      !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 (videoInfo->mImage.width > 4096 || videoInfo->mImage.height > 2304) {
-        return false;
-      }
-    } else {
-      // Windows <=7 supports at most 1920x1088.
-      if (videoInfo->mImage.width > 1920 || videoInfo->mImage.height > 1088) {
-        return false;
+  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 (videoInfo->mImage.width > 4096 || videoInfo->mImage.height > 2304) {
+          return false;
+        }
+      } else {
+        // Windows <=7 supports at most 1920x1088.
+        if (videoInfo->mImage.width > 1920 || videoInfo->mImage.height > 1088) {
+          return false;
+        }
       }
     }
     return true;
   }
   if (aTrackInfo.mMimeType.EqualsLiteral("audio/mpeg") &&
       CanCreateWMFDecoder<CLSID_CMP3DecMediaObject>()) {
     return true;
   }