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_HLS_SAMPLE_AES=$enable_hls_sample_aes",
36 "ENABLE_LIBGAV1_DECODER=$enable_libgav1_decoder",
37 "ENABLE_LIBRARY_CDMS=$enable_library_cdms",
38 "ENABLE_LIBVPX=$media_use_libvpx",
39 "ENABLE_LOGGING_OVERRIDE=$enable_logging_override",
40 "ENABLE_MEDIA_DRM_STORAGE=$enable_media_drm_storage",
41 "ENABLE_MEDIA_REMOTING=$enable_media_remoting",
42 "ENABLE_MEDIA_REMOTING_RPC=$enable_media_remoting_rpc",
43 "ENABLE_PLATFORM_MPEG_H_AUDIO=$enable_platform_mpeg_h_audio",
44 "ENABLE_MSE_MPEG2TS_STREAM_PARSER=$enable_mse_mpeg2ts_stream_parser",
45 "USE_CHROMEOS_MEDIA_ACCELERATION=$use_vaapi||$use_v4l2_codec",
46 "USE_PROPRIETARY_CODECS=$proprietary_codecs",
50 if (proprietary_codecs && media_use_ffmpeg) {
52 ffmpeg_branding != "Chromium",
53 "proprietary codecs and ffmpeg_branding set to Chromium are incompatible")
56 # Common configuration for targets in the media directory; these must not be
57 # exported since things like USE_NEON and USE_CRAS have different meanings
58 # elsewhere in the code base.
59 config("media_config") {
61 if (current_cpu == "arm64" || (current_cpu == "arm" && arm_use_neon)) {
62 defines += [ "USE_NEON" ]
65 defines += [ "USE_PULSEAUDIO" ]
66 if (!link_pulseaudio) {
67 defines += [ "DLOPEN_PULSEAUDIO" ]
71 defines += [ "USE_CRAS" ]
75 # Internal grouping of the configs necessary to support sub-folders having their
76 # own BUILD.gn files; only targets which roll up into the "media" target should
77 # include this config. I.e., not "test_support" or "unit_tests" targets.
79 # Without these configs having individual sub-folders take a //media/base DEP
80 # (or others) can yield incorrectly imported and exported symbols on Windows:
82 # fatal error LNK1169: one or more multiply defined symbols found.
84 config("subcomponent_config") {
85 visibility = media_subcomponent_deps
87 visibility += [ "//media/base/mac" ]
89 defines = [ "IS_MEDIA_IMPL" ]
92 "//build/config/compiler:wexit_time_destructors",
102 "//base/third_party/dynamic_annotations",
105 "//gpu/command_buffer/client:gles2_interface",
106 "//gpu/command_buffer/common",
107 "//third_party/libyuv",
108 "//ui/events:events_base",
115 public_configs = [ "//third_party/libwebm:libwebm_config" ]
116 public_deps = media_subcomponent_deps
119 ":shared_memory_support",
120 "//ui/gfx:color_space",
123 # This must be included here since it actually depends on //media/base.
124 if (is_mac || is_ios) {
125 public_deps += [ "//media/base/mac" ]
129 # Note: This can't be a static_library since it does not have any sources.
130 source_set("test_support") {
134 "//media/audio:test_support",
135 "//media/base:test_support",
136 "//media/base/android:test_support",
137 "//media/filters:test_support",
138 "//media/formats:test_support",
139 "//media/video:test_support",
143 # Contains tests for all targets in the "media" folder.
144 # TODO(xhwang): Move mojo/capture/remoting tests here where applicable.
145 test("media_unittests") {
147 "//media/audio:unit_tests",
148 "//media/base:unit_tests",
149 "//media/capabilities:unit_tests",
150 "//media/cdm:unit_tests",
151 "//media/device_monitors:unit_tests",
152 "//media/filters:unit_tests",
153 "//media/formats:unit_tests",
154 "//media/gpu:unit_tests",
155 "//media/learning:unit_tests",
156 "//media/mojo:unit_tests",
157 "//media/muxers:unit_tests",
158 "//media/parsers:unit_tests",
159 "//media/renderers:unit_tests",
160 "//media/test:pipeline_integration_tests",
161 "//media/test:run_all_unittests",
162 "//media/video:unit_tests",
163 "//media/webrtc:unit_tests",
166 data = [ "test/data/" ]
168 data_deps = [ "//testing/buildbot/filters:media_unittests_filters" ]
170 if (media_use_ffmpeg) {
171 deps += [ "//media/ffmpeg:unit_tests" ]
176 # The test needs the java dependencies to add the java classes for their
177 # native counterparts to the test apk.
178 "//gpu/command_buffer/service:android_texture_owner_unittests",
179 "//media/base/android:media_java",
180 "//media/base/android:unit_tests",
181 "//media/gpu:android_video_decode_accelerator_unittests",
182 "//ui/android:ui_java",
187 deps += [ "//media/fuchsia/audio:unittests" ]
190 if (enable_media_remoting) {
191 deps += [ "//media/remoting:media_remoting_tests" ]
194 # The test needs OPUS_FIXED_POINT conditional define.
195 configs += [ "//third_party/opus:opus_config" ]
198 test("media_perftests") {
199 configs += [ ":media_config" ]
202 "//base/test:test_support",
203 "//media/base:perftests",
204 "//media/filters:perftests",
205 "//media/test:pipeline_integration_perftests",
209 "//third_party/widevine/cdm:headers",
210 "//ui/gfx:test_support",
212 if (media_use_ffmpeg) {
213 # Direct dependency required to inherit config.
214 deps += [ "//third_party/ffmpeg" ]
217 # This target should not require the Chrome executable to run.
218 assert_no_deps = [ "//chrome" ]
220 data = [ "test/data/" ]
223 # Needed for isolate script to execute.
224 "//testing:run_perf_test",
228 # The audio subset of media_unittests. This target exists for running only the
229 # audio tests on the GPU bots (which have audio hardware).
230 test("audio_unittests") {
233 "//base/test:test_support",
234 "//media/audio:unit_tests",
235 "//media/test:run_all_unittests",
239 # The test needs the java dependencies to add the java classes for their
240 # native counterparts to the test apk.
241 "//media/base/android:media_java",
242 "//ui/android:ui_java",
247 # Note: Most external components should just depend on //media unless they
248 # specifically need this pared own target (NaCl, PPAPI, etc). Internal targets
249 # should just depend on //media/base which will propagate this target to them.
250 component("shared_memory_support") {
254 "base/audio_latency.cc",
255 "base/audio_latency.h",
256 "base/audio_parameters.cc",
257 "base/audio_parameters.h",
258 "base/audio_point.cc",
259 "base/audio_point.h",
260 "base/audio_sample_types.h",
261 "base/channel_layout.cc",
262 "base/channel_layout.h",
264 "base/media_shmem_export.h",
265 "base/sample_format.cc",
266 "base/sample_format.h",
267 "base/vector_math.cc",
268 "base/vector_math.h",
269 "base/vector_math_testing.h",
272 # These need to be included here because audio_latency.cc depends on them.
274 "base/mac/audio_latency_mac.cc",
275 "base/mac/audio_latency_mac.h",
279 # Do not use "subcomponent_config" here since these files are in their own
280 # component target and thus can't share the standard export macros.
281 configs += [ ":media_config" ]
282 defines = [ "MEDIA_SHMEM_IMPLEMENTATION" ]
285 configs -= [ "//build/config/compiler:default_optimization" ]
286 configs += [ "//build/config/compiler:optimize_max" ]
294 # TODO(watk): Refactor tests that could be made to run on Android. See
295 # http://crbug.com/570762
296 if (media_use_ffmpeg && !is_android) {
297 test("ffmpeg_regression_tests") {
298 configs += [ "//media:media_config" ]
302 "//base/test:test_support",
303 "//media/ffmpeg:ffmpeg_regression_tests",
304 "//media/test:pipeline_integration_tests",
305 "//media/test:run_all_unittests",
308 "//ui/gfx:test_support",
314 if (proprietary_codecs) {
315 fuzzer_test("media_cenc_utils_fuzzer") {
316 sources = [ "cdm/cenc_utils_fuzzertest.cc" ]
321 fuzzer_test("media_vp9_parser_fuzzer") {
322 sources = [ "filters/vp9_parser_fuzzertest.cc" ]
327 libfuzzer_options = [ "max_len = 400000" ]
330 fuzzer_test("media_vp9_parser_encrypted_fuzzer") {
331 sources = [ "filters/vp9_parser_encrypted_fuzzertest.cc" ]
335 "//base/test:test_support",
337 seed_corpus = "//media/test/data"
340 fuzzer_test("media_vpx_video_decoder_fuzzer") {
341 sources = [ "filters/vpx_video_decoder_fuzzertest.cc" ]
345 "//base/test:test_support",
347 libfuzzer_options = [ "max_len = 400000" ]
348 seed_corpus = "//media/test/data"
351 fuzzer_test("media_webm_muxer_fuzzer") {
352 sources = [ "muxers/webm_muxer_fuzzertest.cc" ]
356 "//third_party/libwebm",
359 if (use_efl && tizen_multimedia_support) {
360 deps += external_media_efl_deps
361 sources += external_media_efl_sources
362 sources -= external_exclude_media_efl_sources
363 configs += external_media_efl_config
367 fuzzer_test("cbcs_decryptor_fuzzer") {
368 sources = [ "cdm/cbcs_decryptor_fuzzer.cc" ]
376 fuzzer_test("cenc_decryptor_fuzzer") {
377 sources = [ "cdm/cenc_decryptor_fuzzer.cc" ]
385 fuzzer_test("json_web_key_fuzzer") {
386 sources = [ "cdm/json_web_key_fuzzer.cc" ]
393 if (proprietary_codecs) {
394 fuzzer_test("media_mp4_avcc_parser_fuzzer") {
395 sources = [ "formats/mp4/mp4_avcc_parser_fuzzer.cc" ]
402 fuzzer_test("media_mp4_box_reader_fuzzer") {
403 sources = [ "formats/mp4/mp4_box_reader_fuzzer.cc" ]
408 libfuzzer_options = [ "max_len=500" ]
409 dict = "test/mp4.dict"
413 if (enable_mse_mpeg2ts_stream_parser) {
414 fuzzer_test("media_es_parser_adts_fuzzer") {
415 sources = [ "formats/mp2t/es_parser_adts_fuzzer.cc" ]
422 fuzzer_test("media_es_parser_h264_fuzzer") {
423 sources = [ "formats/mp2t/es_parser_h264_fuzzer.cc" ]
430 fuzzer_test("media_es_parser_mpeg1audio_fuzzer") {
431 sources = [ "formats/mp2t/es_parser_mpeg1audio_fuzzer.cc" ]