[M108 Migration] Support standard build for armv7hl architecture
[platform/framework/web/chromium-efl.git] / media / media_options.gni
1 # Copyright 2014 The Chromium Authors
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 import("//build/config/chrome_build.gni")
6 import("//build/config/chromecast_build.gni")
7 import("//build/config/chromeos/args.gni")
8 import("//build/config/chromeos/ui_mode.gni")
9 import("//build/config/features.gni")
10 import("//build/config/ui.gni")
11 import("//media/gpu/args.gni")
12 import("//testing/libfuzzer/fuzzer_test.gni")
13 import("//third_party/libaom/options.gni")
14 import("//third_party/libgav1/options.gni")
15
16 # This flag sets defaults for the current generation of cast devices.
17 is_cast_media_device = is_castos || is_cast_android
18
19 declare_args() {
20   # Allows distributions to link pulseaudio directly (DT_NEEDED) instead of
21   # using dlopen. This helps with automated detection of ABI mismatches and
22   # prevents silent errors.
23   link_pulseaudio = false
24
25   # Enable usage of FFmpeg within the media library. Used for most software
26   # based decoding, demuxing, and sometimes optimized FFTs. If disabled,
27   # implementors must provide their own demuxers and decoders.
28   media_use_ffmpeg = true && tizen_multimedia
29
30   # Enable usage of libvpx within the media library. Used for software based
31   # decoding of VP9 and VP8A type content.
32   media_use_libvpx = true
33
34   # iOS doesn't use ffmpeg, libvpx.
35   if (is_ios) {
36     media_use_ffmpeg = false
37     media_use_libvpx = false
38   }
39
40   # Enable usage of OpenH264 within the media library. Used for software based
41   # encoding of H264 content.
42   media_use_openh264 = true
43   if (is_ios || is_android || !proprietary_codecs) {
44     media_use_openh264 = false
45   }
46
47   # Override to dynamically link the cras (ChromeOS audio) library.
48   use_cras = is_chromeos_device
49
50   # Enables AC3/EAC3 audio demuxing. This is enabled only on Chromecast, since
51   # it only provides demuxing, and is only useful for AC3/EAC3 audio
52   # pass-through to HDMI sink on Chromecast.
53   enable_platform_ac3_eac3_audio = proprietary_codecs && is_cast_media_device
54
55   enable_platform_mpeg_h_audio = proprietary_codecs && is_cast_media_device
56
57   # Enables DTS/DTSX audio handling in chromium. This includes demuxing,
58   # on-device decoding and bitstream passthrough as supported by device.
59   enable_platform_dts_audio = false
60
61   # TODO(crbug.com/1329657): Remove the `is_fuchsia` condition once fuchsia
62   # builds set enable_cast_receiver.
63   enable_mse_mpeg2ts_stream_parser =
64       proprietary_codecs &&
65       (enable_cast_receiver || is_fuchsia || use_fuzzing_engine)
66
67   # Enable Dolby Vision demuxing. Enable by default for Chromecast. Actual
68   # decoding must be provided by the platform. Note some Dolby Vision profiles
69   # which are encoded using HEVC require `enable_platform_hevc` to be enabled.
70   #
71   # TODO(crbug.com/1336055): Revisit the default value for this setting as it
72   # applies to video-capable devices.
73   enable_platform_dolby_vision = proprietary_codecs && is_cast_media_device
74
75   # Enable platform support of encrypted Dolby Vision. Clear Dolby Vision is
76   # still not supported. The actual support depends on platform capability.
77   enable_platform_encrypted_dolby_vision = false
78
79   # Enable HLS with SAMPLE-AES decryption.
80   #
81   # TODO(crbug.com/1329657): Remove the `is_fuchsia` condition once fuchsia
82   # builds set enable_cast_receiver.
83   enable_hls_sample_aes =
84       proprietary_codecs && (enable_cast_receiver || is_fuchsia)
85
86   # Enable logging override, e.g. enable DVLOGs through level 2 at build time.
87   # On Chromecast, these are logged as INFO.
88   # On Fuchsia, these are logged as VLOGs.
89   enable_logging_override = is_cast_media_device || is_fuchsia
90
91   enable_dav1d_decoder = !is_ios
92
93   # Enable browser managed persistent metadata storage for EME persistent
94   # session and persistent usage record session.
95   enable_media_drm_storage = is_android || is_castos
96
97   # Enable HLS manifest parser and demuxer.
98   enable_hls_demuxer = false
99
100   # Enable inclusion of the HEVC/H265 parser and also enable HEVC/H265 decoding
101   # with hardware acceleration assist. Enabled by default for fuzzer builds,
102   # ChromeOS builds with protected content support, Windows, Mac, and Android.
103   enable_hevc_parser_and_hw_decoder =
104       proprietary_codecs &&
105       (use_fuzzing_engine || use_chromeos_protected_media || is_win || is_mac ||
106        is_android || is_linux)
107 }
108
109 # Use another declare_args() to allow dependence on
110 # |enable_hevc_parser_and_hw_decoder|.
111 declare_args() {
112   # If overriding this to false, possibly via its component values,
113   # `enable_libaom` should likely also be overriddent to false.
114   enable_av1_decoder = enable_dav1d_decoder || enable_libgav1_decoder
115
116   # Enable HEVC/H265 demuxing. Actual decoding must be provided by the
117   # platform.
118   # TODO(b/194429120): Enable this for Lacros builds.
119   # TODO(crbug.com/1336055): Revisit the default value for this setting as it
120   # applies to video-capable devices.
121   enable_platform_hevc =
122       proprietary_codecs &&
123       (enable_hevc_parser_and_hw_decoder || is_cast_media_device)
124 }
125
126 assert(
127     !enable_platform_ac3_eac3_audio || proprietary_codecs,
128     "proprietary_codecs=true is required for enable_platform_ac3_eac3_audio=true.")
129 assert(
130     !enable_platform_mpeg_h_audio || proprietary_codecs,
131     "proprietary_codecs=true is required for enable_platform_mpeg_h_audio=true.")
132 assert(
133     !enable_mse_mpeg2ts_stream_parser || proprietary_codecs,
134     "proprietary_codecs=true is required for enable_mse_mpeg2ts_stream_parser=true.")
135 assert(
136     !enable_platform_dolby_vision || proprietary_codecs,
137     "proprietary_codecs=true is required for enable_platform_dolby_vision=true.")
138 assert(
139     !enable_platform_encrypted_dolby_vision || enable_platform_dolby_vision,
140     "enable_platform_dolby_vision=true is required for enable_platform_encrypted_dolby_vision=true.")
141 assert(!enable_hls_sample_aes || proprietary_codecs,
142        "proprietary_codecs=true is required for enable_hls_sample_aes=true.")
143 assert(
144     !enable_platform_dts_audio || proprietary_codecs,
145     "proprietary_codecs=true is required for enable_platform_dts_audio=true.")
146
147 assert(
148     !enable_hls_sample_aes || enable_mse_mpeg2ts_stream_parser,
149     "enable_mse_mpeg2ts_stream_parser=true is required for enable_hls_sample_aes=true.")
150
151 assert(
152     !enable_hls_demuxer || enable_mse_mpeg2ts_stream_parser,
153     "enable_mse_mpeg2ts_stream_parser=true is required for enable_hls_demuxer=true.")
154
155 assert(!enable_platform_hevc || proprietary_codecs,
156        "proprietary_codecs=true is required for enable_platform_hevc=true.")
157
158 assert(
159     !enable_hevc_parser_and_hw_decoder || enable_platform_hevc,
160     "enable_platform_hevc=true is required for enable_hevc_parser_and_hw_decoder=true.")
161
162 # Use another declare_args() to pick up possible overrides of |use_cras|.
163 declare_args() {
164   # Enables runtime selection of PulseAudio library.
165   use_pulseaudio = false
166
167   # Enables runtime selection of ALSA library for audio.
168   use_alsa = false
169
170   # Alsa should be used on all non-Android, non-Mac POSIX systems - with the
171   # exception of CastOS desktop builds.
172   #
173   # TODO(crbug.com/1336055): Remove legacy target_cpu hack used for targeting
174   # desktop Chromecast builds.
175   if (is_posix && !is_android && !is_mac &&
176       (!is_castos || (target_cpu == "x86" || target_cpu == "x64") ||
177        is_cast_audio_only)) {
178     use_alsa = true
179
180     # Pulse is not supported on Chromecast platforms.
181     #
182     # ASAN and TSAN will occasionally hang during pa_context_connect(), so we
183     # disable PulseAudio when these configurations are enabled.
184     #
185     # TODO(crbug.com/986021): We shouldn't have to do this, but it's unclear why
186     # our test bots are hanging and all of the ones that don't hang just fall
187     # back to ALSA after a connection error anyways.
188     if (!use_cras && !is_castos && !is_asan && !is_tsan && !is_tizen) {
189       use_pulseaudio = true
190     }
191   }
192 }
193
194 # Use another declare_args() to include possible overrides of media_use_ffmpeg
195 # from --args command line flags in the evaluation. See "gn help declare_args".
196 declare_args() {
197   # On Android, FFMpeg is built without video decoders by default.
198   # This flag gives the option to override that decision in case there are no
199   # hardware decoders. To do so, you will also need to update ffmpeg build files
200   # in order to define which decoders to build in.
201   enable_ffmpeg_video_decoders = media_use_ffmpeg && !is_android
202 }
203
204 declare_args() {
205   # Enables the use of library CDMs that implements the interface defined at
206   # media/cdm/api/content_decryption_module.h. If true, the actually library CDM
207   # will be hosted in the mojo CDM service running in the CDM (utility) process.
208   # Used for all desktop platforms except Fuchsia (crbug.com/1265618).
209   enable_library_cdms = toolkit_views && !is_fuchsia && !is_castos
210 }
211
212 declare_args() {
213   # Enables host verification for CDMs.
214   # Windows and Mac.
215   enable_cdm_host_verification =
216       enable_library_cdms && (is_mac || is_win) && is_chrome_branded
217
218   # Enable Storage ID which is used by CDMs. This is only available with chrome
219   # branding, but may be overridden by other embedders.
220   enable_cdm_storage_id = enable_library_cdms && is_chrome_branded &&
221                           (is_win || is_mac || is_chromeos)
222
223   # If |enable_cdm_storage_id| is set, then an implementation specific key
224   # must also be provided. It can be provided by defining CDM_STORAGE_ID_KEY
225   # (which takes precedence), or by setting |alternate_cdm_storage_id_key|.
226   # The key must be a string of at least 32 characters.
227   alternate_cdm_storage_id_key = ""
228 }
229
230 assert(!enable_cdm_host_verification || is_mac || is_win,
231        "CDM host verification is only supported on Mac and Windows.")
232
233 # Default |mojo_media_services| and |mojo_media_host| on various platforms. See
234 # comments below for valid values. Can be overridden by gn build arguments from
235 # the --args command line flag.
236 _default_mojo_media_services = []
237 _default_mojo_media_host = ""
238
239 if (is_cast_media_device) {
240   _default_mojo_media_services = cast_mojo_media_services
241   _default_mojo_media_host = cast_mojo_media_host
242 } else if (is_android) {
243   _default_mojo_media_services = [
244     "cdm",
245     "audio_decoder",
246     "video_decoder",
247   ]
248   _default_mojo_media_host = "gpu"
249 } else if (is_mac || (is_win && enable_platform_dts_audio)) {
250   _default_mojo_media_services = [
251     "audio_decoder",
252     "audio_encoder",
253     "video_decoder",
254   ]
255   _default_mojo_media_host = "gpu"
256 } else if (is_win) {
257   _default_mojo_media_services = [
258     "audio_encoder",
259     "video_decoder",
260   ]
261   _default_mojo_media_host = "gpu"
262 } else if (is_chromeos_ash || ((is_linux || is_chromeos_lacros) &&
263                                (use_vaapi || use_v4l2_codec))) {
264   _default_mojo_media_services = [ "video_decoder" ]
265   _default_mojo_media_host = "gpu"
266 }
267
268 # When |enable_library_cdms| is true, the "cdm" service will run in a separate
269 # CdmService in the CDM (utility) process. Therefore there's no need to specify
270 # |_default_mojo_media_host| which controls where the MediaService runs in.
271 if (enable_library_cdms) {
272   _default_mojo_media_services += [ "cdm" ]
273 }
274
275 declare_args() {
276   # A list of mojo media services that should be used in the media pipeline.
277   # Valid entries in the list are:
278   # - "renderer": Use mojo-based media Renderer service.
279   # - "cdm": Use mojo-based Content Decryption Module.
280   # - "audio_decoder": Use mojo-based audio decoder in the default media
281   #                    Renderer. Cannot be used with the mojo Renderer above.
282   # - "video_decoder": Use mojo-based video decoder in the default media
283   #                    Renderer. Cannot be used with the mojo Renderer above.
284   mojo_media_services = _default_mojo_media_services
285
286   # The process that the mojo MediaService runs in. By default, all services
287   # registered in |mojo_media_services| are hosted in the MediaService, with the
288   # exception that when |enable_library_cdms| is true, the "cdm" service will
289   # run in a separate CdmService in the CDM (utility) process, while other
290   # |mojo_media_services| still run in the MediaService in the process specified
291   # by "mojo_media_host".
292   # Valid options are:
293   # - "browser": Use mojo media service hosted in the browser process.
294   # - "gpu": Use mojo media service hosted in the gpu process.
295   # - "": Do not use mojo media service.
296   mojo_media_host = _default_mojo_media_host
297 }
298
299 declare_args() {
300   # This switch defines whether the Media Remoting implementation will be built.
301   # When enabled, media is allowed to be renderer and played back on remote
302   # devices when the tab is being casted and other conditions are met.
303   enable_media_remoting = !is_cast_media_device && !is_ios
304 }
305
306 declare_args() {
307   # Media Remoting RPC is disabled on Android since it's unused but increases
308   # the native binary size by ~70Kb.
309   enable_media_remoting_rpc = enable_media_remoting && !is_android
310 }
311
312 declare_args() {
313   # Currently it is available on Win, Mac and Linux, since it requires the audio
314   # service to run in a separate process.
315   chrome_wide_echo_cancellation_supported = is_win || is_mac || is_linux
316 }
317
318 # Do not expand this list without double-checking with OWNERS, this is a list of
319 # all targets which roll up into the //media component. It controls visibility
320 # of subcomponent targets and public_deps for //media.
321 media_subcomponent_deps = [
322   "//media/audio",
323   "//media/base",
324
325   # TODO(crbug.com/583067): These files should not be in //media/base.
326   "//media/base/android",
327   "//media/capabilities",
328   "//media/cdm",
329   "//media/device_monitors",
330   "//media/filters",
331   "//media/formats",
332   "//media/muxers",
333   "//media/renderers",
334   "//media/video",
335 ]
336
337 if (is_fuchsia) {
338   media_subcomponent_deps += [
339     "//media/fuchsia/cdm",
340     "//media/fuchsia/common",
341   ]
342 }
343
344 if (media_use_ffmpeg) {
345   media_subcomponent_deps += [ "//media/ffmpeg" ]
346 }
347
348 if (enable_library_cdms || is_win) {
349   media_subcomponent_deps += [ "//media/cdm:cdm_type_conversion" ]
350 }