Reland: "Video: Integrade platform HEVC decoding for macOS"

Fix issues that causes encrypted media test failed

-----------------[ original description ]-----------------
Code already exists and fixes should have all landed for macOS,
this CL integrade HEVC clear content hw decoding support if macOS
version >= BigSur.

Disabled by default and needs to change the default
flag kPlatformHEVCDecoderSupport to true to enable the feature.

Bug: 1329017, 1300444
Change-Id: I5e71e048c12b6985f2ff8447d4c7b50708007360
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3665985
Commit-Queue: Dan Sanders <sandersd@chromium.org>
Reviewed-by: Dan Sanders <sandersd@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1007504}
diff --git a/chrome/browser/media/encrypted_media_supported_types_browsertest.cc b/chrome/browser/media/encrypted_media_supported_types_browsertest.cc
index f145f934..9ed9824 100644
--- a/chrome/browser/media/encrypted_media_supported_types_browsertest.cc
+++ b/chrome/browser/media/encrypted_media_supported_types_browsertest.cc
@@ -820,9 +820,11 @@
 
   // On Windows platforms, HEVC support is detected through the GPU capabilities
   // which won't indicate support when running the tests.
+  // On macOS platforms, HEVC only support clear content.
   // TODO(crbug/1327470): Fix this so that we can inject HEVC support on
   // Windows.
-#if BUILDFLAG(ENABLE_HEVC_PARSER_AND_HW_DECODER) && !BUILDFLAG(IS_WIN)
+#if BUILDFLAG(ENABLE_HEVC_PARSER_AND_HW_DECODER) && !BUILDFLAG(IS_WIN) && \
+    !BUILDFLAG(IS_MAC)
   EXPECT_ECK_PROPRIETARY(IsSupportedByKeySystem(
       kExternalClearKey, kVideoMP4MimeType, video_mp4_hevc_codecs()));
 #else
@@ -940,9 +942,11 @@
       kExternalClearKey, kVideoMP4MimeType, video_mp4_codecs()));
   // On Windows platforms, HEVC support is detected through the GPU capabilities
   // which won't indicate support when running the tests.
+  // On macOS platforms, HEVC only support clear content.
   // TODO(crbug/1327470): Fix this so that we can inject HEVC support on
   // Windows.
-#if BUILDFLAG(ENABLE_HEVC_PARSER_AND_HW_DECODER) && !BUILDFLAG(IS_WIN)
+#if BUILDFLAG(ENABLE_HEVC_PARSER_AND_HW_DECODER) && !BUILDFLAG(IS_WIN) && \
+    !BUILDFLAG(IS_MAC)
   EXPECT_ECK_PROPRIETARY(IsSupportedByKeySystem(
       kExternalClearKey, kVideoMP4MimeType, video_mp4_hevc_codecs()));
 #else
@@ -1184,14 +1188,7 @@
                                             video_mp4_hevc_codecs()));
 }
 
-// TODO(crbug.com/1329017): Re-enable this test
-#if BUILDFLAG(IS_MAC)
-#define MAYBE_Video_MP4 DISABLED_Video_MP4
-#else
-#define MAYBE_Video_MP4 Video_MP4
-#endif
-IN_PROC_BROWSER_TEST_F(EncryptedMediaSupportedTypesWidevineTest,
-                       MAYBE_Video_MP4) {
+IN_PROC_BROWSER_TEST_F(EncryptedMediaSupportedTypesWidevineTest, Video_MP4) {
   // Valid video types.
   EXPECT_WV_PROPRIETARY(
       IsSupportedByKeySystem(kWidevine, kVideoMP4MimeType, video_mp4_codecs()));
@@ -1557,15 +1554,9 @@
                                         video_webm_codecs()));
 }
 
-// TODO(crbug.com/1329017): Re-enable this test
-#if BUILDFLAG(IS_MAC)
-#define MAYBE_Basic DISABLED_Basic
-#else
-#define MAYBE_Basic Basic
-#endif
 IN_PROC_BROWSER_TEST_F(
     EncryptedMediaSupportedTypesClearKeyCdmRegisteredWithWrongPathTest,
-    MAYBE_Basic) {
+    Basic) {
   // External Clear Key will not be supported because Clear Key CDM is
   // registered with the wrong path.
   EXPECT_UNSUPPORTED(IsSupportedByKeySystem(
diff --git a/media/media_options.gni b/media/media_options.gni
index 13c374b8..b57e768 100644
--- a/media/media_options.gni
+++ b/media/media_options.gni
@@ -81,10 +81,10 @@
 
   # Enable inclusion of the HEVC/H265 parser and also enable HEVC/H265 decoding
   # with hardware acceleration assist. Enabled by default for fuzzer builds,
-  # ChromeOS builds with protected content support and Windows.
+  # ChromeOS builds with protected content support, Windows and Mac.
   enable_hevc_parser_and_hw_decoder =
       proprietary_codecs &&
-      (use_fuzzing_engine || use_chromeos_protected_media || is_win)
+      (use_fuzzing_engine || use_chromeos_protected_media || is_win || is_mac)
 }
 
 # Use another declare_args() to allow dependence on