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