chromium-browser-stable-test/ROSA-enable-H265.patch

105 lines
4.3 KiB
Diff
Raw Normal View History

2018-10-31 10:02:21 +03:00
From e750e42ded2153c989714b666d7eb29ee27e6315 Mon Sep 17 00:00:00 2001
From: Mikhail Novosyolov <m.novosyolov@rosalinux.ru>
Date: Wed, 31 Oct 2018 09:24:31 +0300
Subject: [PATCH] Enable playback of H265 (HEVC) encoded videos in Chromium v70
2018-10-31 10:02:21 +03:00
---
media/base/mime_util_internal.cc | 8 +++++
.../ffmpeg/chromium/scripts/build_ffmpeg.py | 10 +++++--
third_party/ffmpeg/ffmpeg_generated.gni | 35 ++++++++++++++++++++++
3 files changed, 51 insertions(+), 2 deletions(-)
2018-10-31 05:00:32 +03:00
2018-10-31 10:02:21 +03:00
diff --git a/media/base/mime_util_internal.cc b/media/base/mime_util_internal.cc
index 91bfc8a..17fb8fc 100644
--- a/media/base/mime_util_internal.cc
+++ b/media/base/mime_util_internal.cc
@@ -927,6 +927,14 @@ SupportsType MimeUtil::IsCodecSupported(const std::string& mime_type_lower_case,
return IsNotSupported;
}
+ if (video_codec == kCodecHEVC) {
+ #if BUILDFLAG(ENABLE_HEVC_DEMUXING)
+ return IsSupported;
+ #else
+ return IsNotSupported;
+ #endif
+ }
+
if (video_codec != kUnknownVideoCodec) {
VideoConfig video_config = {video_codec, video_profile, video_level,
color_space};
diff --git a/third_party/ffmpeg/chromium/scripts/build_ffmpeg.py b/third_party/ffmpeg/chromium/scripts/build_ffmpeg.py
index 309d7b9..b20e8a2 100755
--- a/third_party/ffmpeg/chromium/scripts/build_ffmpeg.py
+++ b/third_party/ffmpeg/chromium/scripts/build_ffmpeg.py
@@ -830,10 +830,16 @@ def ConfigureAndBuild(target_arch, target_os, host_os, host_arch, parallel_jobs,
])
# Google Chrome & ChromeOS specific configuration.
+ # To find ffmpeg parser name:
+ # $ cat ./configure | grep parser | grep -E '265|hevc'
+ # results to 'hevc_parser', so its name is 'hevc', not 'h265'
+ # As far as I understand, FFmpeg has a built-in decoder for H265 (HEVC) (https://launchpad.net/ffmpeg/+announcement/12062),
+ # so --enable-libx265 is needed only for encoding capabilities, while we need decoding only, so we don't need --enable-libx265
+ # Note that we have 'enable_hevc_demuxing=true' in build flags
configure_flags['Chrome'].extend([
- '--enable-decoder=aac,h264',
+ '--enable-decoder=aac,h264,hevc',
'--enable-demuxer=aac',
- '--enable-parser=aac,h264',
+ '--enable-parser=aac,h264,hevc',
])
# Google ChromeOS specific configuration.
2018-10-31 10:02:21 +03:00
diff --git a/third_party/ffmpeg/ffmpeg_generated.gni b/third_party/ffmpeg/ffmpeg_generated.gni
index 8ac532b..a5d2aa0 100644
--- a/third_party/ffmpeg/ffmpeg_generated.gni
+++ b/third_party/ffmpeg/ffmpeg_generated.gni
2018-10-31 16:46:02 +03:00
@@ -246,6 +246,43 @@ if ((is_mac && ffmpeg_branding == "Chrome") || (is_win && ffmpeg_branding == "Ch
2018-10-31 10:02:21 +03:00
"libavcodec/h264idct.c",
"libavcodec/h264qpel.c",
"libavcodec/startcode.c",
+
+ # https://github.com/henrypp/chromium/blob/master/hevc_support_new.md
2018-10-31 16:46:02 +03:00
+ "libavformat/avc.c",
2018-10-31 10:02:21 +03:00
+ "libavcodec/bswapdsp.c",
+ "libavcodec/autorename_libavcodec_hevcdec.c",
2018-10-31 10:02:21 +03:00
+ "libavcodec/hevc_cabac.c",
+ "libavcodec/hevc_data.c",
+ "libavcodec/hevc_filter.c",
+ "libavcodec/hevc_mvs.c",
+ "libavcodec/hevc_parse.c",
+ "libavcodec/hevc_parser.c",
+ "libavcodec/hevc_ps.c",
+ "libavcodec/hevc_refs.c",
+ "libavcodec/hevc_sei.c",
+ "libavcodec/hevcdsp.c",
+ "libavcodec/hevcpred.c",
2018-10-31 12:39:35 +03:00
+ "libavcodec/hevc_mp4toannexb_bsf.c",
+ "libavformat/autorename_libavformat_hevc.c",
2018-10-31 10:02:21 +03:00
+ "libavformat/hevcdec.c",
+ ]
+}
+
+# https://github.com/henrypp/chromium/blob/master/hevc_support_new.md
+#if ((use_linux_config) && ((ffmpeg_branding == "Chrome") || (ffmpeg_branding == "ChromeOS")) && (current_cpu == "x64" || current_cpu == "x86")) { # Will this consctruction work?
+if ((use_linux_config && ffmpeg_branding == "Chrome" && current_cpu == "x64") || (use_linux_config && ffmpeg_branding == "Chrome" && current_cpu == "x86") || (use_linux_config && ffmpeg_branding == "ChromeOS" && current_cpu == "x64") || (use_linux_config && ffmpeg_branding == "ChromeOS" && current_cpu == "x86")) {
+ ffmpeg_yasm_sources += [
+ "libavcodec/x86/bswapdsp.asm",
+ "libavcodec/x86/hevc_deblock.asm",
+ "libavcodec/x86/hevc_idct.asm",
+ "libavcodec/x86/hevc_mc.asm",
+ "libavcodec/x86/hevc_add_res.asm",
+ "libavcodec/x86/hevc_sao.asm",
+ "libavcodec/x86/hevc_sao_10bit.asm",
+ ]
+ ffmpeg_c_sources += [
+ "libavcodec/x86/bswapdsp_init.c",
+ "libavcodec/x86/hevcdsp_init.c",
]
}
--
2.10.2