blob: 09c58ab221b815e44f85ce9fb5846ab5e0d31ce0 [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",
kwiberg84f6a3f2017-09-05 08:43:13 -070065 "../api:optional",
mbonadei7d9a55b2017-06-01 13:01:48 -070066 "../api:ortc_api",
zhihuang38ede132017-06-15 12:52:32 -070067 "../media:rtc_data",
zhihuang130ca7e2017-06-21 01:02:59 -070068 "../media:rtc_h264_profile_id",
zhihuang38ede132017-06-15 12:52:32 -070069 "../media:rtc_media_base",
mbonadei7d9a55b2017-06-01 13:01:48 -070070 "../p2p:rtc_p2p",
ehmaldonadof6a861a2017-07-19 10:40:47 -070071 "../rtc_base:rtc_base",
72 "../rtc_base:rtc_task_queue",
kjellanderc76dc952016-06-03 03:09:32 -070073 ]
74
kjellanderc76dc952016-06-03 03:09:32 -070075 if (rtc_build_libsrtp) {
76 deps += [ "//third_party/libsrtp" ]
77 }
78
ehmaldonadoe9cc6862016-09-05 06:10:18 -070079 public_configs = [ ":rtc_pc_config" ]
kjellanderc76dc952016-06-03 03:09:32 -070080
kjellandere40a7ee2016-10-16 23:56:12 -070081 if (!build_with_chromium && is_clang) {
kjellander142f8c52016-06-13 00:08:24 -070082 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
ehmaldonado38a21322016-09-02 04:10:34 -070083 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellanderc76dc952016-06-03 03:09:32 -070084 }
85}
kjellander142f8c52016-06-13 00:08:24 -070086
zhihuang38ede132017-06-15 12:52:32 -070087rtc_source_set("rtc_pc") {
88 public_deps = [
89 ":rtc_pc_base",
90 ]
91
92 deps = [
93 "../media:rtc_audio_video",
94 ]
95}
96
ossu7bb87ee2017-01-23 04:56:25 -080097config("libjingle_peerconnection_warnings_config") {
98 # GN orders flags on a target before flags from configs. The default config
99 # adds these flags so to cancel them out they need to come from a config and
100 # cannot be on the target directly.
101 if (!is_win && !is_clang) {
102 cflags = [ "-Wno-maybe-uninitialized" ] # Only exists for GCC.
103 }
104}
105
zhihuang38ede132017-06-15 12:52:32 -0700106rtc_static_library("peerconnection") {
ossu7bb87ee2017-01-23 04:56:25 -0800107 cflags = []
108 sources = [
109 "audiotrack.cc",
110 "audiotrack.h",
111 "datachannel.cc",
112 "datachannel.h",
113 "dtmfsender.cc",
114 "dtmfsender.h",
deadbeef1dcb1642017-03-29 21:08:16 -0700115 "iceserverparsing.cc",
116 "iceserverparsing.h",
ossu7bb87ee2017-01-23 04:56:25 -0800117 "jsepicecandidate.cc",
118 "jsepsessiondescription.cc",
119 "localaudiosource.cc",
120 "localaudiosource.h",
ossu7bb87ee2017-01-23 04:56:25 -0800121 "mediastream.cc",
122 "mediastream.h",
123 "mediastreamobserver.cc",
124 "mediastreamobserver.h",
125 "mediastreamtrack.h",
ossu7bb87ee2017-01-23 04:56:25 -0800126 "peerconnection.cc",
127 "peerconnection.h",
128 "peerconnectionfactory.cc",
129 "peerconnectionfactory.h",
130 "remoteaudiosource.cc",
131 "remoteaudiosource.h",
132 "rtcstatscollector.cc",
133 "rtcstatscollector.h",
134 "rtpreceiver.cc",
135 "rtpreceiver.h",
136 "rtpsender.cc",
137 "rtpsender.h",
138 "sctputils.cc",
139 "sctputils.h",
140 "statscollector.cc",
141 "statscollector.h",
142 "streamcollection.h",
deadbeef804c1af2017-02-11 19:07:31 -0800143 "trackmediainfomap.cc",
144 "trackmediainfomap.h",
ossu7bb87ee2017-01-23 04:56:25 -0800145 "videocapturertracksource.cc",
146 "videocapturertracksource.h",
147 "videotrack.cc",
148 "videotrack.h",
149 "videotracksource.cc",
150 "videotracksource.h",
151 "webrtcsdp.cc",
152 "webrtcsdp.h",
153 "webrtcsession.cc",
154 "webrtcsession.h",
155 "webrtcsessiondescriptionfactory.cc",
156 "webrtcsessiondescriptionfactory.h",
157 ]
158
159 configs += [ ":libjingle_peerconnection_warnings_config" ]
160
161 if (!build_with_chromium && is_clang) {
162 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
163 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
164 }
165
166 deps = [
zhihuang38ede132017-06-15 12:52:32 -0700167 ":rtc_pc_base",
mbonadei7d9a55b2017-06-01 13:01:48 -0700168 "..:webrtc_common",
ossu7bb87ee2017-01-23 04:56:25 -0800169 "../api:call_api",
kwiberg84f6a3f2017-09-05 08:43:13 -0700170 "../api:optional",
ossu7bb87ee2017-01-23 04:56:25 -0800171 "../api:rtc_stats_api",
ilnikd60d06a2017-04-05 03:02:20 -0700172 "../api/video_codecs:video_codecs_api",
zhihuang38ede132017-06-15 12:52:32 -0700173 "../call:call_interfaces",
mbonadei7d9a55b2017-06-01 13:01:48 -0700174 "../logging:rtc_event_log_api",
zhihuang38ede132017-06-15 12:52:32 -0700175 "../media:rtc_data",
176 "../media:rtc_media_base",
mbonadei7d9a55b2017-06-01 13:01:48 -0700177 "../p2p:rtc_p2p",
ehmaldonadof6a861a2017-07-19 10:40:47 -0700178 "../rtc_base:rtc_base",
179 "../rtc_base:rtc_base_approved",
ossu7bb87ee2017-01-23 04:56:25 -0800180 "../stats",
mbonadei7d9a55b2017-06-01 13:01:48 -0700181 "../system_wrappers:system_wrappers",
ossu7bb87ee2017-01-23 04:56:25 -0800182 ]
183
ossuda250062017-01-23 07:37:43 -0800184 public_deps = [
185 "../api:libjingle_peerconnection_api",
186 ]
zhihuang38ede132017-06-15 12:52:32 -0700187}
188
189# This target implements CreatePeerConnectionFactory methods that will create a
190# PeerConnection will full functionality (audio, video and data). Applications
191# that wish to reduce their binary size by ommitting functionality they don't
192# need should use CreateModularCreatePeerConnectionFactory instead, using the
193# "peerconnection" build target and other targets specific to their
194# requrements. See comment in peerconnectionfactoryinterface.h.
zhihuangab97e182017-06-22 01:28:59 -0700195rtc_static_library("create_pc_factory") {
zhihuang38ede132017-06-15 12:52:32 -0700196 sources = [
197 "createpeerconnectionfactory.cc",
198 ]
199
200 deps = [
201 "../api:audio_mixer_api",
202 "../api:libjingle_peerconnection_api",
203 "../api/audio_codecs:audio_codecs_api",
204 "../api/audio_codecs:builtin_audio_decoder_factory",
205 "../api/audio_codecs:builtin_audio_encoder_factory",
zhihuang38ede132017-06-15 12:52:32 -0700206 "../call",
207 "../call:call_interfaces",
208 "../logging:rtc_event_log_api",
209 "../media:rtc_audio_video",
210 "../modules/audio_device:audio_device",
peaha9cc40b2017-06-29 08:32:09 -0700211 "../modules/audio_processing:audio_processing",
ehmaldonadof6a861a2017-07-19 10:40:47 -0700212 "../rtc_base:rtc_base",
213 "../rtc_base:rtc_base_approved",
zhihuang38ede132017-06-15 12:52:32 -0700214 ]
215
216 configs += [ ":libjingle_peerconnection_warnings_config" ]
217
218 if (!build_with_chromium && is_clang) {
219 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
220 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
221 }
222}
223
224rtc_source_set("libjingle_peerconnection") {
225 public_deps = [
226 ":create_pc_factory",
227 ":peerconnection",
228 "../api:libjingle_peerconnection_api",
229 ]
ossuda250062017-01-23 07:37:43 -0800230
ossu7bb87ee2017-01-23 04:56:25 -0800231 if (rtc_use_quic) {
232 sources += [
233 "quicdatachannel.cc",
234 "quicdatachannel.h",
235 "quicdatatransport.cc",
236 "quicdatatransport.h",
237 ]
238 deps += [ "//third_party/libquic" ]
239 public_deps = [
240 "//third_party/libquic",
241 ]
242 }
243}
244
kjellander142f8c52016-06-13 00:08:24 -0700245if (rtc_include_tests) {
246 config("rtc_pc_unittests_config") {
247 # GN orders flags on a target before flags from configs. The default config
248 # adds -Wall, and this flag have to be after -Wall -- so they need to
249 # come from a config and can't be on the target directly.
250 if (!is_win && !is_clang) {
251 cflags = [ "-Wno-maybe-uninitialized" ] # Only exists for GCC.
252 }
253 }
254
ehmaldonado38a21322016-09-02 04:10:34 -0700255 rtc_test("rtc_pc_unittests") {
kjellander142f8c52016-06-13 00:08:24 -0700256 testonly = true
257
258 sources = [
259 "bundlefilter_unittest.cc",
260 "channel_unittest.cc",
261 "channelmanager_unittest.cc",
262 "currentspeakermonitor_unittest.cc",
263 "mediasession_unittest.cc",
264 "rtcpmuxfilter_unittest.cc",
zstein56162b92017-04-24 16:54:35 -0700265 "rtptransport_unittest.cc",
zstein398c3fd2017-07-19 13:38:02 -0700266 "rtptransporttestutil.h",
kjellander142f8c52016-06-13 00:08:24 -0700267 "srtpfilter_unittest.cc",
zstein4dde3df2017-07-07 14:26:25 -0700268 "srtpsession_unittest.cc",
269 "srtptestutil.h",
zstein398c3fd2017-07-19 13:38:02 -0700270 "srtptransport_unittest.cc",
kjellander142f8c52016-06-13 00:08:24 -0700271 ]
272
273 include_dirs = [ "//third_party/libsrtp/srtp" ]
274
ehmaldonado7a2ce0b2016-09-05 01:35:44 -0700275 configs += [ ":rtc_pc_unittests_config" ]
kjellander142f8c52016-06-13 00:08:24 -0700276
kjellandere40a7ee2016-10-16 23:56:12 -0700277 if (!build_with_chromium && is_clang) {
kjellander142f8c52016-06-13 00:08:24 -0700278 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
ehmaldonado38a21322016-09-02 04:10:34 -0700279 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellander142f8c52016-06-13 00:08:24 -0700280 }
281
282 if (is_win) {
283 libs = [ "strmiids.lib" ]
284 }
285
286 deps = [
ossu7bb87ee2017-01-23 04:56:25 -0800287 ":libjingle_peerconnection",
kjellander142f8c52016-06-13 00:08:24 -0700288 ":rtc_pc",
kwiberg529662a2017-09-04 05:43:17 -0700289 "../api:array_view",
mbonadei7d9a55b2017-06-01 13:01:48 -0700290 "../logging:rtc_event_log_api",
291 "../media:rtc_media_base",
mbonadei9087d492017-04-25 00:35:35 -0700292 "../media:rtc_media_tests_utils",
mbonadei7d9a55b2017-06-01 13:01:48 -0700293 "../p2p:p2p_test_utils",
294 "../p2p:rtc_p2p",
ehmaldonadof6a861a2017-07-19 10:40:47 -0700295 "../rtc_base:rtc_base",
296 "../rtc_base:rtc_base_approved",
297 "../rtc_base:rtc_base_tests_main",
298 "../rtc_base:rtc_base_tests_utils",
kjellander142f8c52016-06-13 00:08:24 -0700299 "../system_wrappers:metrics_default",
zstein398c3fd2017-07-19 13:38:02 -0700300 "../test:test_support",
kjellander142f8c52016-06-13 00:08:24 -0700301 ]
302
303 if (rtc_build_libsrtp) {
304 deps += [ "//third_party/libsrtp" ]
305 }
306
307 if (is_android) {
308 deps += [ "//testing/android/native_test:native_test_support" ]
309 }
310 }
ossu7bb87ee2017-01-23 04:56:25 -0800311
deadbeefe814a0d2017-02-25 18:15:09 -0800312 rtc_source_set("pc_test_utils") {
313 testonly = true
314 sources = [
315 "test/fakeaudiocapturemodule.cc",
316 "test/fakeaudiocapturemodule.h",
317 "test/fakedatachannelprovider.h",
318 "test/fakeperiodicvideocapturer.h",
319 "test/fakertccertificategenerator.h",
320 "test/fakevideotrackrenderer.h",
321 "test/fakevideotracksource.h",
322 "test/mock_datachannel.h",
323 "test/mock_peerconnection.h",
324 "test/mock_webrtcsession.h",
325 "test/mockpeerconnectionobservers.h",
326 "test/peerconnectiontestwrapper.cc",
327 "test/peerconnectiontestwrapper.h",
328 "test/rtcstatsobtainer.h",
329 "test/testsdpstrings.h",
330 ]
331
332 deps = [
333 ":libjingle_peerconnection",
mbonadei7d9a55b2017-06-01 13:01:48 -0700334 "..:webrtc_common",
335 "../api:libjingle_peerconnection_test_api",
336 "../api:rtc_stats_api",
zhihuang38ede132017-06-15 12:52:32 -0700337 "../call:call_interfaces",
338 "../logging:rtc_event_log_api",
mbonadei7d9a55b2017-06-01 13:01:48 -0700339 "../media:rtc_media",
340 "../media:rtc_media_tests_utils",
341 "../modules/audio_device:audio_device",
342 "../p2p:p2p_test_utils",
ehmaldonadof6a861a2017-07-19 10:40:47 -0700343 "../rtc_base:rtc_base",
344 "../rtc_base:rtc_base_approved",
345 "../rtc_base:rtc_base_tests_utils",
mbonadei7d9a55b2017-06-01 13:01:48 -0700346 "../test:test_support",
deadbeefe814a0d2017-02-25 18:15:09 -0800347 "//testing/gmock",
348 ]
349
350 if (!build_with_chromium && is_clang) {
351 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
352 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
353 }
354 }
355
ossu7bb87ee2017-01-23 04:56:25 -0800356 config("peerconnection_unittests_config") {
357 # The warnings below are enabled by default. Since GN orders compiler flags
358 # for a target before flags from configs, the only way to disable such
359 # warnings is by having them in a separate config, loaded from the target.
360 # TODO(kjellander): Make the code compile without disabling these flags.
361 # See https://bugs.webrtc.org/3307.
362 if (is_clang && is_win) {
363 cflags = [
364 # See https://bugs.chromium.org/p/webrtc/issues/detail?id=6267
365 # for -Wno-sign-compare
366 "-Wno-sign-compare",
ossu7bb87ee2017-01-23 04:56:25 -0800367 ]
368 }
369
370 if (!is_win) {
371 cflags = [ "-Wno-sign-compare" ]
372 }
373 }
374
375 rtc_test("peerconnection_unittests") {
376 check_includes = false # TODO(kjellander): Remove (bugs.webrtc.org/6828)
377 testonly = true
378 sources = [
379 "datachannel_unittest.cc",
380 "dtmfsender_unittest.cc",
deadbeef1dcb1642017-03-29 21:08:16 -0700381 "iceserverparsing_unittest.cc",
ossu7bb87ee2017-01-23 04:56:25 -0800382 "jsepsessiondescription_unittest.cc",
383 "localaudiosource_unittest.cc",
384 "mediaconstraintsinterface_unittest.cc",
385 "mediastream_unittest.cc",
deadbeef1dcb1642017-03-29 21:08:16 -0700386 "peerconnection_integrationtest.cc",
ossu7bb87ee2017-01-23 04:56:25 -0800387 "peerconnectionendtoend_unittest.cc",
388 "peerconnectionfactory_unittest.cc",
389 "peerconnectioninterface_unittest.cc",
390 "proxy_unittest.cc",
391 "rtcstats_integrationtest.cc",
392 "rtcstatscollector_unittest.cc",
393 "rtpsenderreceiver_unittest.cc",
394 "sctputils_unittest.cc",
395 "statscollector_unittest.cc",
ossu7bb87ee2017-01-23 04:56:25 -0800396 "test/fakeaudiocapturemodule_unittest.cc",
ossu7bb87ee2017-01-23 04:56:25 -0800397 "test/testsdpstrings.h",
deadbeef804c1af2017-02-11 19:07:31 -0800398 "trackmediainfomap_unittest.cc",
ossu7bb87ee2017-01-23 04:56:25 -0800399 "videocapturertracksource_unittest.cc",
400 "videotrack_unittest.cc",
401 "webrtcsdp_unittest.cc",
402 "webrtcsession_unittest.cc",
403 ]
404
405 if (rtc_enable_sctp) {
406 defines = [ "HAVE_SCTP" ]
407 }
408
409 configs += [ ":peerconnection_unittests_config" ]
410
411 if (!build_with_chromium && is_clang) {
412 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
413 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
414 }
415
416 # TODO(jschuh): Bug 1348: fix this warning.
417 configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
418
419 if (is_win) {
420 cflags = [
421 "/wd4245", # conversion from int to size_t, signed/unsigned mismatch.
422 "/wd4389", # signed/unsigned mismatch.
423 ]
424 }
425
426 if (rtc_use_quic) {
427 public_deps = [
428 "//third_party/libquic",
429 ]
430 sources += [
431 "quicdatachannel_unittest.cc",
432 "quicdatatransport_unittest.cc",
433 ]
434 }
435
436 deps = []
437 if (is_android) {
438 sources += [
439 "test/androidtestinitializer.cc",
440 "test/androidtestinitializer.h",
441 ]
442 deps += [
jianjun.zhuc0247402017-07-11 06:20:45 -0700443 "../sdk/android:libjingle_peerconnection_java",
444 "../sdk/android:libjingle_peerconnection_jni",
ossu7bb87ee2017-01-23 04:56:25 -0800445 "//testing/android/native_test:native_test_support",
ossu7bb87ee2017-01-23 04:56:25 -0800446 ]
447 }
448
449 deps += [
450 ":libjingle_peerconnection",
deadbeefe814a0d2017-02-25 18:15:09 -0800451 ":pc_test_utils",
ossu7bb87ee2017-01-23 04:56:25 -0800452 "..:webrtc_common",
453 "../api:fakemetricsobserver",
mbonadei9087d492017-04-25 00:35:35 -0700454 "../media:rtc_media_tests_utils",
ossu7bb87ee2017-01-23 04:56:25 -0800455 "../pc:rtc_pc",
ehmaldonadof6a861a2017-07-19 10:40:47 -0700456 "../rtc_base:rtc_base_tests_main",
457 "../rtc_base:rtc_base_tests_utils",
ossu7bb87ee2017-01-23 04:56:25 -0800458 "../system_wrappers:metrics_default",
kwiberg2b3aa142017-06-14 03:31:17 -0700459 "../test:audio_codec_mocks",
ossu7bb87ee2017-01-23 04:56:25 -0800460 "//testing/gmock",
461 ]
462
463 if (is_android) {
464 deps += [ "//testing/android/native_test:native_test_support" ]
465
466 shard_timeout = 900
467 }
468 }
kjellander142f8c52016-06-13 00:08:24 -0700469}