Skip to content

Commit

Permalink
Update Patch to 104.0.5061.1
Browse files Browse the repository at this point in the history
  • Loading branch information
StaZhu committed May 14, 2022
1 parent ef968d6 commit d21e7de
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 37 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.DS_Store
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,18 +94,20 @@ Very likely, but one thing is sure, only platform decoder that provided by the

## How to Build?

1. Follow [the official build doc](https://www.chromium.org/developers/how-tos/get-the-code/) to prepare the build environment then fetch the source code to tag `103.0.5044.1` (newer tag or `main` branch should also work if no code conflict with the following patch, i will try my best to update the patch in time through).
1. Follow [the official build doc](https://www.chromium.org/developers/how-tos/get-the-code/) to prepare the build environment then fetch the source code from `main` branch.
2. (Optional) To enable HEVC software decoding: switch to `src/third_party/ffmpeg` dir, then execute `git am /path/to/add-hevc-ffmpeg-decoder-parser.patch`.
3. (Optional) To enable other HEVC profiles (non main / main 10 profiles): switch to `src` dir, then execute `git am /path/to/remove-main-main10-profile-limit.patch`.
4. (Optional) To default enable hardware decode: switch to `src` dir, then execute `git am /path/to/enable-hevc-hardware-decoding-by-default.patch`.
5. (Optional) To remove chrome switch passing: switch to `src` dir, then execute `git am /path/to/remove-clear-testing-args-passing.patch`.
6. If you are using `x64` arch cpu, run `gn gen out/Release64 --args="is_component_build = false is_official_build = true is_debug = false ffmpeg_branding = \"Chrome\" target_cpu = \"x64\" proprietary_codecs = true media_use_ffmpeg = true enable_platform_encrypted_hevc = true enable_platform_hevc = true enable_platform_hevc_decoding = true"`, you can change target_cpu to `x86` , `arm64` , `arm` if you want to build other cpu archs.
7. Run `autoninja -C out/Release64 chrome` to start the build.
8. Run `./out/Release64/Chromium.app/Contents/MacOS/Chromium --args --enable-clear-hevc-for-testing --enable-features=VideoToolboxHEVCDecoding` to open chromium if you are using macOS.
9. Create a desktop shortcut and passing the args like `C:\Users\Admin\Desktop\Chromium\chrome.exe --enable-clear-hevc-for-testing --enable-features=D3D11HEVCDecoding` then double click the desktop shortcut to open chromium if you are using Windows.
8. Run `./out/Release64/Chromium.app/Contents/MacOS/Chromium --args --enable-clear-hevc-for-testing --enable-features=PlatformHEVCDecoderSupport` to open chromium if you are using macOS.
9. Create a desktop shortcut and passing the args like `C:\Users\Admin\Desktop\Chromium\chrome.exe --enable-clear-hevc-for-testing --enable-features=PlatformHEVCDecoderSupport` then double click the desktop shortcut to open chromium if you are using Windows.

## Change Log

`2022-05-14` Update Patch to `104.0.5061.1`

`2022-05-13` Add HEVC Test page

`2022-05-10` Update README, add more special detail of the hardware support and GPU models
Expand Down
10 changes: 6 additions & 4 deletions README.zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,19 +94,21 @@ Apple M1, M1 Pro, M1 Max, M1 Ultra 及以上

## 如何编译?

1. 请参考 [Chrome编译手册](https://www.chromium.org/developers/how-tos/get-the-code/) 配置环境并拉取 `103.0.5044.1` tag 的代码(更新的版本,比如 `main` 分支,在没有代码冲突的情况, 理论上也可以,这里我争取定期更新最新的)
1. 请参考 [Chrome编译手册](https://www.chromium.org/developers/how-tos/get-the-code/) 配置环境并拉取 `main` 分支的代码
2. (可选) 支持 HEVC 软解:切换到 `src/third_party/ffmpeg` 目录,执行 `git am /path/to/add-hevc-ffmpeg-decoder-parser.patch`
3. (可选) 支持 Main / Main10 以外的其他 HEVC Profile: 切换到 `src` 目录,执行 `git am /path/to/remove-main-main10-profile-limit.patch`
4. (可选) 默认启用硬解:切换到 `src` 目录,执行 `git am /path/to/enable-hevc-hardware-decoding-by-default.patch`
5. (可选) 去除启动参数:切换到 `src` 目录,执行 `git am /path/to/remove-clear-testing-args-passing.patch`
6. 假设你想编译 `x64` 架构的 Chromium,请执行 `gn gen out/Release64 --args="is_component_build = false is_official_build = true is_debug = false ffmpeg_branding = \"Chrome\" target_cpu = \"x64\" proprietary_codecs = true media_use_ffmpeg = true enable_platform_encrypted_hevc = true enable_platform_hevc = true enable_platform_hevc_decoding = true"`,其他可选的架构有: `x86` , `arm64` , `arm` 等。
7. 执行 `autoninja -C out/Release64 chrome` 以开始编译。
8. 如果是 Mac,执行 `./out/Release64/Chromium.app/Contents/MacOS/Chromium --args --enable-clear-hevc-for-testing --enable-features=VideoToolboxHEVCDecoding` 打开编译好的 Chromium 并开启 HEVC 硬解。
9. 如果是 Windows,在桌面创建一个快捷方式,并改为类似如下的路径: `C:\Users\Admin\Desktop\Chromium\chrome.exe --enable-clear-hevc-for-testing --enable-features=D3D11HEVCDecoding` 然后双击打开快捷方式,即可打开编译好的 Chromium 并开启 HEVC 硬解。
8. 如果是 Mac,执行 `./out/Release64/Chromium.app/Contents/MacOS/Chromium --args --enable-clear-hevc-for-testing --enable-features=PlatformHEVCDecoderSupport` 打开编译好的 Chromium 并开启 HEVC 硬解。
9. 如果是 Windows,在桌面创建一个快捷方式,并改为类似如下的路径: `C:\Users\Admin\Desktop\Chromium\chrome.exe --enable-clear-hevc-for-testing --enable-features=PlatformHEVCDecoderSupport` 然后双击打开快捷方式,即可打开编译好的 Chromium 并开启 HEVC 硬解。

## 更新历史

`2022-05-13` 添加HEVC测试页面
`2022-05-14` 更新 Patch 到 `104.0.5061.1`

`2022-05-13` 添加 HEVC 测试页面

`2022-05-10` 更新 README,明确硬解范围和支持型号

Expand Down
33 changes: 12 additions & 21 deletions enable-hevc-hardware-decoding-by-default.patch
Original file line number Diff line number Diff line change
@@ -1,33 +1,24 @@
From 68eaad948f07cf30c49f22e5d11aa24a10a07923 Mon Sep 17 00:00:00 2001
From 54a0d672c2ada9628b12a695ebfc215934180ab4 Mon Sep 17 00:00:00 2001
From: Sta Zhu <[email protected]>
Date: Wed, 27 Apr 2022 15:21:11 +0800
Date: Sat, 14 May 2022 12:09:53 +0800
Subject: [PATCH] Video: Enable HEVC hardware decoding by default
---
media/base/media_switches.cc | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
media/base/media_switches.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/media/base/media_switches.cc b/media/base/media_switches.cc
index 7cf785f96b3fb..26cd4db5735ae 100644
index 0c8b45e55dd23..11637073d4fdc 100644
--- a/media/base/media_switches.cc
+++ b/media/base/media_switches.cc
@@ -789,7 +789,7 @@ const base::Feature kUseAlternateVideoDecoderImplementation{

#if BUILDFLAG(ENABLE_PLATFORM_HEVC_DECODING)
const base::Feature kVideoToolboxHEVCDecoding{
- "VideoToolboxHEVCDecoding", base::FEATURE_DISABLED_BY_DEFAULT};
+ "VideoToolboxHEVCDecoding", base::FEATURE_ENABLED_BY_DEFAULT};
#endif // BUILDFLAG(ENABLE_PLATFORM_HEVC_DECODING)

// Enable binding multiple shared images to a single GpuMemoryBuffer for
@@ -855,7 +855,7 @@ const base::Feature MEDIA_EXPORT kWasapiRawAudioCapture{

@@ -279,7 +279,7 @@ const base::Feature kPictureInPicture {
BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX))
// Enables HEVC hardware accelerated decoding.
const base::Feature kD3D11HEVCDecoding{"D3D11HEVCDecoding",
- base::FEATURE_DISABLED_BY_DEFAULT};
+ base::FEATURE_ENABLED_BY_DEFAULT};
const base::Feature kPlatformHEVCDecoderSupport{
- "PlatformHEVCDecoderSupport", base::FEATURE_DISABLED_BY_DEFAULT};
+ "PlatformHEVCDecoderSupport", base::FEATURE_ENABLED_BY_DEFAULT};
#endif // BUILDFLAG(ENABLE_PLATFORM_HEVC) && (IS_ANDROID || IS_WIN || IS_CROS
// || IS_MAC || IS_LINUX)

// Enable VP9 kSVC decoding with HW decoder for webrtc use case on Windows.
const base::Feature kD3D11Vp9kSVCHWDecoding{"D3D11Vp9kSVCHWDecoding",
--
2.32.0 (Apple Git-132)

19 changes: 10 additions & 9 deletions remove-main-main10-profile-limit.patch
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
From 7e2522b7627c85168eb4c05d68a4e7edc61af336 Mon Sep 17 00:00:00 2001
From b35024f4b2ee639ba3116a7a24c2e3d3943d4277 Mon Sep 17 00:00:00 2001
From: Sta Zhu <[email protected]>
Date: Thu, 5 May 2022 15:55:52 +0800
Date: Sat, 14 May 2022 12:07:34 +0800
Subject: [PATCH] Video: Remove Main/Main10 profile limit

This will consider all HEVC profile as to supported, and
help you be able to play video's like HEVC Rext, SCC etc...
---
media/base/supported_types.cc | 30 ------------------------------
1 file changed, 30 deletions(-)
media/base/supported_types.cc | 31 -------------------------------
1 file changed, 31 deletions(-)

diff --git a/media/base/supported_types.cc b/media/base/supported_types.cc
index 3953324666dbe..75c439fdd3c6c 100644
index e6b9a1cd524ec..b0d667690ea4f 100644
--- a/media/base/supported_types.cc
+++ b/media/base/supported_types.cc
@@ -205,37 +205,7 @@ bool IsHevcProfileSupported(const VideoType& type) {
@@ -203,38 +203,7 @@ bool IsAudioCodecProprietary(AudioCodec codec) {
bool IsHevcProfileSupported(const VideoType& type) {
if (!IsColorSpaceSupported(type.color_space))
return false;
-
-#if BUILDFLAG(ENABLE_PLATFORM_HEVC)
-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
- return GetSupplementalProfileCache()->IsProfileSupported(type.profile);
-#elif BUILDFLAG(IS_MAC)
- if (__builtin_available(macOS 11.0, *))
- return base::FeatureList::IsEnabled(kVideoToolboxHEVCDecoding) &&
- return base::FeatureList::IsEnabled(kPlatformHEVCDecoderSupport) &&
- (type.profile == HEVCPROFILE_MAIN ||
- type.profile == HEVCPROFILE_MAIN10 ||
- type.profile == HEVCPROFILE_MAIN_STILL_PICTURE ||
Expand All @@ -32,7 +33,7 @@ index 3953324666dbe..75c439fdd3c6c 100644
- // 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(kMediaCodecHEVC);
- return base::FeatureList::IsEnabled(kPlatformHEVCDecoderSupport);
-#else
return true;
-#endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
Expand Down

0 comments on commit d21e7de

Please sign in to comment.