[Telemetry] Move tab garbage collection to WillNavigateToPage.
[chromium-blink-merge.git] / media / BUILD.gn
blob744dab9cd88b10e6292a40b935094df2bd18c916
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/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/ui.gni")
10 import("//media/media_options.gni")
11 import("//testing/test.gni")
13 # Common configuration for targets in the media directory.
14 # NOT for exporting.
15 config("media_config") {
16   defines = []
17   if (!media_use_libvpx) {
18     defines += [ "MEDIA_DISABLE_LIBVPX" ]
19   }
20   if (!media_use_ffmpeg) {
21     defines += [ "MEDIA_DISABLE_FFMPEG" ]
22   }
23   if (current_cpu == "arm" && arm_use_neon) {
24     defines += [ "USE_NEON" ]
25   }
26   if (use_pulseaudio) {
27     defines += [ "USE_PULSEAUDIO" ]
28     if (!link_pulseaudio) {
29       defines += [ "DLOPEN_PULSEAUDIO" ]
30     }
31   }
32   if (use_cras) {
33     defines += [ "USE_CRAS" ]
34   }
37 config("media_implementation") {
38   defines = [ "MEDIA_IMPLEMENTATION" ]
41 config("media_dependent_config") {
42   defines = []
43   if (!media_use_libvpx) {
44     defines += [ "MEDIA_DISABLE_LIBVPX" ]
45   }
46   if (!media_use_ffmpeg) {
47     defines += [ "MEDIA_DISABLE_FFMPEG" ]
48   }
49   if (is_win) {
50     ldflags = [
51       "/DELAYLOAD:mf.dll",
52       "/DELAYLOAD:mfplat.dll",
53       "/DELAYLOAD:mfreadwrite.dll",
54     ]
55   }
58 if (use_ozone) {
59   action("generate_ozone_constructor_list") {
60     # Ozone platform objects are auto-generated using similar
61     # patterns for naming and classes constructors. Here we build the
62     # object MediaOzonePlatform.
63     script = "../ui/ozone/generate_constructor_list.py"
65     platform_list_txt_file = "$target_gen_dir/../ui/ozone/platform_list.txt"
66     constructor_list_cc_file = "$target_gen_dir/ozone/constructor_list.cc"
68     sources = [
69       platform_list_txt_file,
70     ]
71     outputs = [
72       constructor_list_cc_file,
73     ]
74     args = [
75       "--platform_list=" + rebase_path(platform_list_txt_file, root_build_dir),
76       "--output_cc=" + rebase_path(constructor_list_cc_file, root_build_dir),
77       "--namespace=media",
78       "--typename=MediaOzonePlatform",
79       "--include=\"media/ozone/media_ozone_platform.h\"",
80     ]
81     deps = [
82       "//ui/ozone:generate_ozone_platform_list",
83     ]
84   }
87 component("media") {
88   sources = [
89     "blink/skcanvas_video_renderer.cc",
90     "blink/skcanvas_video_renderer.h",
91     "capture/content/animated_content_sampler.cc",
92     "capture/content/animated_content_sampler.h",
93     "capture/content/capture_resolution_chooser.cc",
94     "capture/content/capture_resolution_chooser.h",
95     "capture/content/feedback_signal_accumulator.cc",
96     "capture/content/feedback_signal_accumulator.h",
97     "capture/content/screen_capture_device_core.cc",
98     "capture/content/screen_capture_device_core.h",
99     "capture/content/smooth_event_sampler.cc",
100     "capture/content/smooth_event_sampler.h",
101     "capture/content/thread_safe_capture_oracle.cc",
102     "capture/content/thread_safe_capture_oracle.h",
103     "capture/content/video_capture_oracle.cc",
104     "capture/content/video_capture_oracle.h",
105     "capture/video/fake_video_capture_device.cc",
106     "capture/video/fake_video_capture_device.h",
107     "capture/video/fake_video_capture_device_factory.cc",
108     "capture/video/fake_video_capture_device_factory.h",
109     "capture/video/file_video_capture_device.cc",
110     "capture/video/file_video_capture_device.h",
111     "capture/video/file_video_capture_device_factory.cc",
112     "capture/video/file_video_capture_device_factory.h",
113     "capture/video/linux/v4l2_capture_delegate.cc",
114     "capture/video/linux/v4l2_capture_delegate.h",
115     "capture/video/linux/v4l2_capture_delegate_multi_plane.cc",
116     "capture/video/linux/v4l2_capture_delegate_multi_plane.h",
117     "capture/video/linux/v4l2_capture_delegate_single_plane.cc",
118     "capture/video/linux/v4l2_capture_delegate_single_plane.h",
119     "capture/video/linux/video_capture_device_chromeos.cc",
120     "capture/video/linux/video_capture_device_chromeos.h",
121     "capture/video/linux/video_capture_device_factory_linux.cc",
122     "capture/video/linux/video_capture_device_factory_linux.h",
123     "capture/video/linux/video_capture_device_linux.cc",
124     "capture/video/linux/video_capture_device_linux.h",
125     "capture/video/mac/platform_video_capturing_mac.h",
126     "capture/video/mac/video_capture_device_avfoundation_mac.h",
127     "capture/video/mac/video_capture_device_avfoundation_mac.mm",
128     "capture/video/mac/video_capture_device_decklink_mac.h",
129     "capture/video/mac/video_capture_device_decklink_mac.mm",
130     "capture/video/mac/video_capture_device_factory_mac.h",
131     "capture/video/mac/video_capture_device_factory_mac.mm",
132     "capture/video/mac/video_capture_device_mac.h",
133     "capture/video/mac/video_capture_device_mac.mm",
134     "capture/video/mac/video_capture_device_qtkit_mac.h",
135     "capture/video/mac/video_capture_device_qtkit_mac.mm",
136     "capture/video/video_capture_device.cc",
137     "capture/video/video_capture_device.h",
138     "capture/video/video_capture_device_factory.cc",
139     "capture/video/video_capture_device_factory.h",
140     "capture/video/video_capture_device_info.cc",
141     "capture/video/video_capture_device_info.h",
142     "capture/video/win/capability_list_win.cc",
143     "capture/video/win/capability_list_win.h",
144     "capture/video/win/filter_base_win.cc",
145     "capture/video/win/filter_base_win.h",
146     "capture/video/win/pin_base_win.cc",
147     "capture/video/win/pin_base_win.h",
148     "capture/video/win/sink_filter_observer_win.h",
149     "capture/video/win/sink_filter_win.cc",
150     "capture/video/win/sink_filter_win.h",
151     "capture/video/win/sink_input_pin_win.cc",
152     "capture/video/win/sink_input_pin_win.h",
153     "capture/video/win/video_capture_device_factory_win.cc",
154     "capture/video/win/video_capture_device_factory_win.h",
155     "capture/video/win/video_capture_device_mf_win.cc",
156     "capture/video/win/video_capture_device_mf_win.h",
157     "capture/video/win/video_capture_device_win.cc",
158     "capture/video/win/video_capture_device_win.h",
159     "cdm/aes_decryptor.cc",
160     "cdm/aes_decryptor.h",
161     "cdm/default_cdm_factory.cc",
162     "cdm/default_cdm_factory.h",
163     "cdm/json_web_key.cc",
164     "cdm/json_web_key.h",
165     "cdm/key_system_names.cc",
166     "cdm/key_system_names.h",
167     "cdm/player_tracker_impl.cc",
168     "cdm/player_tracker_impl.h",
169     "cdm/proxy_decryptor.cc",
170     "cdm/proxy_decyrptor.h",
171     "ffmpeg/ffmpeg_deleters.h",
172     "filters/audio_clock.cc",
173     "filters/audio_clock.h",
174     "filters/audio_renderer_algorithm.cc",
175     "filters/audio_renderer_algorithm.h",
176     "filters/chunk_demuxer.cc",
177     "filters/chunk_demuxer.h",
178     "filters/context_3d.h",
179     "filters/decoder_selector.cc",
180     "filters/decoder_selector.h",
181     "filters/decoder_stream.cc",
182     "filters/decoder_stream.h",
183     "filters/decoder_stream_traits.cc",
184     "filters/decoder_stream_traits.h",
185     "filters/decrypting_audio_decoder.cc",
186     "filters/decrypting_audio_decoder.h",
187     "filters/decrypting_demuxer_stream.cc",
188     "filters/decrypting_demuxer_stream.h",
189     "filters/decrypting_video_decoder.cc",
190     "filters/decrypting_video_decoder.h",
191     "filters/default_media_permission.cc",
192     "filters/default_media_permission.h",
193     "filters/file_data_source.cc",
194     "filters/file_data_source.h",
195     "filters/frame_processor.cc",
196     "filters/frame_processor.h",
197     "filters/gpu_video_decoder.cc",
198     "filters/gpu_video_decoder.h",
199     "filters/h264_bit_reader.cc",
200     "filters/h264_bit_reader.h",
201     "filters/h264_parser.cc",
202     "filters/h264_parser.h",
203     "filters/jpeg_parser.cc",
204     "filters/jpeg_parser.h",
205     "filters/source_buffer_platform.cc",
206     "filters/source_buffer_platform.h",
207     "filters/source_buffer_range.cc",
208     "filters/source_buffer_range.h",
209     "filters/source_buffer_stream.cc",
210     "filters/source_buffer_stream.h",
211     "filters/stream_parser_factory.cc",
212     "filters/stream_parser_factory.h",
213     "filters/video_cadence_estimator.cc",
214     "filters/video_cadence_estimator.h",
215     "filters/video_renderer_algorithm.cc",
216     "filters/video_renderer_algorithm.h",
217     "filters/vp8_bool_decoder.cc",
218     "filters/vp8_bool_decoder.h",
219     "filters/vp8_parser.cc",
220     "filters/vp8_parser.h",
221     "filters/webvtt_util.h",
222     "filters/wsola_internals.cc",
223     "filters/wsola_internals.h",
224     "formats/common/offset_byte_queue.cc",
225     "formats/common/offset_byte_queue.h",
226     "formats/webm/webm_audio_client.cc",
227     "formats/webm/webm_audio_client.h",
228     "formats/webm/webm_cluster_parser.cc",
229     "formats/webm/webm_cluster_parser.h",
230     "formats/webm/webm_constants.cc",
231     "formats/webm/webm_constants.h",
232     "formats/webm/webm_content_encodings.cc",
233     "formats/webm/webm_content_encodings.h",
234     "formats/webm/webm_content_encodings_client.cc",
235     "formats/webm/webm_content_encodings_client.h",
236     "formats/webm/webm_crypto_helpers.cc",
237     "formats/webm/webm_crypto_helpers.h",
238     "formats/webm/webm_info_parser.cc",
239     "formats/webm/webm_info_parser.h",
240     "formats/webm/webm_parser.cc",
241     "formats/webm/webm_parser.h",
242     "formats/webm/webm_stream_parser.cc",
243     "formats/webm/webm_stream_parser.h",
244     "formats/webm/webm_tracks_parser.cc",
245     "formats/webm/webm_tracks_parser.h",
246     "formats/webm/webm_video_client.cc",
247     "formats/webm/webm_video_client.h",
248     "formats/webm/webm_webvtt_parser.cc",
249     "formats/webm/webm_webvtt_parser.h",
250     "renderers/audio_renderer_impl.cc",
251     "renderers/audio_renderer_impl.h",
252     "renderers/default_renderer_factory.cc",
253     "renderers/default_renderer_factory.h",
254     "renderers/gpu_video_accelerator_factories.h",
255     "renderers/renderer_impl.cc",
256     "renderers/renderer_impl.h",
257     "renderers/video_renderer_impl.cc",
258     "renderers/video_renderer_impl.h",
259     "video/fake_video_encode_accelerator.cc",
260     "video/fake_video_encode_accelerator.h",
261     "video/gpu_memory_buffer_video_frame_pool.cc",
262     "video/gpu_memory_buffer_video_frame_pool.h",
263     "video/h264_poc.cc",
264     "video/h264_poc.h",
265     "video/jpeg_decode_accelerator.cc",
266     "video/jpeg_decode_accelerator.h",
267     "video/picture.cc",
268     "video/picture.h",
269     "video/video_decode_accelerator.cc",
270     "video/video_decode_accelerator.h",
271     "video/video_encode_accelerator.cc",
272     "video/video_encode_accelerator.h",
273   ]
275   configs += [
276     ":media_config",
277     ":media_implementation",
278     "//build/config:precompiled_headers",
280     # TODO(wolenetz): Fix size_t to int trunctaion in win64.
281     # See http://crbug.com/171009
282     "//build/config/compiler:no_size_t_to_int_warning",
283   ]
284   all_dependent_configs = [ ":media_dependent_config" ]
286   allow_circular_includes_from = []
287   cflags = []
288   libs = []
289   defines = []
290   deps = []
292   include_dirs = [ "." ]
293   if (media_use_ffmpeg) {
294     deps += [ "//third_party/ffmpeg" ]
295     sources += [
296       "ffmpeg/ffmpeg_common.cc",
297       "ffmpeg/ffmpeg_common.h",
298       "filters/audio_file_reader.cc",
299       "filters/audio_file_reader.h",
300       "filters/blocking_url_protocol.cc",
301       "filters/blocking_url_protocol.h",
302       "filters/ffmpeg_audio_decoder.cc",
303       "filters/ffmpeg_audio_decoder.h",
304       "filters/ffmpeg_bitstream_converter.h",
305       "filters/ffmpeg_demuxer.cc",
306       "filters/ffmpeg_demuxer.h",
307       "filters/ffmpeg_glue.cc",
308       "filters/ffmpeg_glue.h",
309       "filters/ffmpeg_video_decoder.cc",
310       "filters/ffmpeg_video_decoder.h",
311       "filters/in_memory_url_protocol.cc",
312       "filters/in_memory_url_protocol.h",
313     ]
314     if (proprietary_codecs) {
315       sources += [
316         "filters/ffmpeg_aac_bitstream_converter.cc",
317         "filters/ffmpeg_aac_bitstream_converter.h",
318         "filters/ffmpeg_h264_to_annex_b_bitstream_converter.cc",
319         "filters/ffmpeg_h264_to_annex_b_bitstream_converter.h",
320       ]
321     }
322   }
324   if (current_cpu == "arm" && arm_use_neon) {
325     defines += [ "USE_NEON" ]
326   }
328   if (media_use_libvpx) {
329     sources += [
330       "filters/vpx_video_decoder.cc",
331       "filters/vpx_video_decoder.h",
332     ]
333     deps += [ "//third_party/libvpx" ]
334   }
336   if (media_use_libwebm) {
337     sources += [
338       "capture/webm_muxer.cc",
339       "capture/webm_muxer.h",
340     ]
341     deps += [ "//third_party/libwebm" ]
342   }
344   if (is_android) {
345     sources += [
346       "capture/video/android/video_capture_device_android.cc",
347       "capture/video/android/video_capture_device_android.h",
348       "capture/video/android/video_capture_device_factory_android.cc",
349       "capture/video/android/video_capture_device_factory_android.h",
350     ]
351     deps += [
352       "//media/base/android",
353       "//media/base/android:media_jni_headers",
354       "//media/base/android:video_capture_jni_headers",
355     ]
356     allow_circular_includes_from = [ "//media/base/android" ]
357   } else {
358     sources += [
359       "filters/opus_audio_decoder.cc",
360       "filters/opus_audio_decoder.h",
361     ]
362   }
364   if (current_cpu != "arm" && is_chromeos) {
365     sources += [
366       "filters/h264_bitstream_buffer.cc",
367       "filters/h264_bitstream_buffer.h",
368     ]
369   }
371   # A simple WebM encoder for animated avatars on ChromeOS.
373   if (use_ozone) {
374     # Used for the generated listing header (ui/ozone/platform_list.h)
375     include_dirs += [ target_gen_dir ]
377     sources += [
378                  "ozone/media_ozone_platform.cc",
379                  "ozone/media_ozone_platform.h",
380                ] + get_target_outputs(":generate_ozone_constructor_list")
382     deps += [
383       ":generate_ozone_constructor_list",
384       "//ui/ozone",
385     ]
386   }
388   if (is_mac) {
389     deps += [
390       "//media/base/mac",
391       "//third_party/decklink",
392     ]
393     libs += [
394       "CoreVideo.framework",
395       "OpenGL.framework",
396       "QTKit.framework",
397     ]
398   }
400   if (is_openbsd) {
401     sources -= [
402       "capture/video/linux/v4l2_capture_delegate_multi_plane.cc",
403       "capture/video/linux/v4l2_capture_delegate_multi_plane.h",
404     ]
405   }
407   if (is_ios) {
408     deps += [ "//media/base/mac" ]
409   }
411   if (is_win) {
412     deps += [ "//media/base/win" ]
413     libs += [
414       "mf.lib",
415       "mfplat.lib",
416       "mfreadwrite.lib",
417       "mfuuid.lib",
418     ]
419   }
421   if (proprietary_codecs) {
422     sources += [
423       "cdm/cenc_utils.cc",
424       "cdm/cenc_utils.h",
425       "filters/h264_to_annex_b_bitstream_converter.cc",
426       "filters/h264_to_annex_b_bitstream_converter.h",
427       "formats/mp2t/es_adapter_video.cc",
428       "formats/mp2t/es_adapter_video.h",
429       "formats/mp2t/es_parser.cc",
430       "formats/mp2t/es_parser.h",
431       "formats/mp2t/es_parser_adts.cc",
432       "formats/mp2t/es_parser_adts.h",
433       "formats/mp2t/es_parser_h264.cc",
434       "formats/mp2t/es_parser_h264.h",
435       "formats/mp2t/es_parser_mpeg1audio.cc",
436       "formats/mp2t/es_parser_mpeg1audio.h",
437       "formats/mp2t/mp2t_common.h",
438       "formats/mp2t/mp2t_stream_parser.cc",
439       "formats/mp2t/mp2t_stream_parser.h",
440       "formats/mp2t/timestamp_unroller.cc",
441       "formats/mp2t/timestamp_unroller.h",
442       "formats/mp2t/ts_packet.cc",
443       "formats/mp2t/ts_packet.h",
444       "formats/mp2t/ts_section.h",
445       "formats/mp2t/ts_section_pat.cc",
446       "formats/mp2t/ts_section_pat.h",
447       "formats/mp2t/ts_section_pes.cc",
448       "formats/mp2t/ts_section_pes.h",
449       "formats/mp2t/ts_section_pmt.cc",
450       "formats/mp2t/ts_section_pmt.h",
451       "formats/mp2t/ts_section_psi.cc",
452       "formats/mp2t/ts_section_psi.h",
453       "formats/mp4/aac.cc",
454       "formats/mp4/aac.h",
455       "formats/mp4/avc.cc",
456       "formats/mp4/avc.h",
457       "formats/mp4/box_definitions.cc",
458       "formats/mp4/box_definitions.h",
459       "formats/mp4/box_reader.cc",
460       "formats/mp4/box_reader.h",
461       "formats/mp4/cenc.cc",
462       "formats/mp4/cenc.h",
463       "formats/mp4/es_descriptor.cc",
464       "formats/mp4/es_descriptor.h",
465       "formats/mp4/mp4_stream_parser.cc",
466       "formats/mp4/mp4_stream_parser.h",
467       "formats/mp4/sample_to_group_iterator.cc",
468       "formats/mp4/sample_to_group_iterator.h",
469       "formats/mp4/track_run_iterator.cc",
470       "formats/mp4/track_run_iterator.h",
471       "formats/mpeg/adts_constants.cc",
472       "formats/mpeg/adts_constants.h",
473       "formats/mpeg/adts_stream_parser.cc",
474       "formats/mpeg/adts_stream_parser.h",
475       "formats/mpeg/mpeg1_audio_stream_parser.cc",
476       "formats/mpeg/mpeg1_audio_stream_parser.h",
477       "formats/mpeg/mpeg_audio_stream_parser_base.cc",
478       "formats/mpeg/mpeg_audio_stream_parser_base.h",
479     ]
480   }
482   public_deps = [
483     "//media/base",
484     "//media/audio",
485   ]
487   deps += [
488     ":shared_memory_support",
489     "//base",
490     "//base:i18n",
491     "//base/third_party/dynamic_annotations",
492     "//crypto",
493     "//crypto:platform",  # TODO(ajwong): This used to be provided by crypto.gyp via export_dependent_settings
494     "//gpu/command_buffer/common",
495     "//skia",
496     "//third_party/libyuv",
497     "//third_party/opus",
498     "//ui/events:events_base",
499     "//ui/gfx",
500     "//ui/gfx/geometry",
501     "//url",
502   ]
505 # Minimal media component for media/cast on iOS.
506 if (is_ios) {
507   component("media_for_cast_ios") {
508     configs += [
509       ":media_config",
510       ":media_implementation",
511     ]
512     all_dependent_configs = [ ":media_dependent_config" ]
513     include_dirs = [ "." ]
514     libs = [ "CoreVideo.framework" ]
516     deps = [
517       ":shared_memory_support",
518       "//base",
519       "//gpu/command_buffer/common",
520       "//media/base:base_for_cast_ios",
521       "//media/base/mac",
522       "//ui/gfx/geometry",
523     ]
524   }
527 # TODO(GYP): Delete this after we've converted everything to GN.
528 # The _run targets exist only for compatibility w/ GYP.
529 group("media_unittests_run") {
530   testonly = true
531   deps = [
532     ":media_unittests",
533   ]
536 test("media_unittests") {
537   sources = [
538     "blink/skcanvas_video_renderer_unittest.cc",
539     "capture/content/animated_content_sampler_unittest.cc",
540     "capture/content/capture_resolution_chooser_unittest.cc",
541     "capture/content/feedback_signal_accumulator_unittest.cc",
542     "capture/content/smooth_event_sampler_unittest.cc",
543     "capture/content/video_capture_oracle_unittest.cc",
544     "capture/video/fake_video_capture_device_unittest.cc",
545     "capture/video/video_capture_device_unittest.cc",
546     "cdm/aes_decryptor_unittest.cc",
547     "cdm/json_web_key_unittest.cc",
548     "filters/audio_clock_unittest.cc",
549     "filters/audio_decoder_selector_unittest.cc",
550     "filters/audio_renderer_algorithm_unittest.cc",
551     "filters/chunk_demuxer_unittest.cc",
552     "filters/decrypting_audio_decoder_unittest.cc",
553     "filters/decrypting_demuxer_stream_unittest.cc",
554     "filters/decrypting_video_decoder_unittest.cc",
555     "filters/fake_video_decoder.cc",
556     "filters/fake_video_decoder.h",
557     "filters/fake_video_decoder_unittest.cc",
558     "filters/file_data_source_unittest.cc",
559     "filters/frame_processor_unittest.cc",
560     "filters/h264_bit_reader_unittest.cc",
561     "filters/h264_parser_unittest.cc",
562     "filters/jpeg_parser_unittest.cc",
563     "filters/source_buffer_stream_unittest.cc",
564     "filters/video_cadence_estimator_unittest.cc",
565     "filters/video_decoder_selector_unittest.cc",
566     "filters/video_frame_stream_unittest.cc",
567     "filters/video_renderer_algorithm_unittest.cc",
568     "filters/vp8_bool_decoder_unittest.cc",
569     "filters/vp8_parser_unittest.cc",
570     "formats/common/offset_byte_queue_unittest.cc",
571     "formats/webm/cluster_builder.cc",
572     "formats/webm/cluster_builder.h",
573     "formats/webm/opus_packet_builder.cc",
574     "formats/webm/opus_packet_builder.h",
575     "formats/webm/tracks_builder.cc",
576     "formats/webm/tracks_builder.h",
577     "formats/webm/webm_cluster_parser_unittest.cc",
578     "formats/webm/webm_content_encodings_client_unittest.cc",
579     "formats/webm/webm_parser_unittest.cc",
580     "formats/webm/webm_tracks_parser_unittest.cc",
581     "formats/webm/webm_webvtt_parser_unittest.cc",
582     "renderers/audio_renderer_impl_unittest.cc",
583     "renderers/renderer_impl_unittest.cc",
584     "renderers/video_renderer_impl_unittest.cc",
585     "video/h264_poc_unittest.cc",
586   ]
588   data = [
589     "test/data/",
590   ]
592   # TODO(wolenetz): Fix size_t to int trunctaion in win64.
593   # See http://crbug.com/171009
594   configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
596   deps = [
597     ":media",
598     ":test_support",
599     "//base/allocator",
600     "//base/test:test_support",
601     "//media/audio:unittests",
602     "//media/audio:test_support",
603     "//media/base:unittests",
604     "//media/base:test_support",
605     "//media/test:pipeline_integration_tests",
606     "//skia",  # Direct dependency required to inherit config.
607     "//testing/gmock",
608     "//testing/gtest",
609     "//third_party/widevine/cdm:version_h",
610     "//ui/gfx:test_support",
611     "//url",
612   ]
614   if (is_android) {
615     isolate_file = "media_unittests.isolate"
616     deps += [
617       "//media/base/android",
618       # TODO(GYP)
619       #"//testing/android/native_test:native_test_native_code"
620     ]
621   }
623   if (media_use_ffmpeg) {
624     sources += [
625       "ffmpeg/ffmpeg_common_unittest.cc",
626       "filters/audio_decoder_unittest.cc",
627       "filters/audio_file_reader_unittest.cc",
628       "filters/blocking_url_protocol_unittest.cc",
629       "filters/ffmpeg_demuxer_unittest.cc",
630       "filters/ffmpeg_glue_unittest.cc",
631       "filters/ffmpeg_video_decoder_unittest.cc",
632       "filters/in_memory_url_protocol_unittest.cc",
633     ]
634   }
636   if (current_cpu != "arm" && is_chromeos) {
637     sources += [ "filters/h264_bitstream_buffer_unittest.cc" ]
638   }
640   if (proprietary_codecs) {
641     sources += [
642       "cdm/cenc_utils_unittest.cc",
643       "filters/h264_to_annex_b_bitstream_converter_unittest.cc",
644       "formats/common/stream_parser_test_base.cc",
645       "formats/common/stream_parser_test_base.h",
646       "formats/mp2t/es_adapter_video_unittest.cc",
647       "formats/mp2t/es_parser_adts_unittest.cc",
648       "formats/mp2t/es_parser_h264_unittest.cc",
649       "formats/mp2t/es_parser_mpeg1audio_unittest.cc",
650       "formats/mp2t/es_parser_test_base.cc",
651       "formats/mp2t/es_parser_test_base.h",
652       "formats/mp2t/mp2t_stream_parser_unittest.cc",
653       "formats/mp2t/timestamp_unroller_unittest.cc",
654       "formats/mp4/aac_unittest.cc",
655       "formats/mp4/avc_unittest.cc",
656       "formats/mp4/box_reader_unittest.cc",
657       "formats/mp4/es_descriptor_unittest.cc",
658       "formats/mp4/mp4_stream_parser_unittest.cc",
659       "formats/mp4/sample_to_group_iterator_unittest.cc",
660       "formats/mp4/track_run_iterator_unittest.cc",
661       "formats/mpeg/adts_stream_parser_unittest.cc",
662       "formats/mpeg/mpeg1_audio_stream_parser_unittest.cc",
663     ]
664     if (media_use_ffmpeg) {
665       sources += [
666         "filters/ffmpeg_aac_bitstream_converter_unittest.cc",
667         "filters/ffmpeg_h264_to_annex_b_bitstream_converter_unittest.cc",
668       ]
669     }
670   }
672   if (is_mac || is_ios) {
673     deps += [ "//media/base/mac" ]
674   }
676   if (is_mac) {
677     sources +=
678         [ "capture/video/mac/video_capture_device_factory_mac_unittest.mm" ]
679   }
681   #      include_dirs += [
682   #        # Needed by media_drm_bridge.cc.
683   #        target_gen_dir,
684   #      ],
686   configs += [ ":media_config" ]
688   if (media_use_ffmpeg) {
689     deps += [ "//third_party/ffmpeg" ]  # Direct dependency required to inherit config.
690   }
693 test("media_perftests") {
694   configs += [ ":media_config" ]
695   deps = [
696     ":media",
697     ":shared_memory_support",
698     ":test_support",
699     "//base/test:test_support",
700     "//media/audio:test_support",
701     "//media/base:perftests",
702     "//media/base:test_support",
703     "//media/test:pipeline_integration_perftests",
704     "//testing/gmock",
705     "//testing/gtest",
706     "//testing/perf",
707     "//third_party/widevine/cdm:version_h",
708     "//ui/gfx:test_support",
709   ]
710   if (is_android) {
711     deps += [ "//ui/gl" ]
712     isolate_file = "media_perftests.isolate"
713   }
714   if (media_use_ffmpeg) {
715     deps += [ "//third_party/ffmpeg" ]  # Direct dependency required to inherit config.
716   }
719 # For running the subset of media_unittests that might require audio hardware
720 # separately on GPU bots. media_unittests includes these too.
721 test("audio_unittests") {
722   sources = [
723     "base/run_all_unittests.cc",
724   ]
725   deps = [
726     ":test_support",
727     "//base/test:test_support",
728     "//media/audio:unittests",
729     "//ui/gfx:test_support",
730   ]
733 source_set("test_support") {
734   testonly = true
735   sources = [
736     "renderers/mock_gpu_video_accelerator_factories.cc",
737     "renderers/mock_gpu_video_accelerator_factories.h",
738     "video/mock_video_decode_accelerator.cc",
739     "video/mock_video_decode_accelerator.h",
740   ]
741   deps = [
742     ":media",
743     ":shared_memory_support",
744     "//base",
745     "//skia",
746     "//testing/gmock",
747     "//testing/gtest",
748   ]
751 # TODO(dalecurtis): How to split this across audio/base directories??
752 component("shared_memory_support") {
753   sources = [
754     "audio/audio_parameters.cc",
755     "audio/audio_parameters.h",
756     "base/audio_bus.cc",
757     "base/audio_bus.h",
758     "base/channel_layout.cc",
759     "base/channel_layout.h",
760     "base/limits.h",
761     "base/media_export.h",
762     "base/vector_math.cc",
763     "base/vector_math.h",
764   ]
765   configs += [
766     ":media_config",
767     ":media_implementation",
768   ]
769   deps = [
770     "//base",
771   ]
774 if (media_use_ffmpeg) {
775   test("ffmpeg_regression_tests") {
776     sources = [
777       "base/run_all_unittests.cc",
778       "ffmpeg/ffmpeg_regression_tests.cc",
779     ]
781     configs += [ "//media:media_config" ]
783     deps = [
784       "//base/test:test_support",
785       "//media",
786       "//media:test_support",
787       "//media/audio:test_support",
788       "//media/base:test_support",
789       "//media/test:pipeline_integration_tests",
790       "//testing/gmock",
791       "//testing/gtest",
792       "//third_party/ffmpeg",
793       "//ui/gfx/geometry",
794       "//ui/gfx:test_support",
795     ]
796   }