blob: 5190a93cf51d6bd57bc122d5bbb4ac6dd73612d1 [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",
kjellanderc76dc952016-06-03 03:09:32 -070051 "srtpfilter.cc",
52 "srtpfilter.h",
53 "voicechannel.h",
54 ]
55
56 deps = [
mbonadei7d9a55b2017-06-01 13:01:48 -070057 "..:webrtc_common",
kjellandera69d9732016-08-31 07:33:05 -070058 "../api:call_api",
mbonadei7d9a55b2017-06-01 13:01:48 -070059 "../api:libjingle_peerconnection_api",
60 "../api:ortc_api",
kjellanderc76dc952016-06-03 03:09:32 -070061 "../base:rtc_base",
zhihuang38ede132017-06-15 12:52:32 -070062 "../base:rtc_task_queue",
63 "../media:rtc_data",
zhihuang130ca7e2017-06-21 01:02:59 -070064 "../media:rtc_h264_profile_id",
zhihuang38ede132017-06-15 12:52:32 -070065 "../media:rtc_media_base",
mbonadei7d9a55b2017-06-01 13:01:48 -070066 "../p2p:rtc_p2p",
kjellanderc76dc952016-06-03 03:09:32 -070067 ]
68
kjellanderc76dc952016-06-03 03:09:32 -070069 if (rtc_build_libsrtp) {
70 deps += [ "//third_party/libsrtp" ]
71 }
72
ehmaldonadoe9cc6862016-09-05 06:10:18 -070073 public_configs = [ ":rtc_pc_config" ]
kjellanderc76dc952016-06-03 03:09:32 -070074
kjellandere40a7ee2016-10-16 23:56:12 -070075 if (!build_with_chromium && is_clang) {
kjellander142f8c52016-06-13 00:08:24 -070076 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
ehmaldonado38a21322016-09-02 04:10:34 -070077 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellanderc76dc952016-06-03 03:09:32 -070078 }
79}
kjellander142f8c52016-06-13 00:08:24 -070080
zhihuang38ede132017-06-15 12:52:32 -070081rtc_source_set("rtc_pc") {
82 public_deps = [
83 ":rtc_pc_base",
84 ]
85
86 deps = [
87 "../media:rtc_audio_video",
88 ]
89}
90
ossu7bb87ee2017-01-23 04:56:25 -080091config("libjingle_peerconnection_warnings_config") {
92 # GN orders flags on a target before flags from configs. The default config
93 # adds these flags so to cancel them out they need to come from a config and
94 # cannot be on the target directly.
95 if (!is_win && !is_clang) {
96 cflags = [ "-Wno-maybe-uninitialized" ] # Only exists for GCC.
97 }
98}
99
zhihuang38ede132017-06-15 12:52:32 -0700100rtc_static_library("peerconnection") {
ossu7bb87ee2017-01-23 04:56:25 -0800101 cflags = []
102 sources = [
103 "audiotrack.cc",
104 "audiotrack.h",
105 "datachannel.cc",
106 "datachannel.h",
107 "dtmfsender.cc",
108 "dtmfsender.h",
deadbeef1dcb1642017-03-29 21:08:16 -0700109 "iceserverparsing.cc",
110 "iceserverparsing.h",
ossu7bb87ee2017-01-23 04:56:25 -0800111 "jsepicecandidate.cc",
112 "jsepsessiondescription.cc",
113 "localaudiosource.cc",
114 "localaudiosource.h",
ossu7bb87ee2017-01-23 04:56:25 -0800115 "mediastream.cc",
116 "mediastream.h",
117 "mediastreamobserver.cc",
118 "mediastreamobserver.h",
119 "mediastreamtrack.h",
ossu7bb87ee2017-01-23 04:56:25 -0800120 "peerconnection.cc",
121 "peerconnection.h",
122 "peerconnectionfactory.cc",
123 "peerconnectionfactory.h",
124 "remoteaudiosource.cc",
125 "remoteaudiosource.h",
126 "rtcstatscollector.cc",
127 "rtcstatscollector.h",
128 "rtpreceiver.cc",
129 "rtpreceiver.h",
130 "rtpsender.cc",
131 "rtpsender.h",
132 "sctputils.cc",
133 "sctputils.h",
134 "statscollector.cc",
135 "statscollector.h",
136 "streamcollection.h",
deadbeef804c1af2017-02-11 19:07:31 -0800137 "trackmediainfomap.cc",
138 "trackmediainfomap.h",
ossu7bb87ee2017-01-23 04:56:25 -0800139 "videocapturertracksource.cc",
140 "videocapturertracksource.h",
141 "videotrack.cc",
142 "videotrack.h",
143 "videotracksource.cc",
144 "videotracksource.h",
145 "webrtcsdp.cc",
146 "webrtcsdp.h",
147 "webrtcsession.cc",
148 "webrtcsession.h",
149 "webrtcsessiondescriptionfactory.cc",
150 "webrtcsessiondescriptionfactory.h",
151 ]
152
153 configs += [ ":libjingle_peerconnection_warnings_config" ]
154
155 if (!build_with_chromium && is_clang) {
156 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
157 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
158 }
159
160 deps = [
zhihuang38ede132017-06-15 12:52:32 -0700161 ":rtc_pc_base",
mbonadei7d9a55b2017-06-01 13:01:48 -0700162 "..:webrtc_common",
ossu7bb87ee2017-01-23 04:56:25 -0800163 "../api:call_api",
ossu7bb87ee2017-01-23 04:56:25 -0800164 "../api:rtc_stats_api",
ilnikd60d06a2017-04-05 03:02:20 -0700165 "../api/video_codecs:video_codecs_api",
mbonadei7d9a55b2017-06-01 13:01:48 -0700166 "../base:rtc_base",
167 "../base:rtc_base_approved",
zhihuang38ede132017-06-15 12:52:32 -0700168 "../call:call_interfaces",
mbonadei7d9a55b2017-06-01 13:01:48 -0700169 "../logging:rtc_event_log_api",
zhihuang38ede132017-06-15 12:52:32 -0700170 "../media:rtc_data",
171 "../media:rtc_media_base",
mbonadei7d9a55b2017-06-01 13:01:48 -0700172 "../p2p:rtc_p2p",
ossu7bb87ee2017-01-23 04:56:25 -0800173 "../stats",
mbonadei7d9a55b2017-06-01 13:01:48 -0700174 "../system_wrappers:system_wrappers",
ossu7bb87ee2017-01-23 04:56:25 -0800175 ]
176
ossuda250062017-01-23 07:37:43 -0800177 public_deps = [
178 "../api:libjingle_peerconnection_api",
179 ]
zhihuang38ede132017-06-15 12:52:32 -0700180}
181
182# This target implements CreatePeerConnectionFactory methods that will create a
183# PeerConnection will full functionality (audio, video and data). Applications
184# that wish to reduce their binary size by ommitting functionality they don't
185# need should use CreateModularCreatePeerConnectionFactory instead, using the
186# "peerconnection" build target and other targets specific to their
187# requrements. See comment in peerconnectionfactoryinterface.h.
zhihuangab97e182017-06-22 01:28:59 -0700188rtc_static_library("create_pc_factory") {
zhihuang38ede132017-06-15 12:52:32 -0700189 sources = [
190 "createpeerconnectionfactory.cc",
191 ]
192
193 deps = [
194 "../api:audio_mixer_api",
195 "../api:libjingle_peerconnection_api",
196 "../api/audio_codecs:audio_codecs_api",
197 "../api/audio_codecs:builtin_audio_decoder_factory",
198 "../api/audio_codecs:builtin_audio_encoder_factory",
199 "../base:rtc_base",
200 "../base:rtc_base_approved",
201 "../call",
202 "../call:call_interfaces",
203 "../logging:rtc_event_log_api",
204 "../media:rtc_audio_video",
205 "../modules/audio_device:audio_device",
peaha9cc40b2017-06-29 08:32:09 -0700206 "../modules/audio_processing:audio_processing",
zhihuang38ede132017-06-15 12:52:32 -0700207 ]
208
209 configs += [ ":libjingle_peerconnection_warnings_config" ]
210
211 if (!build_with_chromium && is_clang) {
212 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
213 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
214 }
215}
216
217rtc_source_set("libjingle_peerconnection") {
218 public_deps = [
219 ":create_pc_factory",
220 ":peerconnection",
221 "../api:libjingle_peerconnection_api",
222 ]
ossuda250062017-01-23 07:37:43 -0800223
ossu7bb87ee2017-01-23 04:56:25 -0800224 if (rtc_use_quic) {
225 sources += [
226 "quicdatachannel.cc",
227 "quicdatachannel.h",
228 "quicdatatransport.cc",
229 "quicdatatransport.h",
230 ]
231 deps += [ "//third_party/libquic" ]
232 public_deps = [
233 "//third_party/libquic",
234 ]
235 }
236}
237
kjellander142f8c52016-06-13 00:08:24 -0700238if (rtc_include_tests) {
239 config("rtc_pc_unittests_config") {
240 # GN orders flags on a target before flags from configs. The default config
241 # adds -Wall, and this flag have to be after -Wall -- so they need to
242 # come from a config and can't be on the target directly.
243 if (!is_win && !is_clang) {
244 cflags = [ "-Wno-maybe-uninitialized" ] # Only exists for GCC.
245 }
246 }
247
ehmaldonado38a21322016-09-02 04:10:34 -0700248 rtc_test("rtc_pc_unittests") {
kjellander142f8c52016-06-13 00:08:24 -0700249 testonly = true
250
251 sources = [
252 "bundlefilter_unittest.cc",
253 "channel_unittest.cc",
254 "channelmanager_unittest.cc",
255 "currentspeakermonitor_unittest.cc",
256 "mediasession_unittest.cc",
257 "rtcpmuxfilter_unittest.cc",
zstein56162b92017-04-24 16:54:35 -0700258 "rtptransport_unittest.cc",
kjellander142f8c52016-06-13 00:08:24 -0700259 "srtpfilter_unittest.cc",
260 ]
261
262 include_dirs = [ "//third_party/libsrtp/srtp" ]
263
ehmaldonado7a2ce0b2016-09-05 01:35:44 -0700264 configs += [ ":rtc_pc_unittests_config" ]
kjellander142f8c52016-06-13 00:08:24 -0700265
kjellandere40a7ee2016-10-16 23:56:12 -0700266 if (!build_with_chromium && is_clang) {
kjellander142f8c52016-06-13 00:08:24 -0700267 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
ehmaldonado38a21322016-09-02 04:10:34 -0700268 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellander142f8c52016-06-13 00:08:24 -0700269 }
270
271 if (is_win) {
272 libs = [ "strmiids.lib" ]
273 }
274
275 deps = [
ossu7bb87ee2017-01-23 04:56:25 -0800276 ":libjingle_peerconnection",
kjellander142f8c52016-06-13 00:08:24 -0700277 ":rtc_pc",
mbonadei7d9a55b2017-06-01 13:01:48 -0700278 "../base:rtc_base",
279 "../base:rtc_base_approved",
mbonadei9087d492017-04-25 00:35:35 -0700280 "../base:rtc_base_tests_main",
kjellander142f8c52016-06-13 00:08:24 -0700281 "../base:rtc_base_tests_utils",
mbonadei7d9a55b2017-06-01 13:01:48 -0700282 "../logging:rtc_event_log_api",
283 "../media:rtc_media_base",
mbonadei9087d492017-04-25 00:35:35 -0700284 "../media:rtc_media_tests_utils",
mbonadei7d9a55b2017-06-01 13:01:48 -0700285 "../p2p:p2p_test_utils",
286 "../p2p:rtc_p2p",
kjellander142f8c52016-06-13 00:08:24 -0700287 "../system_wrappers:metrics_default",
288 ]
289
290 if (rtc_build_libsrtp) {
291 deps += [ "//third_party/libsrtp" ]
292 }
293
294 if (is_android) {
295 deps += [ "//testing/android/native_test:native_test_support" ]
296 }
297 }
ossu7bb87ee2017-01-23 04:56:25 -0800298
deadbeefe814a0d2017-02-25 18:15:09 -0800299 rtc_source_set("pc_test_utils") {
300 testonly = true
301 sources = [
302 "test/fakeaudiocapturemodule.cc",
303 "test/fakeaudiocapturemodule.h",
304 "test/fakedatachannelprovider.h",
305 "test/fakeperiodicvideocapturer.h",
306 "test/fakertccertificategenerator.h",
307 "test/fakevideotrackrenderer.h",
308 "test/fakevideotracksource.h",
309 "test/mock_datachannel.h",
310 "test/mock_peerconnection.h",
311 "test/mock_webrtcsession.h",
312 "test/mockpeerconnectionobservers.h",
313 "test/peerconnectiontestwrapper.cc",
314 "test/peerconnectiontestwrapper.h",
315 "test/rtcstatsobtainer.h",
316 "test/testsdpstrings.h",
317 ]
318
319 deps = [
320 ":libjingle_peerconnection",
mbonadei7d9a55b2017-06-01 13:01:48 -0700321 "..:webrtc_common",
322 "../api:libjingle_peerconnection_test_api",
323 "../api:rtc_stats_api",
324 "../base:rtc_base",
325 "../base:rtc_base_approved",
deadbeefe814a0d2017-02-25 18:15:09 -0800326 "../base:rtc_base_tests_utils",
zhihuang38ede132017-06-15 12:52:32 -0700327 "../call:call_interfaces",
328 "../logging:rtc_event_log_api",
mbonadei7d9a55b2017-06-01 13:01:48 -0700329 "../media:rtc_media",
330 "../media:rtc_media_tests_utils",
331 "../modules/audio_device:audio_device",
332 "../p2p:p2p_test_utils",
333 "../test:test_support",
deadbeefe814a0d2017-02-25 18:15:09 -0800334 "//testing/gmock",
335 ]
336
337 if (!build_with_chromium && is_clang) {
338 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
339 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
340 }
341 }
342
ossu7bb87ee2017-01-23 04:56:25 -0800343 config("peerconnection_unittests_config") {
344 # The warnings below are enabled by default. Since GN orders compiler flags
345 # for a target before flags from configs, the only way to disable such
346 # warnings is by having them in a separate config, loaded from the target.
347 # TODO(kjellander): Make the code compile without disabling these flags.
348 # See https://bugs.webrtc.org/3307.
349 if (is_clang && is_win) {
350 cflags = [
351 # See https://bugs.chromium.org/p/webrtc/issues/detail?id=6267
352 # for -Wno-sign-compare
353 "-Wno-sign-compare",
354 "-Wno-unused-function",
355 ]
356 }
357
358 if (!is_win) {
359 cflags = [ "-Wno-sign-compare" ]
360 }
361 }
362
363 rtc_test("peerconnection_unittests") {
364 check_includes = false # TODO(kjellander): Remove (bugs.webrtc.org/6828)
365 testonly = true
366 sources = [
367 "datachannel_unittest.cc",
368 "dtmfsender_unittest.cc",
deadbeef1dcb1642017-03-29 21:08:16 -0700369 "iceserverparsing_unittest.cc",
ossu7bb87ee2017-01-23 04:56:25 -0800370 "jsepsessiondescription_unittest.cc",
371 "localaudiosource_unittest.cc",
372 "mediaconstraintsinterface_unittest.cc",
373 "mediastream_unittest.cc",
deadbeef1dcb1642017-03-29 21:08:16 -0700374 "peerconnection_integrationtest.cc",
ossu7bb87ee2017-01-23 04:56:25 -0800375 "peerconnectionendtoend_unittest.cc",
376 "peerconnectionfactory_unittest.cc",
377 "peerconnectioninterface_unittest.cc",
378 "proxy_unittest.cc",
379 "rtcstats_integrationtest.cc",
380 "rtcstatscollector_unittest.cc",
381 "rtpsenderreceiver_unittest.cc",
382 "sctputils_unittest.cc",
383 "statscollector_unittest.cc",
ossu7bb87ee2017-01-23 04:56:25 -0800384 "test/fakeaudiocapturemodule_unittest.cc",
ossu7bb87ee2017-01-23 04:56:25 -0800385 "test/testsdpstrings.h",
deadbeef804c1af2017-02-11 19:07:31 -0800386 "trackmediainfomap_unittest.cc",
ossu7bb87ee2017-01-23 04:56:25 -0800387 "videocapturertracksource_unittest.cc",
388 "videotrack_unittest.cc",
389 "webrtcsdp_unittest.cc",
390 "webrtcsession_unittest.cc",
391 ]
392
393 if (rtc_enable_sctp) {
394 defines = [ "HAVE_SCTP" ]
395 }
396
397 configs += [ ":peerconnection_unittests_config" ]
398
399 if (!build_with_chromium && is_clang) {
400 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
401 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
402 }
403
404 # TODO(jschuh): Bug 1348: fix this warning.
405 configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
406
407 if (is_win) {
408 cflags = [
409 "/wd4245", # conversion from int to size_t, signed/unsigned mismatch.
410 "/wd4389", # signed/unsigned mismatch.
411 ]
412 }
413
414 if (rtc_use_quic) {
415 public_deps = [
416 "//third_party/libquic",
417 ]
418 sources += [
419 "quicdatachannel_unittest.cc",
420 "quicdatatransport_unittest.cc",
421 ]
422 }
423
424 deps = []
425 if (is_android) {
426 sources += [
427 "test/androidtestinitializer.cc",
428 "test/androidtestinitializer.h",
429 ]
430 deps += [
431 "//testing/android/native_test:native_test_support",
432 "//webrtc/sdk/android:libjingle_peerconnection_java",
433 "//webrtc/sdk/android:libjingle_peerconnection_jni",
434 ]
435 }
436
437 deps += [
438 ":libjingle_peerconnection",
deadbeefe814a0d2017-02-25 18:15:09 -0800439 ":pc_test_utils",
ossu7bb87ee2017-01-23 04:56:25 -0800440 "..:webrtc_common",
441 "../api:fakemetricsobserver",
mbonadei9087d492017-04-25 00:35:35 -0700442 "../base:rtc_base_tests_main",
ossu7bb87ee2017-01-23 04:56:25 -0800443 "../base:rtc_base_tests_utils",
mbonadei9087d492017-04-25 00:35:35 -0700444 "../media:rtc_media_tests_utils",
ossu7bb87ee2017-01-23 04:56:25 -0800445 "../pc:rtc_pc",
446 "../system_wrappers:metrics_default",
kwiberg2b3aa142017-06-14 03:31:17 -0700447 "../test:audio_codec_mocks",
ossu7bb87ee2017-01-23 04:56:25 -0800448 "//testing/gmock",
449 ]
450
451 if (is_android) {
452 deps += [ "//testing/android/native_test:native_test_support" ]
453
454 shard_timeout = 900
455 }
456 }
kjellander142f8c52016-06-13 00:08:24 -0700457}