[M108 Aura Migration] Setting demuxer memory limit
[platform/framework/web/chromium-efl.git] / media / base / BUILD.gn
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/android/config.gni")
6 import("//build/config/arm.gni")
7 import("//build/config/features.gni")
8 import("//build/config/linux/pkg_config.gni")
9 import("//build/config/ozone.gni")
10 import("//build/config/ui.gni")
11 import("//media/media_options.gni")
12 import("//testing/libfuzzer/fuzzer_test.gni")
13
14 if (is_android) {
15   import("//build/config/android/rules.gni")
16 }
17
18 source_set("base") {
19   # Do not expand the visibility here without double-checking with OWNERS, this
20   # is a roll-up target which is part of the //media component. Most other DEPs
21   # should be using //media and not directly DEP this roll-up target.
22   visibility = media_subcomponent_deps
23   visibility += [ "//media" ]
24
25   if (!enable_library_cdms) {
26     # cdm_type_conversion is not part of media_subcomponent_deps.
27     visibility += [ "//media/cdm:cdm_type_conversion" ]
28   }
29
30   # TODO(dalecurtis): Replace this with empty targets on non-mac so
31   # we can just include //media/base/mac in media_subcomponent_deps.
32   if (is_apple) {
33     visibility += [ "//media/base/mac" ]
34   }
35
36   if (is_android) {
37     visibility +=
38         [ "//gpu/command_buffer/service:android_texture_owner_unittests" ]
39   }
40
41   sources = [
42     "android_overlay_config.cc",
43     "android_overlay_config.h",
44     "android_overlay_mojo_factory.h",
45     "async_destroy_video_decoder.h",
46     "async_destroy_video_encoder.h",
47     "audio_block_fifo.cc",
48     "audio_block_fifo.h",
49     "audio_buffer.cc",
50     "audio_buffer.h",
51     "audio_buffer_converter.cc",
52     "audio_buffer_converter.h",
53     "audio_buffer_queue.cc",
54     "audio_buffer_queue.h",
55     "audio_capturer_source.h",
56     "audio_codecs.cc",
57     "audio_codecs.h",
58     "audio_converter.cc",
59     "audio_converter.h",
60     "audio_decoder.cc",
61     "audio_decoder.h",
62     "audio_decoder_config.cc",
63     "audio_decoder_config.h",
64     "audio_discard_helper.cc",
65     "audio_discard_helper.h",
66     "audio_encoder.cc",
67     "audio_encoder.h",
68     "audio_fifo.cc",
69     "audio_fifo.h",
70     "audio_hash.cc",
71     "audio_hash.h",
72     "audio_power_monitor.cc",
73     "audio_power_monitor.h",
74     "audio_processing.cc",
75     "audio_processing.h",
76     "audio_processor_controls.h",
77     "audio_pull_fifo.cc",
78     "audio_pull_fifo.h",
79     "audio_push_fifo.cc",
80     "audio_push_fifo.h",
81     "audio_renderer.cc",
82     "audio_renderer.h",
83     "audio_renderer_mixer.cc",
84     "audio_renderer_mixer.h",
85     "audio_renderer_mixer_input.cc",
86     "audio_renderer_mixer_input.h",
87     "audio_renderer_mixer_pool.h",
88     "audio_renderer_sink.h",
89     "audio_shifter.cc",
90     "audio_shifter.h",
91     "audio_timestamp_helper.cc",
92     "audio_timestamp_helper.h",
93     "bind_to_current_loop.h",
94     "bit_reader.cc",
95     "bit_reader.h",
96     "bit_reader_core.cc",
97     "bit_reader_core.h",
98     "bitrate.cc",
99     "bitrate.h",
100     "bitstream_buffer.cc",
101     "bitstream_buffer.h",
102     "buffering_state.cc",
103     "buffering_state.h",
104     "byte_queue.cc",
105     "byte_queue.h",
106     "callback_holder.h",
107     "callback_registry.h",
108     "cdm_callback_promise.cc",
109     "cdm_callback_promise.h",
110     "cdm_config.cc",
111     "cdm_config.h",
112     "cdm_context.cc",
113     "cdm_context.h",
114     "cdm_factory.cc",
115     "cdm_factory.h",
116     "cdm_initialized_promise.cc",
117     "cdm_initialized_promise.h",
118     "cdm_key_information.cc",
119     "cdm_key_information.h",
120     "cdm_promise.cc",
121     "cdm_promise.h",
122     "cdm_promise_adapter.cc",
123     "cdm_promise_adapter.h",
124     "cdm_session_tracker.cc",
125     "cdm_session_tracker.h",
126     "channel_mixer.cc",
127     "channel_mixer.h",
128     "channel_mixing_matrix.cc",
129     "channel_mixing_matrix.h",
130     "color_plane_layout.cc",
131     "color_plane_layout.h",
132     "container_names.cc",
133     "container_names.h",
134     "content_decryption_module.cc",
135     "content_decryption_module.h",
136     "converting_audio_fifo.cc",
137     "converting_audio_fifo.h",
138     "crc_16.h",
139     "data_buffer.cc",
140     "data_buffer.h",
141     "data_source.cc",
142     "data_source.h",
143     "decoder.cc",
144     "decoder.h",
145     "decoder_buffer.cc",
146     "decoder_buffer.h",
147     "decoder_buffer_queue.cc",
148     "decoder_buffer_queue.h",
149     "decoder_factory.cc",
150     "decoder_factory.h",
151     "decoder_status.cc",
152     "decoder_status.h",
153     "decrypt_config.cc",
154     "decrypt_config.h",
155     "decryptor.cc",
156     "decryptor.h",
157     "demuxer.cc",
158     "demuxer.h",
159     "demuxer_memory_limit.h",
160     "demuxer_stream.cc",
161     "demuxer_stream.h",
162     "djb2.cc",
163     "djb2.h",
164     "eme_constants.h",
165     "encoder_status.h",
166     "encryption_pattern.cc",
167     "encryption_pattern.h",
168     "encryption_scheme.cc",
169     "encryption_scheme.h",
170     "fake_audio_worker.cc",
171     "fake_audio_worker.h",
172     "feedback_signal_accumulator.h",
173     "flinging_controller.h",
174     "format_utils.cc",
175     "format_utils.h",
176     "frame_rate_estimator.cc",
177     "frame_rate_estimator.h",
178     "key_system_info.cc",
179     "key_system_info.h",
180     "key_system_names.cc",
181     "key_system_names.h",
182     "key_systems.cc",
183     "key_systems.h",
184     "localized_strings.cc",
185     "localized_strings.h",
186     "logging_override_if_enabled.h",
187     "loopback_audio_converter.cc",
188     "loopback_audio_converter.h",
189     "media.cc",
190     "media.h",
191     "media_client.cc",
192     "media_client.h",
193     "media_content_type.cc",
194     "media_content_type.h",
195     "media_controller.h",
196     "media_export.h",
197     "media_log.cc",
198     "media_log.h",
199     "media_log_events.cc",
200     "media_log_events.h",
201     "media_log_message_levels.cc",
202     "media_log_message_levels.h",
203     "media_log_properties.cc",
204     "media_log_properties.h",
205     "media_log_record.h",
206     "media_log_type_enforcement.h",
207     "media_observer.cc",
208     "media_observer.h",
209     "media_permission.cc",
210     "media_permission.h",
211     "media_player_logging_id.cc",
212     "media_player_logging_id.h",
213     "media_resource.cc",
214     "media_resource.h",
215     "media_serializers.h",
216     "media_serializers_base.h",
217     "media_status.cc",
218     "media_status.h",
219     "media_status_observer.h",
220     "media_switches.cc",
221     "media_switches.h",
222     "media_track.cc",
223     "media_track.h",
224     "media_tracks.cc",
225     "media_tracks.h",
226     "media_types.cc",
227     "media_types.h",
228     "media_url_demuxer.cc",
229     "media_url_demuxer.h",
230     "media_url_params.cc",
231     "media_url_params.h",
232     "media_util.cc",
233     "media_util.h",
234     "memory_dump_provider_proxy.cc",
235     "memory_dump_provider_proxy.h",
236     "mime_util.cc",
237     "mime_util.h",
238     "mime_util_internal.cc",
239     "mime_util_internal.h",
240     "moving_average.cc",
241     "moving_average.h",
242     "multi_channel_resampler.cc",
243     "multi_channel_resampler.h",
244     "null_video_sink.cc",
245     "null_video_sink.h",
246     "offloading_audio_encoder.cc",
247     "offloading_audio_encoder.h",
248     "offloading_video_encoder.cc",
249     "offloading_video_encoder.h",
250     "output_device_info.cc",
251     "output_device_info.h",
252     "overlay_info.cc",
253     "overlay_info.h",
254     "pipeline.h",
255     "pipeline_impl.cc",
256     "pipeline_impl.h",
257     "pipeline_metadata.cc",
258     "pipeline_metadata.h",
259     "pipeline_status.cc",
260     "pipeline_status.h",
261     "provision_fetcher.h",
262     "ranges.cc",
263     "ranges.h",
264     "reentrancy_checker.cc",
265     "reentrancy_checker.h",
266     "renderer.cc",
267     "renderer.h",
268     "renderer_client.cc",
269     "renderer_client.h",
270     "renderer_factory.cc",
271     "renderer_factory.h",
272     "renderer_factory_selector.cc",
273     "renderer_factory_selector.h",
274     "routing_token_callback.h",
275     "sample_rates.cc",
276     "sample_rates.h",
277     "scoped_async_trace.cc",
278     "scoped_async_trace.h",
279     "seekable_buffer.cc",
280     "seekable_buffer.h",
281     "serial_runner.cc",
282     "serial_runner.h",
283     "silent_sink_suspender.cc",
284     "silent_sink_suspender.h",
285     "simple_sync_token_client.cc",
286     "simple_sync_token_client.h",
287     "simple_watch_timer.cc",
288     "simple_watch_timer.h",
289     "sinc_resampler.cc",
290     "sinc_resampler.h",
291     "status.cc",
292     "status.h",
293     "stream_parser.cc",
294     "stream_parser.h",
295     "stream_parser_buffer.cc",
296     "stream_parser_buffer.h",
297     "subsample_entry.cc",
298     "subsample_entry.h",
299     "supported_types.cc",
300     "supported_types.h",
301     "supported_video_decoder_config.cc",
302     "supported_video_decoder_config.h",
303     "svc_scalability_mode.cc",
304     "svc_scalability_mode.h",
305     "text_cue.cc",
306     "text_cue.h",
307     "text_ranges.cc",
308     "text_ranges.h",
309     "text_renderer.cc",
310     "text_renderer.h",
311     "text_track.h",
312     "text_track_config.cc",
313     "text_track_config.h",
314     "time_delta_interpolator.cc",
315     "time_delta_interpolator.h",
316     "time_source.h",
317     "timestamp_constants.h",
318     "tuneable.cc",
319     "tuneable.h",
320     "use_after_free_checker.h",
321     "user_input_monitor.cc",
322     "user_input_monitor.h",
323     "video_aspect_ratio.cc",
324     "video_aspect_ratio.h",
325     "video_bitrate_allocation.cc",
326     "video_bitrate_allocation.h",
327     "video_codecs.cc",
328     "video_codecs.h",
329     "video_color_space.cc",
330     "video_color_space.h",
331     "video_decoder.cc",
332     "video_decoder.h",
333     "video_decoder_config.cc",
334     "video_decoder_config.h",
335     "video_encoder.cc",
336     "video_encoder.h",
337     "video_frame.cc",
338     "video_frame.h",
339     "video_frame_layout.cc",
340     "video_frame_layout.h",
341     "video_frame_metadata.cc",
342     "video_frame_metadata.h",
343     "video_frame_pool.cc",
344     "video_frame_pool.h",
345     "video_renderer.cc",
346     "video_renderer.h",
347     "video_thumbnail_decoder.cc",
348     "video_thumbnail_decoder.h",
349     "video_transformation.cc",
350     "video_transformation.h",
351     "video_util.cc",
352     "video_util.h",
353     "wait_and_replace_sync_token_client.cc",
354     "wait_and_replace_sync_token_client.h",
355     "waiting.h",
356     "wall_clock_time_source.cc",
357     "wall_clock_time_source.h",
358     "watch_time_keys.cc",
359     "watch_time_keys.h",
360     "webvtt_util.h",
361   ]
362
363   defines = []
364   public_deps = [
365     ":video_facing",
366     "//media:media_buildflags",
367     "//media:shared_memory_support",
368     "//media/gpu:buildflags",
369     "//ui/gfx:color_space",
370     "//ui/gl",
371   ]
372   deps = [
373     "//base",
374     "//base/allocator:buildflags",
375     "//build:chromeos_buildflags",
376     "//components/system_media_controls/linux/buildflags",
377     "//gpu/command_buffer/client:interface_base",
378     "//gpu/command_buffer/client:raster_interface",
379     "//gpu/command_buffer/common",
380     "//gpu/ipc/common:common",
381     "//net",
382     "//skia",
383     "//third_party/libyuv",
384     "//third_party/widevine/cdm:headers",
385     "//ui/display:display",
386     "//ui/events:events",
387     "//ui/events:events_base",
388     "//ui/events:keyboard_hook",
389     "//url:url",
390   ]
391
392   libs = []
393   configs += [
394     "//build/config:precompiled_headers",
395
396     "//media:subcomponent_config",
397   ]
398
399   if (media_use_ffmpeg) {
400     deps += [
401       "//third_party/ffmpeg",
402       "//third_party/ffmpeg:ffmpeg_features",
403     ]
404   }
405
406   if (is_chromeos_ash) {
407     deps += [ "//ash/constants" ]
408   }
409
410   if (media_use_libvpx) {
411     deps += [ "//third_party/libvpx" ]
412   }
413
414   if (is_linux && !is_castos) {
415     sources += [ "user_input_monitor_linux.cc" ]
416   } else if (is_mac) {
417     sources += [ "user_input_monitor_mac.cc" ]
418     frameworks = [
419       "CoreVideo.framework",
420       "CoreFoundation.framework",
421       "CoreGraphics.framework",
422       "IOSurface.framework",
423     ]
424   } else if (is_win) {
425     sources += [ "user_input_monitor_win.cc" ]
426   } else {
427     defines += [ "DISABLE_USER_INPUT_MONITOR" ]
428   }
429   if (use_ozone) {
430     deps += [ "//ui/ozone" ]
431   }
432
433   # Note: should also work on is_posix || is_fuchsia
434   if (is_linux || is_tizen || is_chromeos) {
435     sources += [
436       "scopedfd_helper.cc",
437       "scopedfd_helper.h",
438     ]
439   }
440
441   if (is_win) {
442     public_deps += [
443       "//media/base/win:dcomp_texture_wrapper",
444       "//media/base/win:mf_cdm_proxy",
445       "//media/base/win:overlay_state_observer_subscription",
446     ]
447     sources += [
448       "win/mf_feature_checks.cc",
449       "win/mf_feature_checks.h",
450     ]
451   }
452
453   if (is_android) {
454     sources += [ "demuxer_memory_limit_android.cc" ]
455   } else if (is_castos) {
456     sources += [ "demuxer_memory_limit_cast.cc" ]
457   } else if (tizen_product_tv) {
458     sources += [ "demuxer_memory_limit_product_tv.cc" ]
459   } else if (is_fuchsia || tizen_multimedia) {
460     sources += [ "demuxer_memory_limit_low.cc" ]
461   } else {
462     sources += [ "demuxer_memory_limit_default.cc" ]
463   }
464
465   if (!is_android) {
466     sources += [ "speech_recognition_client.h" ]
467   }
468
469   if (enable_media_drm_storage) {
470     sources += [
471       "media_drm_key_type.h",
472       "media_drm_storage.cc",
473       "media_drm_storage.h",
474     ]
475   }
476 }
477
478 source_set("video_facing") {
479   sources = [ "video_facing.h" ]
480 }
481
482 if (is_android) {
483   java_cpp_enum("java_enums") {
484     sources = [
485       "audio_parameters.h",
486       "container_names.h",
487       "encryption_scheme.h",
488       "video_codecs.h",
489     ]
490   }
491 }
492
493 # Note: Only specific internal targets that roll up into the //media component
494 # should depend on this, external targets should use //media:test_support.
495 static_library("test_support") {
496   visibility = [
497     "//media:test_support",
498     "//media/audio:test_support",
499     "//media/base/android:test_support",
500     "//media/filters:test_support",
501     "//media/formats:test_support",
502     "//media/renderers:test_support",
503     "//media/video:test_support",
504   ]
505   testonly = true
506   sources = [
507     "fake_audio_render_callback.cc",
508     "fake_audio_render_callback.h",
509     "fake_audio_renderer_sink.cc",
510     "fake_audio_renderer_sink.h",
511     "fake_demuxer_stream.cc",
512     "fake_demuxer_stream.h",
513     "fake_localized_strings.cc",
514     "fake_localized_strings.h",
515     "fake_single_thread_task_runner.cc",
516     "fake_single_thread_task_runner.h",
517     "fake_text_track_stream.cc",
518     "fake_text_track_stream.h",
519     "mock_audio_renderer_sink.cc",
520     "mock_audio_renderer_sink.h",
521     "mock_demuxer_host.cc",
522     "mock_demuxer_host.h",
523     "mock_filters.cc",
524     "mock_filters.h",
525     "mock_media_log.cc",
526     "mock_media_log.h",
527     "mock_video_renderer_sink.cc",
528     "mock_video_renderer_sink.h",
529     "test_data_util.cc",
530     "test_data_util.h",
531     "test_helpers.cc",
532     "test_helpers.h",
533     "test_random.h",
534   ]
535   configs += [ "//media:media_config" ]
536
537   # Do not add any other //media deps except this; this ensures other
538   # test_support targets all use the same //media component to avoid duplicate
539   # and undefined symbol issues on Windows.
540   public_deps = [ "//media" ]
541
542   deps = [
543     "//base",
544     "//base/test:test_support",
545     "//build:chromeos_buildflags",
546     "//testing/gmock",
547     "//ui/gfx:test_support",
548     "//url",
549   ]
550
551   if (is_win) {
552     public_deps += [ "//media/base/win:test_support" ]
553   }
554 }
555
556 source_set("unit_tests") {
557   testonly = true
558   sources = [
559     "audio_block_fifo_unittest.cc",
560     "audio_buffer_converter_unittest.cc",
561     "audio_buffer_queue_unittest.cc",
562     "audio_buffer_unittest.cc",
563     "audio_bus_unittest.cc",
564     "audio_converter_unittest.cc",
565     "audio_discard_helper_unittest.cc",
566     "audio_fifo_unittest.cc",
567     "audio_hash_unittest.cc",
568     "audio_latency_unittest.cc",
569     "audio_parameters_unittest.cc",
570     "audio_point_unittest.cc",
571     "audio_power_monitor_unittest.cc",
572     "audio_pull_fifo_unittest.cc",
573     "audio_push_fifo_unittest.cc",
574     "audio_renderer_mixer_input_unittest.cc",
575     "audio_renderer_mixer_unittest.cc",
576     "audio_sample_types_unittest.cc",
577     "audio_shifter_unittest.cc",
578     "audio_timestamp_helper_unittest.cc",
579     "bit_reader_unittest.cc",
580     "bitrate_unittest.cc",
581     "callback_holder_unittest.cc",
582     "callback_registry_unittest.cc",
583     "channel_mixer_unittest.cc",
584     "channel_mixing_matrix_unittest.cc",
585     "container_names_unittest.cc",
586     "converting_audio_fifo_unittest.cc",
587     "crc_16_unittest.cc",
588     "data_buffer_unittest.cc",
589     "decoder_buffer_queue_unittest.cc",
590     "decoder_buffer_unittest.cc",
591     "decrypt_config_unittest.cc",
592     "djb2_unittest.cc",
593     "fake_audio_worker_unittest.cc",
594     "fake_demuxer_stream_unittest.cc",
595     "feedback_signal_accumulator_unittest.cc",
596     "frame_rate_estimator_unittest.cc",
597     "key_systems_unittest.cc",
598     "media_log_unittest.cc",
599     "media_serializers_unittest.cc",
600     "media_url_demuxer_unittest.cc",
601     "mime_util_unittest.cc",
602     "moving_average_unittest.cc",
603     "multi_channel_resampler_unittest.cc",
604     "null_video_sink_unittest.cc",
605     "offloading_audio_encoder_unittest.cc",
606     "offloading_video_encoder_unittest.cc",
607     "pipeline_impl_unittest.cc",
608     "ranges_unittest.cc",
609     "reentrancy_checker_unittest.cc",
610     "renderer_factory_selector_unittest.cc",
611     "seekable_buffer_unittest.cc",
612     "serial_runner_unittest.cc",
613     "silent_sink_suspender_unittest.cc",
614     "sinc_resampler_unittest.cc",
615     "status_unittest.cc",
616     "stream_parser_unittest.cc",
617     "subsample_entry_unittest.cc",
618     "supported_types_unittest.cc",
619     "supported_video_decoder_config_unittest.cc",
620     "text_ranges_unittest.cc",
621     "text_renderer_unittest.cc",
622     "time_delta_interpolator_unittest.cc",
623     "tuneable_unittest.cc",
624     "user_input_monitor_unittest.cc",
625     "vector_math_unittest.cc",
626     "video_aspect_ratio_unittest.cc",
627     "video_bitrate_allocation_unittest.cc",
628     "video_codecs_unittest.cc",
629     "video_color_space_unittest.cc",
630     "video_decoder_config_unittest.cc",
631     "video_frame_layout_unittest.cc",
632     "video_frame_pool_unittest.cc",
633     "video_frame_unittest.cc",
634     "video_thumbnail_decoder_unittest.cc",
635     "video_transformation_unittest.cc",
636     "video_types_unittest.cc",
637     "video_util_unittest.cc",
638     "wall_clock_time_source_unittest.cc",
639   ]
640   configs += [ "//media:media_config" ]
641   deps = [
642     "//base/test:test_support",
643     "//build:chromeos_buildflags",
644     "//components/viz/common",
645     "//gpu/command_buffer/common",
646     "//media:test_support",
647     "//net",
648     "//testing/gmock",
649     "//testing/gtest",
650     "//third_party/libyuv",
651     "//third_party/widevine/cdm:headers",
652     "//ui/gfx",
653   ]
654
655   if (is_apple) {
656     deps += [ "//media/base/mac:unit_tests" ]
657   }
658
659   if (is_win) {
660     sources += [ "win/dxgi_device_scope_handle_unittest.cc" ]
661     deps += [
662       "//media/base/win:media_foundation_util",
663       "//ui/events:test_support",
664     ]
665     libs = [
666       "d3d11.lib",
667       "mfplat.lib",
668     ]
669   }
670
671   if (is_castos) {
672     sources += [ "demuxer_memory_limit_cast_unittest.cc" ]
673   }
674 }
675
676 source_set("perftests") {
677   testonly = true
678   sources = [
679     "audio_bus_perftest.cc",
680     "audio_converter_perftest.cc",
681     "run_all_perftests.cc",
682     "sinc_resampler_perftest.cc",
683     "vector_math_perftest.cc",
684   ]
685   configs += [ "//media:media_config" ]
686   deps = [
687     "//base",
688     "//base/test:test_support",
689     "//media:test_support",
690     "//testing/gmock",
691     "//testing/gtest",
692     "//testing/perf",
693   ]
694 }
695
696 fuzzer_test("media_bit_reader_fuzzer") {
697   sources = [ "bit_reader_fuzzertest.cc" ]
698   deps = [
699     "//base",
700     "//media:test_support",
701   ]
702 }
703
704 fuzzer_test("media_container_names_fuzzer") {
705   sources = [ "container_names_fuzzertest.cc" ]
706   deps = [
707     "//base",
708     "//media:test_support",
709   ]
710 }