[Cronet] Delay StartNetLog and StopNetLog until native request context is initialized
[chromium-blink-merge.git] / media / cast / BUILD.gn
blob2262c7b6cbc5f3e6d78c2c0712002865fc0681d9
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/size_adaptable_video_encoder_base.cc",
125     "sender/size_adaptable_video_encoder_base.h",
126     "sender/software_video_encoder.h",
127     "sender/video_encoder.cc",
128     "sender/video_encoder.h",
129     "sender/video_encoder_impl.cc",
130     "sender/video_encoder_impl.h",
131     "sender/video_frame_factory.h",
132     "sender/video_sender.cc",
133     "sender/video_sender.h",
134     "sender/vp8_encoder.cc",
135     "sender/vp8_encoder.h",
136   ]
138   deps = [
139     ":common",
140     ":net",
141     "//media",
142     "//media:shared_memory_support",
143     "//third_party/libvpx",
144     "//third_party/opus",
145     "//ui/gfx/geometry",
146   ]
148   # use a restricted subset of media and no software codecs on iOS
149   if (is_ios) {
150     deps += [ "//media:media_for_cast_ios" ]
151     deps -= [
152       "//media",
153       "//third_party/libvpx",
154       "//third_party/opus",
155     ]
156     sources -= [
157       "sender/external_video_encoder.cc",
158       "sender/external_video_encoder.h",
159       "sender/video_encoder_impl.cc",
160       "sender/video_encoder_impl.h",
161       "sender/vp8_encoder.cc",
162       "sender/vp8_encoder.h",
163     ]
164   }
166   # iOS and OS X encoders
167   if (is_ios || is_mac) {
168     sources += [
169       "sender/h264_vt_encoder.cc",
170       "sender/h264_vt_encoder.h",
171     ]
172   }
175 source_set("receiver") {
176   sources = [
177     "cast_receiver.h",
178     "receiver/audio_decoder.cc",
179     "receiver/audio_decoder.h",
180     "receiver/cast_receiver_impl.cc",
181     "receiver/cast_receiver_impl.h",
182     "receiver/frame_receiver.cc",
183     "receiver/frame_receiver.h",
184     "receiver/video_decoder.cc",
185     "receiver/video_decoder.h",
186   ]
188   deps = [
189     ":common",
190     ":net",
191     "//media",
192     "//media:shared_memory_support",
193     "//third_party/libvpx",
194     "//third_party/opus",
195     "//ui/gfx",
196   ]
198   # use a restricted subset of media and no software codecs on iOS
199   if (is_ios) {
200     deps += [ "//media:media_for_cast_ios" ]
201     deps -= [
202       "//media",
203       "//third_party/libvpx",
204       "//third_party/opus",
205     ]
206   }
209 static_library("test_support") {
210   testonly = true
211   sources = [
212     # TODO(hclam): FFmpeg.
213     #    "test/fake_media_source.cc",
214     #    "test/fake_media_source.h",
215     "test/fake_single_thread_task_runner.cc",
216     "test/fake_single_thread_task_runner.h",
217     "test/loopback_transport.cc",
218     "test/loopback_transport.h",
219     "test/skewed_single_thread_task_runner.cc",
220     "test/skewed_single_thread_task_runner.h",
221     "test/skewed_tick_clock.cc",
222     "test/skewed_tick_clock.h",
223     "test/utility/audio_utility.cc",
224     "test/utility/audio_utility.h",
225     "test/utility/barcode.cc",
226     "test/utility/barcode.h",
227     "test/utility/default_config.cc",
228     "test/utility/default_config.h",
229     "test/utility/in_process_receiver.cc",
230     "test/utility/in_process_receiver.h",
231     "test/utility/input_builder.cc",
232     "test/utility/input_builder.h",
233     "test/utility/net_utility.cc",
234     "test/utility/net_utility.h",
235     "test/utility/standalone_cast_environment.cc",
236     "test/utility/standalone_cast_environment.h",
237     "test/utility/udp_proxy.cc",
238     "test/utility/udp_proxy.h",
239     "test/utility/video_utility.cc",
240     "test/utility/video_utility.h",
241   ]
243   deps = [
244     ":net",
245     ":receiver",
246     "//base/test:test_support",
247     "//testing/gtest",
249     # TODO(hclam): Does not build on ARM yet.
250     #    "//third_party/ffmpeg",
251     "//third_party/libyuv",
252     "//third_party/mt19937ar",
253     "//ui/gfx",
254     "//ui/gfx/geometry",
255   ]
258 test("cast_unittests") {
259   sources = [
260     "logging/encoding_event_subscriber_unittest.cc",
261     "logging/logging_impl_unittest.cc",
262     "logging/logging_raw_unittest.cc",
263     "logging/receiver_time_offset_estimator_impl_unittest.cc",
264     "logging/serialize_deserialize_test.cc",
265     "logging/simple_event_subscriber_unittest.cc",
266     "logging/stats_event_subscriber_unittest.cc",
267     "net/cast_transport_sender_impl_unittest.cc",
268     "net/mock_cast_transport_sender.cc",
269     "net/mock_cast_transport_sender.h",
270     "net/pacing/mock_paced_packet_sender.cc",
271     "net/pacing/mock_paced_packet_sender.h",
272     "net/pacing/paced_sender_unittest.cc",
273     "net/rtcp/receiver_rtcp_event_subscriber_unittest.cc",
274     "net/rtcp/rtcp_builder_unittest.cc",
275     "net/rtcp/rtcp_unittest.cc",
276     "net/rtcp/rtcp_utility_unittest.cc",
278     # TODO(miu): The following two are test utility modules.  Rename/move the files.
279     "net/rtcp/test_rtcp_packet_builder.cc",
280     "net/rtcp/test_rtcp_packet_builder.h",
281     "net/rtp/cast_message_builder_unittest.cc",
282     "net/rtp/frame_buffer_unittest.cc",
283     "net/rtp/framer_unittest.cc",
284     "net/rtp/mock_rtp_payload_feedback.cc",
285     "net/rtp/mock_rtp_payload_feedback.h",
286     "net/rtp/packet_storage_unittest.cc",
287     "net/rtp/receiver_stats_unittest.cc",
288     "net/rtp/rtp_header_parser.cc",
289     "net/rtp/rtp_header_parser.h",
290     "net/rtp/rtp_packet_builder.cc",
291     "net/rtp/rtp_packetizer_unittest.cc",
292     "net/rtp/rtp_parser_unittest.cc",
293     "net/rtp/rtp_receiver_defines.h",
294     "net/udp_transport_unittest.cc",
295     "receiver/audio_decoder_unittest.cc",
296     "receiver/frame_receiver_unittest.cc",
297     "receiver/video_decoder_unittest.cc",
298     "sender/audio_encoder_unittest.cc",
299     "sender/audio_sender_unittest.cc",
300     "sender/congestion_control_unittest.cc",
301     "sender/fake_video_encode_accelerator_factory.cc",
302     "sender/fake_video_encode_accelerator_factory.h",
303     "sender/video_encoder_unittest.cc",
304     "sender/video_sender_unittest.cc",
305     "test/end2end_unittest.cc",
306     "test/fake_receiver_time_offset_estimator.cc",
307     "test/fake_receiver_time_offset_estimator.h",
308     "test/utility/audio_utility_unittest.cc",
309     "test/utility/barcode_unittest.cc",
310   ]
312   deps = [
313     ":common",
314     ":receiver",
315     ":sender",
316     ":test_support",
317     "//base/test:run_all_unittests",
318     "//base/test:test_support",
319     "//testing/gmock",
320     "//testing/gtest",
321   ]
324 if (is_ios || is_mac) {
325   test("cast_h264_vt_encoder_unittests") {
326     sources = [
327       "sender/h264_vt_encoder_unittest.cc",
328     ]
329     deps = [
330       ":common",
331       ":sender",
332       ":test_support",
333       "//base/test:test_support",
334       "//testing/gmock",
335       "//testing/gtest",
336       "//third_party/ffmpeg",
337     ]
338   }
341 executable("generate_barcode_video") {
342   testonly = true
343   sources = [
344     "test/utility/generate_barcode_video.cc",
345   ]
347   deps = [
348     ":test_support",
349     "//base",
350     "//media",
351   ]
354 executable("generate_timecode_audio") {
355   testonly = true
356   sources = [
357     "test/utility/generate_timecode_audio.cc",
358   ]
360   deps = [
361     ":test_support",
362     "//base",
363     "//media",
364   ]
367 executable("udp_proxy") {
368   testonly = true
369   sources = [
370     "test/utility/udp_proxy_main.cc",
371   ]
373   deps = [
374     ":test_support",
375     "//base",
376     "//net",
377   ]
380 if (is_linux && !is_chromeos) {
381   # TODO(GYP): Figure out which of these work and are needed on other platforms.
382   test("cast_benchmarks") {
383     sources = [
384       "test/cast_benchmarks.cc",
385       "test/fake_single_thread_task_runner.cc",
386       "test/fake_single_thread_task_runner.h",
387       "test/utility/test_util.cc",
388       "test/utility/test_util.h",
389     ]
391     deps = [
392       ":common",
393       ":net",
394       ":receiver",
395       ":sender",
396       ":test_support",
397       "//base/test:test_support",
398       "//net",
399       "//testing/gtest",
400     ]
401   }
403   test("tap_proxy") {
404     sources = [
405       "test/utility/tap_proxy.cc",
406     ]
408     deps = [
409       ":test_support",
410       "//base",
411       "//media",
412     ]
413   }