1 # Copyright 2014 The Chromium Authors. All rights reserved.
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/features.gni")
9 import("//build/config/linux/pkg_config.gni")
10 import("//build/config/ui.gni")
11 import("//media/cdm/library_cdm/cdm_paths.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")
17 import("//tizen_src/chromium_impl/media/media_efl.gni")
20 buildflag_header("media_buildflags") {
21 header = "media_buildflags.h"
24 "ALTERNATE_CDM_STORAGE_ID_KEY=\"$alternate_cdm_storage_id_key\"",
25 "CDM_PLATFORM_SPECIFIC_PATH=\"$cdm_platform_specific_path\"",
26 "ENABLE_PLATFORM_AC3_EAC3_AUDIO=$enable_platform_ac3_eac3_audio",
27 "ENABLE_CDM_HOST_VERIFICATION=$enable_cdm_host_verification",
28 "ENABLE_CDM_STORAGE_ID=$enable_cdm_storage_id",
29 "ENABLE_DAV1D_DECODER=$enable_dav1d_decoder",
30 "ENABLE_AV1_DECODER=$enable_av1_decoder",
31 "ENABLE_PLATFORM_DOLBY_VISION=$enable_platform_dolby_vision",
32 "ENABLE_FFMPEG=$media_use_ffmpeg",
33 "ENABLE_FFMPEG_VIDEO_DECODERS=$enable_ffmpeg_video_decoders",
34 "ENABLE_PLATFORM_HEVC=$enable_platform_hevc",
35 "ENABLE_PLATFORM_HEVC_DECODING=$enable_platform_hevc_decoding",
36 "ENABLE_PLATFORM_ENCRYPTED_HEVC=$enable_platform_encrypted_hevc",
37 "ENABLE_HLS_SAMPLE_AES=$enable_hls_sample_aes",
38 "ENABLE_LIBGAV1_DECODER=$enable_libgav1_decoder",
39 "ENABLE_LIBRARY_CDMS=$enable_library_cdms",
40 "ENABLE_LIBVPX=$media_use_libvpx",
41 "ENABLE_LOGGING_OVERRIDE=$enable_logging_override",
42 "ENABLE_MEDIA_DRM_STORAGE=$enable_media_drm_storage",
43 "ENABLE_MEDIA_REMOTING=$enable_media_remoting",
44 "ENABLE_MEDIA_REMOTING_RPC=$enable_media_remoting_rpc",
45 "ENABLE_OPENH264=$media_use_openh264",
46 "ENABLE_PLATFORM_MPEG_H_AUDIO=$enable_platform_mpeg_h_audio",
47 "ENABLE_MSE_MPEG2TS_STREAM_PARSER=$enable_mse_mpeg2ts_stream_parser",
48 "ENABLE_CAST_STREAMING_RENDERER=$enable_cast_streaming_renderer",
49 "USE_CHROMEOS_MEDIA_ACCELERATION=$use_vaapi||$use_v4l2_codec",
50 "USE_CHROMEOS_PROTECTED_AV1=$use_chromeos_protected_av1",
51 "USE_CHROMEOS_PROTECTED_MEDIA=$use_chromeos_protected_media",
52 "USE_PROPRIETARY_CODECS=$proprietary_codecs",
56 if (proprietary_codecs && media_use_ffmpeg) {
58 ffmpeg_branding != "Chromium",
59 "proprietary codecs and ffmpeg_branding set to Chromium are incompatible")
62 # Common configuration for targets in the media directory; these must not be
63 # exported since things like USE_NEON and USE_CRAS have different meanings
64 # elsewhere in the code base.
65 config("media_config") {
67 if (current_cpu == "arm64" || (current_cpu == "arm" && arm_use_neon)) {
68 defines += [ "USE_NEON" ]
71 defines += [ "USE_PULSEAUDIO" ]
72 if (!link_pulseaudio) {
73 defines += [ "DLOPEN_PULSEAUDIO" ]
77 defines += [ "USE_CRAS" ]
81 # Internal grouping of the configs necessary to support sub-folders having their
82 # own BUILD.gn files; only targets which roll up into the "media" target should
83 # include this config. I.e., not "test_support" or "unit_tests" targets.
85 # Without these configs having individual sub-folders take a //media/base DEP
86 # (or others) can yield incorrectly imported and exported symbols on Windows:
88 # fatal error LNK1169: one or more multiply defined symbols found.
90 config("subcomponent_config") {
91 visibility = media_subcomponent_deps
93 visibility += [ "//media/base/mac" ]
95 defines = [ "IS_MEDIA_IMPL" ]
98 "//build/config/compiler:wexit_time_destructors",
108 "//base/third_party/dynamic_annotations",
111 "//gpu/command_buffer/client:gles2_interface",
112 "//gpu/command_buffer/common",
113 "//third_party/libyuv",
114 "//ui/events:events_base",
121 public_configs = [ "//third_party/libwebm:libwebm_config" ]
122 public_deps = media_subcomponent_deps
125 ":shared_memory_support",
126 "//ui/gfx:color_space",
129 # This must be included here since it actually depends on //media/base.
131 public_deps += [ "//media/base/mac" ]
135 deps += [ "//ui/base/x" ]
138 deps += [ "//ui/ozone" ]
142 # Note: This can't be a static_library since it does not have any sources.
143 source_set("test_support") {
147 "//media/audio:test_support",
148 "//media/base:test_support",
149 "//media/base/android:test_support",
150 "//media/filters:test_support",
151 "//media/formats:test_support",
152 "//media/renderers:test_support",
153 "//media/video:test_support",
157 # Contains tests for all targets in the "media" folder.
158 # TODO(xhwang): Move mojo/capture/remoting tests here where applicable.
159 test("media_unittests") {
160 use_xvfb = use_xvfb_in_this_config
163 "//media/audio:unit_tests",
164 "//media/base:unit_tests",
165 "//media/capabilities:unit_tests",
166 "//media/cast/receiver:unit_tests",
167 "//media/cdm:unit_tests",
168 "//media/device_monitors:unit_tests",
169 "//media/filters:unit_tests",
170 "//media/formats:unit_tests",
171 "//media/gpu:unit_tests",
172 "//media/learning:unit_tests",
173 "//media/mojo:unit_tests",
174 "//media/muxers:unit_tests",
175 "//media/parsers:unit_tests",
176 "//media/renderers:unit_tests",
177 "//media/test:pipeline_integration_tests",
178 "//media/test:run_all_unittests",
179 "//media/video:unit_tests",
180 "//media/webrtc:unit_tests",
185 "formats/mp4/h264_annex_b_fuzz_corpus/",
188 data_deps = [ "//testing/buildbot/filters:media_unittests_filters" ]
190 if (media_use_ffmpeg) {
191 deps += [ "//media/ffmpeg:unit_tests" ]
196 # The test needs the java dependencies to add the java classes for their
197 # native counterparts to the test apk.
198 "//gpu/command_buffer/service:android_texture_owner_unittests",
199 "//media/base/android:media_java",
200 "//media/base/android:unit_tests",
201 "//media/gpu:android_video_decode_accelerator_unittests",
202 "//ui/android:ui_java",
208 "//media/fuchsia/audio:unittests",
209 "//media/fuchsia/cdm/service:unittests",
212 additional_manifest_fragments = [
213 "//build/config/fuchsia/test/audio_capabilities.test-cmx",
215 # TODO(crbug.com/1185811): Figure out why
216 # PaintCanvasVideoRendererWithGLTest.CopyVideoFrameYUVDataToGLTexture
217 # crashes without "deprecated-ambient-replace-as-executable".
218 "//build/config/fuchsia/test/jit_capabilities.test-cmx",
220 "//build/config/fuchsia/test/vulkan_capabilities.test-cmx",
224 if (enable_media_remoting) {
225 deps += [ "//media/remoting:media_remoting_tests" ]
228 # The test needs OPUS_FIXED_POINT conditional define.
229 configs += [ "//third_party/opus:opus_config" ]
232 test("media_perftests") {
233 configs += [ ":media_config" ]
236 "//base/test:test_support",
237 "//media/base:perftests",
238 "//media/filters:perftests",
239 "//media/test:pipeline_integration_perftests",
243 "//third_party/widevine/cdm:headers",
244 "//ui/gfx:test_support",
246 if (media_use_ffmpeg) {
247 # Direct dependency required to inherit config.
248 deps += [ "//third_party/ffmpeg" ]
251 # This target should not require the Chrome executable to run.
252 assert_no_deps = [ "//chrome" ]
254 data = [ "test/data/" ]
257 # Needed for isolate script to execute.
258 "//testing:run_perf_test",
262 # The audio subset of media_unittests. This target exists for running only the
263 # audio tests on the GPU bots (which have audio hardware).
264 test("audio_unittests") {
267 "//base/test:test_support",
268 "//media/audio:unit_tests",
269 "//media/test:run_all_unittests",
273 # The test needs the java dependencies to add the java classes for their
274 # native counterparts to the test apk.
275 "//media/base/android:media_java",
276 "//ui/android:ui_java",
281 # Note: Most external components should just depend on //media unless they
282 # specifically need this pared own target (NaCl, PPAPI, etc). Internal targets
283 # should just depend on //media/base which will propagate this target to them.
284 component("shared_memory_support") {
288 "base/audio_latency.cc",
289 "base/audio_latency.h",
290 "base/audio_parameters.cc",
291 "base/audio_parameters.h",
292 "base/audio_point.cc",
293 "base/audio_point.h",
294 "base/audio_sample_types.h",
295 "base/channel_layout.cc",
296 "base/channel_layout.h",
298 "base/media_shmem_export.h",
299 "base/sample_format.cc",
300 "base/sample_format.h",
301 "base/vector_math.cc",
302 "base/vector_math.h",
303 "base/vector_math_testing.h",
304 "base/video_types.cc",
305 "base/video_types.h",
308 # These need to be included here because audio_latency.cc depends on them.
310 "base/mac/audio_latency_mac.cc",
311 "base/mac/audio_latency_mac.h",
315 # Do not use "subcomponent_config" here since these files are in their own
316 # component target and thus can't share the standard export macros.
317 configs += [ ":media_config" ]
318 defines = [ "MEDIA_SHMEM_IMPLEMENTATION" ]
321 configs -= [ "//build/config/compiler:default_optimization" ]
322 configs += [ "//build/config/compiler:optimize_max" ]
326 "//build:chromeos_buildflags",
331 # TODO(watk): Refactor tests that could be made to run on Android. See
332 # http://crbug.com/570762
333 if (media_use_ffmpeg && !is_android) {
334 test("ffmpeg_regression_tests") {
335 configs += [ "//media:media_config" ]
339 "//base/test:test_support",
340 "//media/ffmpeg:ffmpeg_regression_tests",
341 "//media/test:pipeline_integration_tests",
342 "//media/test:run_all_unittests",
345 "//ui/gfx:test_support",
351 if (proprietary_codecs) {
352 fuzzer_test("media_cenc_utils_fuzzer") {
353 sources = [ "cdm/cenc_utils_fuzzertest.cc" ]
358 fuzzer_test("media_vp9_parser_fuzzer") {
359 sources = [ "filters/vp9_parser_fuzzertest.cc" ]
364 libfuzzer_options = [ "max_len = 400000" ]
367 fuzzer_test("media_vp9_parser_encrypted_fuzzer") {
368 sources = [ "filters/vp9_parser_encrypted_fuzzertest.cc" ]
372 "//base/test:test_support",
374 seed_corpus = "//media/test/data"
377 fuzzer_test("media_vpx_video_decoder_fuzzer") {
378 sources = [ "filters/vpx_video_decoder_fuzzertest.cc" ]
382 "//base/test:test_support",
384 libfuzzer_options = [ "max_len = 400000" ]
385 seed_corpus = "//media/test/data"
388 fuzzer_test("media_webm_muxer_fuzzer") {
389 sources = [ "muxers/webm_muxer_fuzzertest.cc" ]
393 "//third_party/libwebm",
396 if (use_efl && tizen_multimedia_support) {
397 deps += external_media_efl_deps
398 sources += external_media_efl_sources
399 sources -= external_exclude_media_efl_sources
400 configs += external_media_efl_config
404 fuzzer_test("cbcs_decryptor_fuzzer") {
405 sources = [ "cdm/cbcs_decryptor_fuzzer.cc" ]
413 fuzzer_test("cenc_decryptor_fuzzer") {
414 sources = [ "cdm/cenc_decryptor_fuzzer.cc" ]
422 fuzzer_test("json_web_key_fuzzer") {
423 sources = [ "cdm/json_web_key_fuzzer.cc" ]
430 if (proprietary_codecs) {
431 fuzzer_test("media_mp4_avcc_parser_fuzzer") {
432 sources = [ "formats/mp4/mp4_avcc_parser_fuzzer.cc" ]
439 fuzzer_test("media_mp4_box_reader_fuzzer") {
440 sources = [ "formats/mp4/mp4_box_reader_fuzzer.cc" ]
445 libfuzzer_options = [ "max_len=500" ]
446 dict = "test/mp4.dict"
450 if (enable_mse_mpeg2ts_stream_parser) {
451 fuzzer_test("media_es_parser_adts_fuzzer") {
452 sources = [ "formats/mp2t/es_parser_adts_fuzzer.cc" ]
459 fuzzer_test("media_es_parser_h264_fuzzer") {
460 sources = [ "formats/mp2t/es_parser_h264_fuzzer.cc" ]
467 fuzzer_test("media_es_parser_mpeg1audio_fuzzer") {
468 sources = [ "formats/mp2t/es_parser_mpeg1audio_fuzzer.cc" ]