Updating XTBs based on .GRDs from branch master
[chromium-blink-merge.git] / media / cast / BUILD.gn
blobb633d997d318c8de13bb37aee9ca67d249515d67
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("//testing/test.gni")
7 component("cast") {
8   deps = [
9     ":sender",
10     ":receiver",
11   ]
14 # Common code shared by all cast components.
15 source_set("common") {
16   sources = [
17     "cast_config.cc",
18     "cast_config.h",
19     "cast_defines.h",
20     "cast_environment.cc",
21     "cast_environment.h",
22     "common/clock_drift_smoother.cc",
23     "common/clock_drift_smoother.h",
24     "common/transport_encryption_handler.cc",
25     "common/transport_encryption_handler.h",
26     "logging/encoding_event_subscriber.cc",
27     "logging/encoding_event_subscriber.h",
28     "logging/log_deserializer.cc",
29     "logging/log_deserializer.h",
30     "logging/log_serializer.cc",
31     "logging/log_serializer.h",
32     "logging/logging_defines.cc",
33     "logging/logging_defines.h",
34     "logging/logging_impl.cc",
35     "logging/logging_impl.h",
36     "logging/logging_raw.cc",
37     "logging/logging_raw.h",
38     "logging/raw_event_subscriber.h",
39     "logging/raw_event_subscriber_bundle.cc",
40     "logging/raw_event_subscriber_bundle.h",
41     "logging/receiver_time_offset_estimator.h",
42     "logging/receiver_time_offset_estimator_impl.cc",
43     "logging/receiver_time_offset_estimator_impl.h",
44     "logging/simple_event_subscriber.cc",
45     "logging/simple_event_subscriber.h",
46     "logging/stats_event_subscriber.cc",
47     "logging/stats_event_subscriber.h",
48   ]
50   public_deps = [
51     "//media/cast/logging/proto",
52   ]
53   deps = [
54     "//base",
55     "//crypto",
56     "//net",
57     "//third_party/zlib",
58   ]
61 source_set("net") {
62   sources = [
63     "net/cast_transport_config.cc",
64     "net/cast_transport_config.h",
65     "net/cast_transport_defines.h",
66     "net/cast_transport_sender.h",
67     "net/cast_transport_sender_impl.cc",
68     "net/cast_transport_sender_impl.h",
69     "net/pacing/paced_sender.cc",
70     "net/pacing/paced_sender.h",
71     "net/rtcp/receiver_rtcp_event_subscriber.cc",
72     "net/rtcp/rtcp.cc",
73     "net/rtcp/rtcp.h",
74     "net/rtcp/rtcp_builder.cc",
75     "net/rtcp/rtcp_builder.h",
76     "net/rtcp/rtcp_defines.cc",
77     "net/rtcp/rtcp_defines.h",
78     "net/rtcp/rtcp_utility.cc",
79     "net/rtcp/rtcp_utility.h",
80     "net/rtp/cast_message_builder.cc",
81     "net/rtp/cast_message_builder.h",
82     "net/rtp/frame_buffer.cc",
83     "net/rtp/frame_buffer.h",
84     "net/rtp/framer.cc",
85     "net/rtp/framer.h",
86     "net/rtp/packet_storage.cc",
87     "net/rtp/packet_storage.h",
88     "net/rtp/receiver_stats.cc",
89     "net/rtp/receiver_stats.h",
90     "net/rtp/rtp_packetizer.cc",
91     "net/rtp/rtp_packetizer.h",
92     "net/rtp/rtp_parser.cc",
93     "net/rtp/rtp_parser.h",
94     "net/rtp/rtp_receiver_defines.cc",
95     "net/rtp/rtp_receiver_defines.h",
96     "net/rtp/rtp_sender.cc",
97     "net/rtp/rtp_sender.h",
98     "net/udp_transport.cc",
99     "net/udp_transport.h",
100   ]
102   deps = [
103     ":common",
104   ]
107 source_set("sender") {
108   sources = [
109     "cast_sender.h",
110     "cast_sender_impl.cc",
111     "cast_sender_impl.h",
112     "sender/audio_encoder.cc",
113     "sender/audio_encoder.h",
114     "sender/audio_sender.cc",
115     "sender/audio_sender.h",
116     "sender/congestion_control.cc",
117     "sender/congestion_control.h",
118     "sender/external_video_encoder.cc",
119     "sender/external_video_encoder.h",
120     "sender/fake_software_video_encoder.cc",
121     "sender/fake_software_video_encoder.h",
122     "sender/frame_sender.cc",
123     "sender/frame_sender.h",
124     "sender/performance_metrics_overlay.cc",
125     "sender/performance_metrics_overlay.h",
126     "sender/sender_encoded_frame.cc",
127     "sender/sender_encoded_frame.h",
128     "sender/size_adaptable_video_encoder_base.cc",
129     "sender/size_adaptable_video_encoder_base.h",
130     "sender/software_video_encoder.h",
131     "sender/video_encoder.cc",
132     "sender/video_encoder.h",
133     "sender/video_encoder_impl.cc",
134     "sender/video_encoder_impl.h",
135     "sender/video_frame_factory.h",
136     "sender/video_sender.cc",
137     "sender/video_sender.h",
138     "sender/vp8_encoder.cc",
139     "sender/vp8_encoder.h",
140   ]
142   deps = [
143     ":common",
144     ":net",
145     "//media",
146     "//media:shared_memory_support",
147     "//third_party/libvpx",
148     "//third_party/opus",
149     "//ui/gfx/geometry",
150   ]
152   # use a restricted subset of media and no software codecs on iOS
153   if (is_ios) {
154     deps += [ "//media:media_for_cast_ios" ]
155     deps -= [
156       "//media",
157       "//third_party/libvpx",
158       "//third_party/opus",
159     ]
160     sources -= [
161       "sender/external_video_encoder.cc",
162       "sender/external_video_encoder.h",
163       "sender/video_encoder_impl.cc",
164       "sender/video_encoder_impl.h",
165       "sender/vp8_encoder.cc",
166       "sender/vp8_encoder.h",
167     ]
168   }
170   libs = []
172   # iOS and OS X encoders
173   if (is_ios || is_mac) {
174     sources += [
175       "sender/h264_vt_encoder.cc",
176       "sender/h264_vt_encoder.h",
177     ]
179     libs += [
180       "AudioToolbox.framework",
181       "CoreVideo.framework",
182     ]
183   }
186 source_set("receiver") {
187   sources = [
188     "cast_receiver.h",
189     "receiver/audio_decoder.cc",
190     "receiver/audio_decoder.h",
191     "receiver/cast_receiver_impl.cc",
192     "receiver/cast_receiver_impl.h",
193     "receiver/frame_receiver.cc",
194     "receiver/frame_receiver.h",
195     "receiver/video_decoder.cc",
196     "receiver/video_decoder.h",
197   ]
199   deps = [
200     ":common",
201     ":net",
202     "//media",
203     "//media:shared_memory_support",
204     "//third_party/libvpx",
205     "//third_party/opus",
206     "//ui/gfx",
207   ]
209   # use a restricted subset of media and no software codecs on iOS
210   if (is_ios) {
211     deps += [ "//media:media_for_cast_ios" ]
212     deps -= [
213       "//media",
214       "//third_party/libvpx",
215       "//third_party/opus",
216     ]
217   }
220 static_library("test_support") {
221   testonly = true
222   sources = [
223     # TODO(hclam): FFmpeg.
224     #    "test/fake_media_source.cc",
225     #    "test/fake_media_source.h",
226     "test/fake_single_thread_task_runner.cc",
227     "test/fake_single_thread_task_runner.h",
228     "test/loopback_transport.cc",
229     "test/loopback_transport.h",
230     "test/skewed_single_thread_task_runner.cc",
231     "test/skewed_single_thread_task_runner.h",
232     "test/skewed_tick_clock.cc",
233     "test/skewed_tick_clock.h",
234     "test/utility/audio_utility.cc",
235     "test/utility/audio_utility.h",
236     "test/utility/barcode.cc",
237     "test/utility/barcode.h",
238     "test/utility/default_config.cc",
239     "test/utility/default_config.h",
240     "test/utility/in_process_receiver.cc",
241     "test/utility/in_process_receiver.h",
242     "test/utility/input_builder.cc",
243     "test/utility/input_builder.h",
244     "test/utility/net_utility.cc",
245     "test/utility/net_utility.h",
246     "test/utility/standalone_cast_environment.cc",
247     "test/utility/standalone_cast_environment.h",
248     "test/utility/udp_proxy.cc",
249     "test/utility/udp_proxy.h",
250     "test/utility/video_utility.cc",
251     "test/utility/video_utility.h",
252   ]
254   deps = [
255     ":net",
256     ":receiver",
257     "//base/test:test_support",
258     "//testing/gtest",
260     # TODO(hclam): Does not build on ARM yet.
261     #    "//third_party/ffmpeg",
262     "//third_party/libyuv",
263     "//third_party/mt19937ar",
264     "//ui/gfx",
265     "//ui/gfx/geometry",
266   ]
269 # TODO(GYP): Delete this after we've converted everything to GN.
270 # The _run targets exist only for compatibility w/ GYP.
271 group("cast_unittests_run") {
272   testonly = true
273   deps = [
274     ":cast_unittests",
275   ]
278 test("cast_unittests") {
279   sources = [
280     "logging/encoding_event_subscriber_unittest.cc",
281     "logging/logging_impl_unittest.cc",
282     "logging/logging_raw_unittest.cc",
283     "logging/receiver_time_offset_estimator_impl_unittest.cc",
284     "logging/serialize_deserialize_test.cc",
285     "logging/simple_event_subscriber_unittest.cc",
286     "logging/stats_event_subscriber_unittest.cc",
287     "net/cast_transport_sender_impl_unittest.cc",
288     "net/mock_cast_transport_sender.cc",
289     "net/mock_cast_transport_sender.h",
290     "net/pacing/mock_paced_packet_sender.cc",
291     "net/pacing/mock_paced_packet_sender.h",
292     "net/pacing/paced_sender_unittest.cc",
293     "net/rtcp/receiver_rtcp_event_subscriber_unittest.cc",
294     "net/rtcp/rtcp_builder_unittest.cc",
295     "net/rtcp/rtcp_unittest.cc",
296     "net/rtcp/rtcp_utility_unittest.cc",
298     # TODO(miu): The following two are test utility modules.  Rename/move the files.
299     "net/rtcp/test_rtcp_packet_builder.cc",
300     "net/rtcp/test_rtcp_packet_builder.h",
301     "net/rtp/cast_message_builder_unittest.cc",
302     "net/rtp/frame_buffer_unittest.cc",
303     "net/rtp/framer_unittest.cc",
304     "net/rtp/mock_rtp_payload_feedback.cc",
305     "net/rtp/mock_rtp_payload_feedback.h",
306     "net/rtp/packet_storage_unittest.cc",
307     "net/rtp/receiver_stats_unittest.cc",
308     "net/rtp/rtp_header_parser.cc",
309     "net/rtp/rtp_header_parser.h",
310     "net/rtp/rtp_packet_builder.cc",
311     "net/rtp/rtp_packetizer_unittest.cc",
312     "net/rtp/rtp_parser_unittest.cc",
313     "net/rtp/rtp_receiver_defines.h",
314     "net/udp_transport_unittest.cc",
315     "receiver/audio_decoder_unittest.cc",
316     "receiver/frame_receiver_unittest.cc",
317     "receiver/video_decoder_unittest.cc",
318     "sender/audio_encoder_unittest.cc",
319     "sender/audio_sender_unittest.cc",
320     "sender/congestion_control_unittest.cc",
321     "sender/fake_video_encode_accelerator_factory.cc",
322     "sender/fake_video_encode_accelerator_factory.h",
323     "sender/video_encoder_unittest.cc",
324     "sender/video_sender_unittest.cc",
325     "test/end2end_unittest.cc",
326     "test/fake_receiver_time_offset_estimator.cc",
327     "test/fake_receiver_time_offset_estimator.h",
328     "test/utility/audio_utility_unittest.cc",
329     "test/utility/barcode_unittest.cc",
330   ]
332   deps = [
333     ":common",
334     ":receiver",
335     ":sender",
336     ":test_support",
337     "//base/test:run_all_unittests",
338     "//base/test:test_support",
339     "//testing/gmock",
340     "//testing/gtest",
341   ]
344 if (is_ios || is_mac) {
345   test("cast_h264_vt_encoder_unittests") {
346     sources = [
347       "sender/h264_vt_encoder_unittest.cc",
348     ]
349     deps = [
350       ":common",
351       ":sender",
352       ":test_support",
353       "//base/test:test_support",
354       "//testing/gmock",
355       "//testing/gtest",
356       "//third_party/ffmpeg",
357     ]
358   }
361 executable("generate_barcode_video") {
362   testonly = true
363   sources = [
364     "test/utility/generate_barcode_video.cc",
365   ]
367   deps = [
368     ":test_support",
369     "//base",
370     "//media",
371   ]
374 executable("generate_timecode_audio") {
375   testonly = true
376   sources = [
377     "test/utility/generate_timecode_audio.cc",
378   ]
380   deps = [
381     ":test_support",
382     "//base",
383     "//media",
384   ]
387 executable("udp_proxy") {
388   testonly = true
389   sources = [
390     "test/utility/udp_proxy_main.cc",
391   ]
393   deps = [
394     ":test_support",
395     "//base",
396     "//net",
397   ]
400 if (is_linux && !is_chromeos) {
401   # TODO(GYP): Figure out which of these work and are needed on other platforms.
402   test("cast_benchmarks") {
403     sources = [
404       "test/cast_benchmarks.cc",
405       "test/fake_single_thread_task_runner.cc",
406       "test/fake_single_thread_task_runner.h",
407       "test/utility/test_util.cc",
408       "test/utility/test_util.h",
409     ]
411     deps = [
412       ":common",
413       ":net",
414       ":receiver",
415       ":sender",
416       ":test_support",
417       "//base/test:test_support",
418       "//net",
419       "//testing/gtest",
420     ]
421   }
423   test("tap_proxy") {
424     sources = [
425       "test/utility/tap_proxy.cc",
426     ]
428     deps = [
429       ":test_support",
430       "//base",
431       "//media",
432     ]
433   }