-
Notifications
You must be signed in to change notification settings - Fork 55
/
enable-hevc-ffmpeg-decoding.patch
97 lines (91 loc) · 3.79 KB
/
enable-hevc-ffmpeg-decoding.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
From c29ca1852fe6d975b0b772dd78e36de23641f14f Mon Sep 17 00:00:00 2001
From: Sta Zhu <[email protected]>
Date: Wed, 5 Jun 2024 22:55:04 +0800
Subject: [PATCH] Video: Enable HEVC ffmpeg decoding
This will consider all HEVC profile as to supported, let FFMpegVideoDecoder
handle SW fallback and help you be able to play video's like HEVC Rext, SCC
etc... as long as ffmpeg support it.
---
media/base/supported_types.cc | 28 +--------------------------
media/filters/ffmpeg_glue.cc | 3 +++
media/filters/ffmpeg_video_decoder.cc | 2 +-
3 files changed, 5 insertions(+), 28 deletions(-)
diff --git a/media/base/supported_types.cc b/media/base/supported_types.cc
index b3ca9c106e406..a6e3b0d5ea5db 100644
--- a/media/base/supported_types.cc
+++ b/media/base/supported_types.cc
@@ -222,33 +222,7 @@ bool IsAudioCodecProprietary(AudioCodec codec) {
#endif // !BUILDFLAG(USE_PROPRIETARY_CODECS)
bool IsHevcProfileSupported(const VideoType& type) {
- if (!IsColorSpaceSupported(type.color_space))
- return false;
-
-#if BUILDFLAG(ENABLE_PLATFORM_HEVC)
-#if BUILDFLAG(PLATFORM_HAS_OPTIONAL_HEVC_SUPPORT)
-#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)
-#if BUILDFLAG(IS_CHROMEOS_ASH)
- if (!base::FeatureList::IsEnabled(kPlatformHEVCDecoderSupport)) {
- return false;
- }
-#endif // BUILDFLAG(IS_CHROMEOS_ASH)
- return GetSupplementalProfileCache()->IsProfileSupported(type.profile);
-#else
return true;
-#endif // BUIDFLAG(PLATFORM_HAS_OPTIONAL_HEVC_SUPPORT)
-#else
- return false;
-#endif // BUILDFLAG(ENABLE_PLATFORM_HEVC)
}
bool IsVp9ProfileSupported(const VideoType& type) {
@@ -441,7 +415,7 @@ bool IsDefaultSupportedAudioType(const AudioType& type) {
bool IsBuiltInVideoCodec(VideoCodec codec) {
#if BUILDFLAG(ENABLE_FFMPEG_VIDEO_DECODERS) && BUILDFLAG(USE_PROPRIETARY_CODECS)
- if (codec == VideoCodec::kH264) {
+ if (codec == VideoCodec::kH264 || codec == VideoCodec::kHEVC) {
return true;
}
#endif // BUILDFLAG(ENABLE_FFMPEG_VIDEO_DECODERS) &&
diff --git a/media/filters/ffmpeg_glue.cc b/media/filters/ffmpeg_glue.cc
index e3a8c01362707..3d30a437e010d 100644
--- a/media/filters/ffmpeg_glue.cc
+++ b/media/filters/ffmpeg_glue.cc
@@ -156,6 +156,9 @@ const char* FFmpegGlue::GetAllowedVideoDecoders() {
#if BUILDFLAG(USE_PROPRIETARY_CODECS)
allowed_decoders.push_back("h264");
#endif // BUILDFLAG(USE_PROPRIETARY_CODECS)
+#if BUILDFLAG(ENABLE_PLATFORM_HEVC)
+ allowed_decoders.push_back("hevc");
+#endif // BUILDFLAG(ENABLE_PLATFORM_HEVC)
return base::JoinString(allowed_decoders, ",");
#else
return std::string();
diff --git a/media/filters/ffmpeg_video_decoder.cc b/media/filters/ffmpeg_video_decoder.cc
index 5b8acb47e3848..24475a2f336d0 100644
--- a/media/filters/ffmpeg_video_decoder.cc
+++ b/media/filters/ffmpeg_video_decoder.cc
@@ -76,7 +76,6 @@ static int GetFFmpegVideoDecoderThreadCount(const VideoDecoderConfig& config) {
case VideoCodec::kUnknown:
case VideoCodec::kVC1:
case VideoCodec::kMPEG2:
- case VideoCodec::kHEVC:
case VideoCodec::kVP9:
case VideoCodec::kAV1:
case VideoCodec::kDolbyVision:
@@ -89,6 +88,7 @@ static int GetFFmpegVideoDecoderThreadCount(const VideoDecoderConfig& config) {
break;
case VideoCodec::kH264:
+ case VideoCodec::kHEVC:
case VideoCodec::kVP8:
// Normalize to three threads for 1080p content, then scale linearly
// with number of pixels.
--
2.45.0