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.
5 import("//build/buildflag_header.gni")
6 import("//build/config/android/config.gni")
7 import("//build/config/arm.gni")
8 import("//build/config/chromecast_build.gni")
9 import("//build/config/features.gni")
10 import("//build/config/linux/pkg_config.gni")
11 import("//build/config/ui.gni")
12 import("//media/media_options.gni")
13 import("//testing/libfuzzer/fuzzer_test.gni")
14 import("//testing/test.gni")
15 import("//third_party/ffmpeg/ffmpeg_options.gni")
16 import("//tizen_src/chromium_impl/media/media_efl.gni")
18 if (enable_library_cdms) {
19 import("//media/cdm/library_cdm/cdm_paths.gni")
22 buildflag_header("media_buildflags") {
23 header = "media_buildflags.h"
26 "ALTERNATE_CDM_STORAGE_ID_KEY=\"$alternate_cdm_storage_id_key\"",
27 "CHROME_WIDE_ECHO_CANCELLATION=$chrome_wide_echo_cancellation_supported",
28 "ENABLE_PLATFORM_AC3_EAC3_AUDIO=$enable_platform_ac3_eac3_audio",
29 "ENABLE_CAST_AUDIO_RENDERER=$enable_cast_audio_renderer",
30 "ENABLE_DAV1D_DECODER=$enable_dav1d_decoder",
31 "ENABLE_AV1_DECODER=$enable_av1_decoder",
32 "ENABLE_PLATFORM_DOLBY_VISION=$enable_platform_dolby_vision",
33 "ENABLE_PLATFORM_ENCRYPTED_DOLBY_VISION=$enable_platform_encrypted_dolby_vision",
34 "ENABLE_FFMPEG=$media_use_ffmpeg",
35 "ENABLE_FFMPEG_VIDEO_DECODERS=$enable_ffmpeg_video_decoders",
36 "ENABLE_PLATFORM_HEVC=$enable_platform_hevc",
37 "ENABLE_HEVC_PARSER_AND_HW_DECODER=$enable_hevc_parser_and_hw_decoder",
38 "ENABLE_HLS_SAMPLE_AES=$enable_hls_sample_aes",
39 "ENABLE_HLS_DEMUXER=$enable_hls_demuxer",
40 "ENABLE_LIBGAV1_DECODER=$enable_libgav1_decoder",
41 "ENABLE_LIBAOM=$enable_libaom",
42 "ENABLE_LIBRARY_CDMS=$enable_library_cdms",
43 "ENABLE_LIBVPX=$media_use_libvpx",
44 "ENABLE_LOGGING_OVERRIDE=$enable_logging_override",
45 "ENABLE_MEDIA_DRM_STORAGE=$enable_media_drm_storage",
46 "ENABLE_MEDIA_REMOTING=$enable_media_remoting",
47 "ENABLE_MEDIA_REMOTING_RPC=$enable_media_remoting_rpc",
48 "ENABLE_OPENH264=$media_use_openh264",
49 "ENABLE_PLATFORM_MPEG_H_AUDIO=$enable_platform_mpeg_h_audio",
50 "ENABLE_MSE_MPEG2TS_STREAM_PARSER=$enable_mse_mpeg2ts_stream_parser",
51 "USE_ARC_PROTECTED_MEDIA=$use_arc_protected_media",
52 "USE_CHROMEOS_MEDIA_ACCELERATION=$use_vaapi||$use_v4l2_codec",
53 "USE_CHROMEOS_PROTECTED_AV1=$use_chromeos_protected_av1",
54 "USE_CHROMEOS_PROTECTED_MEDIA=$use_chromeos_protected_media",
55 "USE_PROPRIETARY_CODECS=$proprietary_codecs",
56 "ENABLE_PLATFORM_DTS_AUDIO=$enable_platform_dts_audio",
59 if (enable_library_cdms) {
61 "CDM_PLATFORM_SPECIFIC_PATH=\"$cdm_platform_specific_path\"",
62 "ENABLE_CDM_HOST_VERIFICATION=$enable_cdm_host_verification",
63 "ENABLE_CDM_STORAGE_ID=$enable_cdm_storage_id",
68 if (proprietary_codecs && media_use_ffmpeg && !tizen_multimedia) {
70 ffmpeg_branding != "Chromium",
71 "proprietary codecs and ffmpeg_branding set to Chromium are incompatible")
74 # Common configuration for targets in the media directory; these must not be
75 # exported since things like USE_NEON and USE_CRAS have different meanings
76 # elsewhere in the code base.
77 config("media_config") {
79 if (current_cpu == "arm64" || (current_cpu == "arm" && arm_use_neon)) {
80 defines += [ "USE_NEON" ]
83 defines += [ "USE_PULSEAUDIO" ]
84 if (!link_pulseaudio) {
85 defines += [ "DLOPEN_PULSEAUDIO" ]
89 defines += [ "USE_CRAS" ]
93 # Internal grouping of the configs necessary to support sub-folders having their
94 # own BUILD.gn files; only targets which roll up into the "media" target should
95 # include this config. I.e., not "test_support" or "unit_tests" targets.
97 # Without these configs having individual sub-folders take a //media/base DEP
98 # (or others) can yield incorrectly imported and exported symbols on Windows:
100 # fatal error LNK1169: one or more multiply defined symbols found.
102 config("subcomponent_config") {
103 visibility = media_subcomponent_deps
105 visibility += [ "//media/base/mac" ]
107 defines = [ "IS_MEDIA_IMPL" ]
110 "//build/config/compiler:wexit_time_destructors",
120 "//base/third_party/dynamic_annotations",
122 "//gpu/command_buffer/client:gles2_interface",
123 "//gpu/command_buffer/common",
124 "//third_party/libyuv",
125 "//ui/events:events_base",
132 public_configs = [ "//third_party/libwebm:libwebm_config" ]
133 public_deps = media_subcomponent_deps
136 ":shared_memory_support",
137 "//ui/gfx:color_space",
140 # This must be included here since it actually depends on //media/base.
142 public_deps += [ "//media/base/mac" ]
146 deps += [ "//ui/ozone" ]
150 # Note: This can't be a static_library since it does not have any sources.
151 source_set("test_support") {
155 "//media/audio:test_support",
156 "//media/base:test_support",
157 "//media/base/android:test_support",
158 "//media/filters:test_support",
159 "//media/formats:test_support",
160 "//media/renderers:test_support",
161 "//media/video:test_support",
165 # Contains tests for all targets in the "media" folder.
166 # TODO(xhwang): Move mojo/capture/remoting tests here where applicable.
167 test("media_unittests") {
168 use_xvfb = use_xvfb_in_this_config
171 "//media/audio:unit_tests",
172 "//media/base:unit_tests",
173 "//media/capabilities:unit_tests",
174 "//media/cdm:unit_tests",
175 "//media/device_monitors:unit_tests",
176 "//media/filters:unit_tests",
177 "//media/formats:unit_tests",
178 "//media/gpu:unit_tests",
179 "//media/learning:unit_tests",
180 "//media/mojo:unit_tests",
181 "//media/muxers:unit_tests",
182 "//media/parsers:unit_tests",
183 "//media/renderers:unit_tests",
184 "//media/test:pipeline_integration_tests",
185 "//media/test:run_all_unittests",
186 "//media/video:unit_tests",
187 "//media/webrtc:unit_tests",
192 "formats/mp4/h264_annex_b_fuzz_corpus/",
195 data_deps = [ "//testing/buildbot/filters:media_unittests_filters" ]
197 if (is_android && enable_chrome_android_internal) {
198 data_deps += [ "//clank/build/bot/filters:media_unittests_filters" ]
201 if (media_use_ffmpeg) {
202 deps += [ "//media/ffmpeg:unit_tests" ]
207 # The test needs the java dependencies to add the java classes for their
208 # native counterparts to the test apk.
209 "//gpu/command_buffer/service:android_texture_owner_unittests",
210 "//media/base/android:media_java",
211 "//media/base/android:unit_tests",
212 "//media/gpu:android_video_decode_accelerator_unittests",
213 "//ui/android:ui_java",
219 "//media/fuchsia/cdm/service:unittests",
220 "//media/fuchsia/video:unittests",
223 # PaintCanvasVideoRendererWithGLTest.* uses SwiftShader, which generates
225 test_runner_shard = "//build/config/fuchsia/test/elf_test_ambient_exec_runner.shard.test-cml"
227 additional_manifest_fragments = [
228 "//build/config/fuchsia/test/audio_output.shard.test-cml",
229 "//build/config/fuchsia/test/mark_vmo_executable.shard.test-cml",
230 "//build/config/fuchsia/test/platform_video_codecs.shard.test-cml",
231 "//third_party/fuchsia-sdk/sdk/pkg/vulkan/client.shard.cml",
234 if (enable_library_cdms) {
235 excluded_files = [ "lib.unstripped/libclearkeycdm.so" ]
239 if (enable_media_remoting) {
240 deps += [ "//media/remoting:media_remoting_tests" ]
243 # The test needs OPUS_FIXED_POINT conditional define.
244 configs += [ "//third_party/opus:opus_config" ]
247 test("media_perftests") {
248 configs += [ ":media_config" ]
251 "//base/test:test_support",
252 "//media/base:perftests",
253 "//media/filters:perftests",
254 "//media/test:pipeline_integration_perftests",
258 "//third_party/widevine/cdm:headers",
259 "//ui/gfx:test_support",
261 if (media_use_ffmpeg) {
262 # Direct dependency required to inherit config.
263 deps += [ "//third_party/ffmpeg" ]
266 # This target should not require the Chrome executable to run.
267 assert_no_deps = [ "//chrome" ]
269 data = [ "test/data/" ]
272 # Needed for isolate script to execute.
273 "//testing:run_perf_test",
277 # The audio subset of media_unittests. This target exists for running only the
278 # audio tests on the GPU bots (which have audio hardware).
279 test("audio_unittests") {
282 "//base/test:test_support",
283 "//media/audio:unit_tests",
284 "//media/test:run_all_unittests",
288 # The test needs the java dependencies to add the java classes for their
289 # native counterparts to the test apk.
290 "//media/base/android:media_java",
291 "//ui/android:ui_java",
296 additional_manifest_fragments =
297 [ "//build/config/fuchsia/test/audio_output.shard.test-cml" ]
301 # Note: Most external components should just depend on //media unless they
302 # specifically need this pared own target (NaCl, PPAPI, etc). Internal targets
303 # should just depend on //media/base which will propagate this target to them.
304 component("shared_memory_support") {
308 "base/audio_codecs.h",
309 "base/audio_latency.cc",
310 "base/audio_latency.h",
311 "base/audio_parameters.cc",
312 "base/audio_parameters.h",
313 "base/audio_point.cc",
314 "base/audio_point.h",
315 "base/audio_sample_types.h",
316 "base/channel_layout.cc",
317 "base/channel_layout.h",
319 "base/media_export.h",
320 "base/media_shmem_export.h",
321 "base/sample_format.cc",
322 "base/sample_format.h",
323 "base/vector_math.cc",
324 "base/vector_math.h",
325 "base/vector_math_testing.h",
326 "base/video_types.cc",
327 "base/video_types.h",
330 # These need to be included here because audio_latency.cc depends on them.
332 "base/mac/audio_latency_mac.cc",
333 "base/mac/audio_latency_mac.h",
337 # Do not use "subcomponent_config" here since these files are in their own
338 # component target and thus can't share the standard export macros.
339 configs += [ ":media_config" ]
340 defines = [ "MEDIA_SHMEM_IMPLEMENTATION" ]
343 configs -= [ "//build/config/compiler:default_optimization" ]
344 configs += [ "//build/config/compiler:optimize_max" ]
348 "//build:chromeos_buildflags",
353 # TODO(watk): Refactor tests that could be made to run on Android. See
354 # http://crbug.com/570762
355 if (media_use_ffmpeg && !is_android) {
356 test("ffmpeg_regression_tests") {
357 configs += [ "//media:media_config" ]
361 "//base/test:test_support",
362 "//media/ffmpeg:ffmpeg_regression_tests",
363 "//media/test:pipeline_integration_tests",
364 "//media/test:run_all_unittests",
367 "//ui/gfx:test_support",
373 if (proprietary_codecs) {
374 fuzzer_test("media_cenc_utils_fuzzer") {
375 sources = [ "cdm/cenc_utils_fuzzertest.cc" ]
380 fuzzer_test("media_vp9_parser_fuzzer") {
381 sources = [ "filters/vp9_parser_fuzzertest.cc" ]
386 libfuzzer_options = [ "max_len = 400000" ]
389 fuzzer_test("media_vp9_parser_encrypted_fuzzer") {
390 sources = [ "filters/vp9_parser_encrypted_fuzzertest.cc" ]
394 "//base/test:test_support",
396 seed_corpus = "//media/test/data"
399 fuzzer_test("media_vpx_video_decoder_fuzzer") {
400 sources = [ "filters/vpx_video_decoder_fuzzertest.cc" ]
404 "//base/test:test_support",
406 libfuzzer_options = [ "max_len = 400000" ]
407 seed_corpus = "//media/test/data"
410 fuzzer_test("media_webm_muxer_fuzzer") {
411 sources = [ "muxers/webm_muxer_fuzzertest.cc" ]
415 "//third_party/libwebm",
419 fuzzer_test("cbcs_decryptor_fuzzer") {
420 sources = [ "cdm/cbcs_decryptor_fuzzer.cc" ]
428 fuzzer_test("cenc_decryptor_fuzzer") {
429 sources = [ "cdm/cenc_decryptor_fuzzer.cc" ]
437 fuzzer_test("json_web_key_fuzzer") {
438 sources = [ "cdm/json_web_key_fuzzer.cc" ]
445 if (proprietary_codecs) {
446 fuzzer_test("media_mp4_avcc_parser_fuzzer") {
447 sources = [ "formats/mp4/mp4_avcc_parser_fuzzer.cc" ]
454 fuzzer_test("media_mp4_box_reader_fuzzer") {
455 sources = [ "formats/mp4/mp4_box_reader_fuzzer.cc" ]
460 libfuzzer_options = [ "max_len=500" ]
461 dict = "test/mp4.dict"
465 if (enable_mse_mpeg2ts_stream_parser) {
466 fuzzer_test("media_es_parser_adts_fuzzer") {
467 sources = [ "formats/mp2t/es_parser_adts_fuzzer.cc" ]
474 fuzzer_test("media_es_parser_h264_fuzzer") {
475 sources = [ "formats/mp2t/es_parser_h264_fuzzer.cc" ]
482 fuzzer_test("media_es_parser_mpeg1audio_fuzzer") {
483 sources = [ "formats/mp2t/es_parser_mpeg1audio_fuzzer.cc" ]