blob: 6473cf68cc4624f6e198fcb61e295ba4ef98e61d [file] [log] [blame]
kjellanderc76dc952016-06-03 03:09:32 -07001# Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
2#
3# Use of this source code is governed by a BSD-style license
4# that can be found in the LICENSE file in the root of the source
5# tree. An additional intellectual property rights grant can be found
6# in the file PATENTS. All contributing project authors may
7# be found in the AUTHORS file in the root of the source tree.
8
mbonadei9aa3f0a2017-01-24 06:58:22 -08009import("../webrtc.gni")
ossu7bb87ee2017-01-23 04:56:25 -080010if (is_android) {
11 import("//build/config/android/config.gni")
12 import("//build/config/android/rules.gni")
13}
kjellanderc76dc952016-06-03 03:09:32 -070014
15group("pc") {
kjellander705ecc52016-09-15 00:53:26 -070016 public_deps = [
kjellanderc76dc952016-06-03 03:09:32 -070017 ":rtc_pc",
18 ]
19}
20
21config("rtc_pc_config") {
jbaucheaa9c1d2017-03-06 11:32:22 -080022 defines = []
deadbeef40610e22016-12-22 10:53:38 -080023 if (rtc_enable_sctp) {
24 defines += [ "HAVE_SCTP" ]
25 }
kjellanderc76dc952016-06-03 03:09:32 -070026}
27
zhihuang38ede132017-06-15 12:52:32 -070028rtc_static_library("rtc_pc_base") {
kjellanderc76dc952016-06-03 03:09:32 -070029 defines = []
30 sources = [
31 "audiomonitor.cc",
32 "audiomonitor.h",
33 "bundlefilter.cc",
34 "bundlefilter.h",
35 "channel.cc",
36 "channel.h",
37 "channelmanager.cc",
38 "channelmanager.h",
39 "currentspeakermonitor.cc",
40 "currentspeakermonitor.h",
jbauchdfcab722017-03-06 00:14:10 -080041 "externalhmac.cc",
42 "externalhmac.h",
kjellanderc76dc952016-06-03 03:09:32 -070043 "mediamonitor.cc",
44 "mediamonitor.h",
45 "mediasession.cc",
46 "mediasession.h",
kjellanderc76dc952016-06-03 03:09:32 -070047 "rtcpmuxfilter.cc",
48 "rtcpmuxfilter.h",
zsteind48dbda2017-04-04 19:45:57 -070049 "rtptransport.cc",
50 "rtptransport.h",
zstein398c3fd2017-07-19 13:38:02 -070051 "rtptransportinternal.h",
kjellanderc76dc952016-06-03 03:09:32 -070052 "srtpfilter.cc",
53 "srtpfilter.h",
zstein4dde3df2017-07-07 14:26:25 -070054 "srtpsession.cc",
55 "srtpsession.h",
zstein398c3fd2017-07-19 13:38:02 -070056 "srtptransport.cc",
57 "srtptransport.h",
kjellanderc76dc952016-06-03 03:09:32 -070058 "voicechannel.h",
59 ]
60
61 deps = [
mbonadei7d9a55b2017-06-01 13:01:48 -070062 "..:webrtc_common",
kjellandera69d9732016-08-31 07:33:05 -070063 "../api:call_api",
mbonadei7d9a55b2017-06-01 13:01:48 -070064 "../api:libjingle_peerconnection_api",
65 "../api:ortc_api",
zhihuang38ede132017-06-15 12:52:32 -070066 "../media:rtc_data",
zhihuang130ca7e2017-06-21 01:02:59 -070067 "../media:rtc_h264_profile_id",
zhihuang38ede132017-06-15 12:52:32 -070068 "../media:rtc_media_base",
mbonadei7d9a55b2017-06-01 13:01:48 -070069 "../p2p:rtc_p2p",
ehmaldonadof6a861a2017-07-19 10:40:47 -070070 "../rtc_base:rtc_base",
71 "../rtc_base:rtc_task_queue",
kjellanderc76dc952016-06-03 03:09:32 -070072 ]
73
kjellanderc76dc952016-06-03 03:09:32 -070074 if (rtc_build_libsrtp) {
75 deps += [ "//third_party/libsrtp" ]
76 }
77
ehmaldonadoe9cc6862016-09-05 06:10:18 -070078 public_configs = [ ":rtc_pc_config" ]
kjellanderc76dc952016-06-03 03:09:32 -070079
kjellandere40a7ee2016-10-16 23:56:12 -070080 if (!build_with_chromium && is_clang) {
kjellander142f8c52016-06-13 00:08:24 -070081 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
ehmaldonado38a21322016-09-02 04:10:34 -070082 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellanderc76dc952016-06-03 03:09:32 -070083 }
84}
kjellander142f8c52016-06-13 00:08:24 -070085
zhihuang38ede132017-06-15 12:52:32 -070086rtc_source_set("rtc_pc") {
87 public_deps = [
88 ":rtc_pc_base",
89 ]
90
91 deps = [
92 "../media:rtc_audio_video",
93 ]
94}
95
ossu7bb87ee2017-01-23 04:56:25 -080096config("libjingle_peerconnection_warnings_config") {
97 # GN orders flags on a target before flags from configs. The default config
98 # adds these flags so to cancel them out they need to come from a config and
99 # cannot be on the target directly.
100 if (!is_win && !is_clang) {
101 cflags = [ "-Wno-maybe-uninitialized" ] # Only exists for GCC.
102 }
103}
104
zhihuang38ede132017-06-15 12:52:32 -0700105rtc_static_library("peerconnection") {
ossu7bb87ee2017-01-23 04:56:25 -0800106 cflags = []
107 sources = [
108 "audiotrack.cc",
109 "audiotrack.h",
110 "datachannel.cc",
111 "datachannel.h",
112 "dtmfsender.cc",
113 "dtmfsender.h",
deadbeef1dcb1642017-03-29 21:08:16 -0700114 "iceserverparsing.cc",
115 "iceserverparsing.h",
ossu7bb87ee2017-01-23 04:56:25 -0800116 "jsepicecandidate.cc",
117 "jsepsessiondescription.cc",
118 "localaudiosource.cc",
119 "localaudiosource.h",
ossu7bb87ee2017-01-23 04:56:25 -0800120 "mediastream.cc",
121 "mediastream.h",
122 "mediastreamobserver.cc",
123 "mediastreamobserver.h",
124 "mediastreamtrack.h",
ossu7bb87ee2017-01-23 04:56:25 -0800125 "peerconnection.cc",
126 "peerconnection.h",
127 "peerconnectionfactory.cc",
128 "peerconnectionfactory.h",
129 "remoteaudiosource.cc",
130 "remoteaudiosource.h",
131 "rtcstatscollector.cc",
132 "rtcstatscollector.h",
133 "rtpreceiver.cc",
134 "rtpreceiver.h",
135 "rtpsender.cc",
136 "rtpsender.h",
137 "sctputils.cc",
138 "sctputils.h",
139 "statscollector.cc",
140 "statscollector.h",
141 "streamcollection.h",
deadbeef804c1af2017-02-11 19:07:31 -0800142 "trackmediainfomap.cc",
143 "trackmediainfomap.h",
ossu7bb87ee2017-01-23 04:56:25 -0800144 "videocapturertracksource.cc",
145 "videocapturertracksource.h",
146 "videotrack.cc",
147 "videotrack.h",
148 "videotracksource.cc",
149 "videotracksource.h",
150 "webrtcsdp.cc",
151 "webrtcsdp.h",
152 "webrtcsession.cc",
153 "webrtcsession.h",
154 "webrtcsessiondescriptionfactory.cc",
155 "webrtcsessiondescriptionfactory.h",
156 ]
157
158 configs += [ ":libjingle_peerconnection_warnings_config" ]
159
160 if (!build_with_chromium && is_clang) {
161 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
162 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
163 }
164
165 deps = [
zhihuang38ede132017-06-15 12:52:32 -0700166 ":rtc_pc_base",
mbonadei7d9a55b2017-06-01 13:01:48 -0700167 "..:webrtc_common",
ossu7bb87ee2017-01-23 04:56:25 -0800168 "../api:call_api",
ossu7bb87ee2017-01-23 04:56:25 -0800169 "../api:rtc_stats_api",
ilnikd60d06a2017-04-05 03:02:20 -0700170 "../api/video_codecs:video_codecs_api",
zhihuang38ede132017-06-15 12:52:32 -0700171 "../call:call_interfaces",
mbonadei7d9a55b2017-06-01 13:01:48 -0700172 "../logging:rtc_event_log_api",
zhihuang38ede132017-06-15 12:52:32 -0700173 "../media:rtc_data",
174 "../media:rtc_media_base",
mbonadei7d9a55b2017-06-01 13:01:48 -0700175 "../p2p:rtc_p2p",
ehmaldonadof6a861a2017-07-19 10:40:47 -0700176 "../rtc_base:rtc_base",
177 "../rtc_base:rtc_base_approved",
ossu7bb87ee2017-01-23 04:56:25 -0800178 "../stats",
mbonadei7d9a55b2017-06-01 13:01:48 -0700179 "../system_wrappers:system_wrappers",
ossu7bb87ee2017-01-23 04:56:25 -0800180 ]
181
ossuda250062017-01-23 07:37:43 -0800182 public_deps = [
183 "../api:libjingle_peerconnection_api",
184 ]
zhihuang38ede132017-06-15 12:52:32 -0700185}
186
187# This target implements CreatePeerConnectionFactory methods that will create a
188# PeerConnection will full functionality (audio, video and data). Applications
189# that wish to reduce their binary size by ommitting functionality they don't
190# need should use CreateModularCreatePeerConnectionFactory instead, using the
191# "peerconnection" build target and other targets specific to their
192# requrements. See comment in peerconnectionfactoryinterface.h.
zhihuangab97e182017-06-22 01:28:59 -0700193rtc_static_library("create_pc_factory") {
zhihuang38ede132017-06-15 12:52:32 -0700194 sources = [
195 "createpeerconnectionfactory.cc",
196 ]
197
198 deps = [
199 "../api:audio_mixer_api",
200 "../api:libjingle_peerconnection_api",
201 "../api/audio_codecs:audio_codecs_api",
202 "../api/audio_codecs:builtin_audio_decoder_factory",
203 "../api/audio_codecs:builtin_audio_encoder_factory",
zhihuang38ede132017-06-15 12:52:32 -0700204 "../call",
205 "../call:call_interfaces",
206 "../logging:rtc_event_log_api",
207 "../media:rtc_audio_video",
208 "../modules/audio_device:audio_device",
peaha9cc40b2017-06-29 08:32:09 -0700209 "../modules/audio_processing:audio_processing",
ehmaldonadof6a861a2017-07-19 10:40:47 -0700210 "../rtc_base:rtc_base",
211 "../rtc_base:rtc_base_approved",
zhihuang38ede132017-06-15 12:52:32 -0700212 ]
213
214 configs += [ ":libjingle_peerconnection_warnings_config" ]
215
216 if (!build_with_chromium && is_clang) {
217 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
218 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
219 }
220}
221
222rtc_source_set("libjingle_peerconnection") {
223 public_deps = [
224 ":create_pc_factory",
225 ":peerconnection",
226 "../api:libjingle_peerconnection_api",
227 ]
ossuda250062017-01-23 07:37:43 -0800228
ossu7bb87ee2017-01-23 04:56:25 -0800229 if (rtc_use_quic) {
230 sources += [
231 "quicdatachannel.cc",
232 "quicdatachannel.h",
233 "quicdatatransport.cc",
234 "quicdatatransport.h",
235 ]
236 deps += [ "//third_party/libquic" ]
237 public_deps = [
238 "//third_party/libquic",
239 ]
240 }
241}
242
kjellander142f8c52016-06-13 00:08:24 -0700243if (rtc_include_tests) {
244 config("rtc_pc_unittests_config") {
245 # GN orders flags on a target before flags from configs. The default config
246 # adds -Wall, and this flag have to be after -Wall -- so they need to
247 # come from a config and can't be on the target directly.
248 if (!is_win && !is_clang) {
249 cflags = [ "-Wno-maybe-uninitialized" ] # Only exists for GCC.
250 }
251 }
252
ehmaldonado38a21322016-09-02 04:10:34 -0700253 rtc_test("rtc_pc_unittests") {
kjellander142f8c52016-06-13 00:08:24 -0700254 testonly = true
255
256 sources = [
257 "bundlefilter_unittest.cc",
258 "channel_unittest.cc",
259 "channelmanager_unittest.cc",
260 "currentspeakermonitor_unittest.cc",
261 "mediasession_unittest.cc",
262 "rtcpmuxfilter_unittest.cc",
zstein56162b92017-04-24 16:54:35 -0700263 "rtptransport_unittest.cc",
zstein398c3fd2017-07-19 13:38:02 -0700264 "rtptransporttestutil.h",
kjellander142f8c52016-06-13 00:08:24 -0700265 "srtpfilter_unittest.cc",
zstein4dde3df2017-07-07 14:26:25 -0700266 "srtpsession_unittest.cc",
267 "srtptestutil.h",
zstein398c3fd2017-07-19 13:38:02 -0700268 "srtptransport_unittest.cc",
kjellander142f8c52016-06-13 00:08:24 -0700269 ]
270
271 include_dirs = [ "//third_party/libsrtp/srtp" ]
272
ehmaldonado7a2ce0b2016-09-05 01:35:44 -0700273 configs += [ ":rtc_pc_unittests_config" ]
kjellander142f8c52016-06-13 00:08:24 -0700274
kjellandere40a7ee2016-10-16 23:56:12 -0700275 if (!build_with_chromium && is_clang) {
kjellander142f8c52016-06-13 00:08:24 -0700276 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
ehmaldonado38a21322016-09-02 04:10:34 -0700277 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellander142f8c52016-06-13 00:08:24 -0700278 }
279
280 if (is_win) {
281 libs = [ "strmiids.lib" ]
282 }
283
284 deps = [
ossu7bb87ee2017-01-23 04:56:25 -0800285 ":libjingle_peerconnection",
kjellander142f8c52016-06-13 00:08:24 -0700286 ":rtc_pc",
kwiberg529662a2017-09-04 05:43:17 -0700287 "../api:array_view",
mbonadei7d9a55b2017-06-01 13:01:48 -0700288 "../logging:rtc_event_log_api",
289 "../media:rtc_media_base",
mbonadei9087d492017-04-25 00:35:35 -0700290 "../media:rtc_media_tests_utils",
mbonadei7d9a55b2017-06-01 13:01:48 -0700291 "../p2p:p2p_test_utils",
292 "../p2p:rtc_p2p",
ehmaldonadof6a861a2017-07-19 10:40:47 -0700293 "../rtc_base:rtc_base",
294 "../rtc_base:rtc_base_approved",
295 "../rtc_base:rtc_base_tests_main",
296 "../rtc_base:rtc_base_tests_utils",
kjellander142f8c52016-06-13 00:08:24 -0700297 "../system_wrappers:metrics_default",
zstein398c3fd2017-07-19 13:38:02 -0700298 "../test:test_support",
kjellander142f8c52016-06-13 00:08:24 -0700299 ]
300
301 if (rtc_build_libsrtp) {
302 deps += [ "//third_party/libsrtp" ]
303 }
304
305 if (is_android) {
306 deps += [ "//testing/android/native_test:native_test_support" ]
307 }
308 }
ossu7bb87ee2017-01-23 04:56:25 -0800309
deadbeefe814a0d2017-02-25 18:15:09 -0800310 rtc_source_set("pc_test_utils") {
311 testonly = true
312 sources = [
313 "test/fakeaudiocapturemodule.cc",
314 "test/fakeaudiocapturemodule.h",
315 "test/fakedatachannelprovider.h",
316 "test/fakeperiodicvideocapturer.h",
317 "test/fakertccertificategenerator.h",
318 "test/fakevideotrackrenderer.h",
319 "test/fakevideotracksource.h",
320 "test/mock_datachannel.h",
321 "test/mock_peerconnection.h",
322 "test/mock_webrtcsession.h",
323 "test/mockpeerconnectionobservers.h",
324 "test/peerconnectiontestwrapper.cc",
325 "test/peerconnectiontestwrapper.h",
326 "test/rtcstatsobtainer.h",
327 "test/testsdpstrings.h",
328 ]
329
330 deps = [
331 ":libjingle_peerconnection",
mbonadei7d9a55b2017-06-01 13:01:48 -0700332 "..:webrtc_common",
333 "../api:libjingle_peerconnection_test_api",
334 "../api:rtc_stats_api",
zhihuang38ede132017-06-15 12:52:32 -0700335 "../call:call_interfaces",
336 "../logging:rtc_event_log_api",
mbonadei7d9a55b2017-06-01 13:01:48 -0700337 "../media:rtc_media",
338 "../media:rtc_media_tests_utils",
339 "../modules/audio_device:audio_device",
340 "../p2p:p2p_test_utils",
ehmaldonadof6a861a2017-07-19 10:40:47 -0700341 "../rtc_base:rtc_base",
342 "../rtc_base:rtc_base_approved",
343 "../rtc_base:rtc_base_tests_utils",
mbonadei7d9a55b2017-06-01 13:01:48 -0700344 "../test:test_support",
deadbeefe814a0d2017-02-25 18:15:09 -0800345 "//testing/gmock",
346 ]
347
348 if (!build_with_chromium && is_clang) {
349 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
350 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
351 }
352 }
353
ossu7bb87ee2017-01-23 04:56:25 -0800354 config("peerconnection_unittests_config") {
355 # The warnings below are enabled by default. Since GN orders compiler flags
356 # for a target before flags from configs, the only way to disable such
357 # warnings is by having them in a separate config, loaded from the target.
358 # TODO(kjellander): Make the code compile without disabling these flags.
359 # See https://bugs.webrtc.org/3307.
360 if (is_clang && is_win) {
361 cflags = [
362 # See https://bugs.chromium.org/p/webrtc/issues/detail?id=6267
363 # for -Wno-sign-compare
364 "-Wno-sign-compare",
ossu7bb87ee2017-01-23 04:56:25 -0800365 ]
366 }
367
368 if (!is_win) {
369 cflags = [ "-Wno-sign-compare" ]
370 }
371 }
372
373 rtc_test("peerconnection_unittests") {
374 check_includes = false # TODO(kjellander): Remove (bugs.webrtc.org/6828)
375 testonly = true
376 sources = [
377 "datachannel_unittest.cc",
378 "dtmfsender_unittest.cc",
deadbeef1dcb1642017-03-29 21:08:16 -0700379 "iceserverparsing_unittest.cc",
ossu7bb87ee2017-01-23 04:56:25 -0800380 "jsepsessiondescription_unittest.cc",
381 "localaudiosource_unittest.cc",
382 "mediaconstraintsinterface_unittest.cc",
383 "mediastream_unittest.cc",
deadbeef1dcb1642017-03-29 21:08:16 -0700384 "peerconnection_integrationtest.cc",
ossu7bb87ee2017-01-23 04:56:25 -0800385 "peerconnectionendtoend_unittest.cc",
386 "peerconnectionfactory_unittest.cc",
387 "peerconnectioninterface_unittest.cc",
388 "proxy_unittest.cc",
389 "rtcstats_integrationtest.cc",
390 "rtcstatscollector_unittest.cc",
391 "rtpsenderreceiver_unittest.cc",
392 "sctputils_unittest.cc",
393 "statscollector_unittest.cc",
ossu7bb87ee2017-01-23 04:56:25 -0800394 "test/fakeaudiocapturemodule_unittest.cc",
ossu7bb87ee2017-01-23 04:56:25 -0800395 "test/testsdpstrings.h",
deadbeef804c1af2017-02-11 19:07:31 -0800396 "trackmediainfomap_unittest.cc",
ossu7bb87ee2017-01-23 04:56:25 -0800397 "videocapturertracksource_unittest.cc",
398 "videotrack_unittest.cc",
399 "webrtcsdp_unittest.cc",
400 "webrtcsession_unittest.cc",
401 ]
402
403 if (rtc_enable_sctp) {
404 defines = [ "HAVE_SCTP" ]
405 }
406
407 configs += [ ":peerconnection_unittests_config" ]
408
409 if (!build_with_chromium && is_clang) {
410 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
411 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
412 }
413
414 # TODO(jschuh): Bug 1348: fix this warning.
415 configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
416
417 if (is_win) {
418 cflags = [
419 "/wd4245", # conversion from int to size_t, signed/unsigned mismatch.
420 "/wd4389", # signed/unsigned mismatch.
421 ]
422 }
423
424 if (rtc_use_quic) {
425 public_deps = [
426 "//third_party/libquic",
427 ]
428 sources += [
429 "quicdatachannel_unittest.cc",
430 "quicdatatransport_unittest.cc",
431 ]
432 }
433
434 deps = []
435 if (is_android) {
436 sources += [
437 "test/androidtestinitializer.cc",
438 "test/androidtestinitializer.h",
439 ]
440 deps += [
jianjun.zhuc0247402017-07-11 06:20:45 -0700441 "../sdk/android:libjingle_peerconnection_java",
442 "../sdk/android:libjingle_peerconnection_jni",
ossu7bb87ee2017-01-23 04:56:25 -0800443 "//testing/android/native_test:native_test_support",
ossu7bb87ee2017-01-23 04:56:25 -0800444 ]
445 }
446
447 deps += [
448 ":libjingle_peerconnection",
deadbeefe814a0d2017-02-25 18:15:09 -0800449 ":pc_test_utils",
ossu7bb87ee2017-01-23 04:56:25 -0800450 "..:webrtc_common",
451 "../api:fakemetricsobserver",
mbonadei9087d492017-04-25 00:35:35 -0700452 "../media:rtc_media_tests_utils",
ossu7bb87ee2017-01-23 04:56:25 -0800453 "../pc:rtc_pc",
ehmaldonadof6a861a2017-07-19 10:40:47 -0700454 "../rtc_base:rtc_base_tests_main",
455 "../rtc_base:rtc_base_tests_utils",
ossu7bb87ee2017-01-23 04:56:25 -0800456 "../system_wrappers:metrics_default",
kwiberg2b3aa142017-06-14 03:31:17 -0700457 "../test:audio_codec_mocks",
ossu7bb87ee2017-01-23 04:56:25 -0800458 "//testing/gmock",
459 ]
460
461 if (is_android) {
462 deps += [ "//testing/android/native_test:native_test_support" ]
463
464 shard_timeout = 900
465 }
466 }
kjellander142f8c52016-06-13 00:08:24 -0700467}