ungoogled-software / ungoogled-chromium-archlinux

Arch Linux packaging for ungoogled-chromium
BSD 3-Clause "New" or "Revised" License
338 stars 37 forks source link

Enable HEVC decoding support #196

Closed jstkdng closed 2 years ago

jstkdng commented 2 years ago

Recently I found some sites that were providing HEVC where I was unable to see any video, just audio. Turns out chromium supports HEVC since 104 but it's not enabled by default (at least in chromium/linux). With the following changes, HEVC software decoding is possible through ffmpeg. I was not able to make VAAPI work with my GPU (6700 XT). Maybe intel-media-driver works better, need some testing for that. HEVC software decoding is kinda demanding, but at least software decoding is better than no decoding.

Site that I found that support HEVC: https://2chen.moe/ More concrete example: https://2chen.moe/tv/1807601#p1807638

Edit: patch was obtained from here: https://github.com/StaZhu/enable-chromium-hevc-hardware-decoding

jstkdng commented 2 years ago

huh, actions don't run on PRs?

networkException commented 2 years ago

Yes I think there were permission issues or something? I can't really remember. You could try pushing a tag on your fork

PF4Public commented 2 years ago

Have you actually tried building with this patch? It didn't apply for me, I ended up with:

--- a/media/base/supported_types.cc
+++ b/media/base/supported_types.cc
@@ -205,36 +205,7 @@
     return false;

 #if BUILDFLAG(ENABLE_PLATFORM_HEVC)
-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
-#if BUILDFLAG(IS_CHROMEOS_LACROS)
-  // TODO(b/171813538): For Lacros, the supplemental profile cache will be
-  // asking lacros-gpu, but we will be doing decoding in ash-gpu. Until the
-  // codec detection is plumbed through to ash-gpu we can do this extra check
-  // for HEVC support.
-  if (base::CommandLine::ForCurrentProcess()->HasSwitch(
-          switches::kLacrosEnablePlatformHevc)) {
-    return true;
-  }
-#endif  // BUILDFLAG(IS_CHROMEOS_LACROS)
-  return GetSupplementalProfileCache()->IsProfileSupported(type.profile);
-#elif BUILDFLAG(IS_MAC)
-  if (__builtin_available(macOS 11.0, *))
-    return base::FeatureList::IsEnabled(kPlatformHEVCDecoderSupport) &&
-           (type.profile == HEVCPROFILE_MAIN ||
-            type.profile == HEVCPROFILE_MAIN10 ||
-            type.profile == HEVCPROFILE_MAIN_STILL_PICTURE ||
-            type.profile == HEVCPROFILE_REXT);
-  return false;
-#elif BUILDFLAG(IS_ANDROID)
-  // Technically android 5.0 mandates support for only HEVC main profile,
-  // however some platforms (like chromecast) have had more profiles supported
-  // so we'll see what happens if we just enable them all.
-  return base::FeatureList::IsEnabled(kPlatformHEVCDecoderSupport);
-#else
   return true;
-#endif  // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
-#else
-  return false;
 #endif  // BUILDFLAG(ENABLE_PLATFORM_HEVC)
 }

But I think, I'll just hijack the function call with return true; with sed instead.

jstkdng commented 2 years ago

yeah I had to modify the patch, I'll update this pr