blob: 2ff1a0af503a86c41f0a78919f6f9d059b646431 [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",
zstein4dde3df2017-07-07 14:26:25 -070053 "srtpsession.cc",
54 "srtpsession.h",
kjellanderc76dc952016-06-03 03:09:32 -070055 "voicechannel.h",
56 ]
57
58 deps = [
mbonadei7d9a55b2017-06-01 13:01:48 -070059 "..:webrtc_common",
kjellandera69d9732016-08-31 07:33:05 -070060 "../api:call_api",
mbonadei7d9a55b2017-06-01 13:01:48 -070061 "../api:libjingle_peerconnection_api",
62 "../api:ortc_api",
ehmaldonado370dd472017-07-10 05:58:42 -070063 "../base:rtc_base",
64 "../base:rtc_task_queue",
zhihuang38ede132017-06-15 12:52:32 -070065 "../media:rtc_data",
zhihuang130ca7e2017-06-21 01:02:59 -070066 "../media:rtc_h264_profile_id",
zhihuang38ede132017-06-15 12:52:32 -070067 "../media:rtc_media_base",
mbonadei7d9a55b2017-06-01 13:01:48 -070068 "../p2p:rtc_p2p",
kjellanderc76dc952016-06-03 03:09:32 -070069 ]
70
kjellanderc76dc952016-06-03 03:09:32 -070071 if (rtc_build_libsrtp) {
72 deps += [ "//third_party/libsrtp" ]
73 }
74
ehmaldonadoe9cc6862016-09-05 06:10:18 -070075 public_configs = [ ":rtc_pc_config" ]
kjellanderc76dc952016-06-03 03:09:32 -070076
kjellandere40a7ee2016-10-16 23:56:12 -070077 if (!build_with_chromium && is_clang) {
kjellander142f8c52016-06-13 00:08:24 -070078 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
ehmaldonado38a21322016-09-02 04:10:34 -070079 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellanderc76dc952016-06-03 03:09:32 -070080 }
81}
kjellander142f8c52016-06-13 00:08:24 -070082
zhihuang38ede132017-06-15 12:52:32 -070083rtc_source_set("rtc_pc") {
84 public_deps = [
85 ":rtc_pc_base",
86 ]
87
88 deps = [
89 "../media:rtc_audio_video",
90 ]
91}
92
ossu7bb87ee2017-01-23 04:56:25 -080093config("libjingle_peerconnection_warnings_config") {
94 # GN orders flags on a target before flags from configs. The default config
95 # adds these flags so to cancel them out they need to come from a config and
96 # cannot be on the target directly.
97 if (!is_win && !is_clang) {
98 cflags = [ "-Wno-maybe-uninitialized" ] # Only exists for GCC.
99 }
100}
101
zhihuang38ede132017-06-15 12:52:32 -0700102rtc_static_library("peerconnection") {
ossu7bb87ee2017-01-23 04:56:25 -0800103 cflags = []
104 sources = [
105 "audiotrack.cc",
106 "audiotrack.h",
107 "datachannel.cc",
108 "datachannel.h",
109 "dtmfsender.cc",
110 "dtmfsender.h",
deadbeef1dcb1642017-03-29 21:08:16 -0700111 "iceserverparsing.cc",
112 "iceserverparsing.h",
ossu7bb87ee2017-01-23 04:56:25 -0800113 "jsepicecandidate.cc",
114 "jsepsessiondescription.cc",
115 "localaudiosource.cc",
116 "localaudiosource.h",
ossu7bb87ee2017-01-23 04:56:25 -0800117 "mediastream.cc",
118 "mediastream.h",
119 "mediastreamobserver.cc",
120 "mediastreamobserver.h",
121 "mediastreamtrack.h",
ossu7bb87ee2017-01-23 04:56:25 -0800122 "peerconnection.cc",
123 "peerconnection.h",
124 "peerconnectionfactory.cc",
125 "peerconnectionfactory.h",
126 "remoteaudiosource.cc",
127 "remoteaudiosource.h",
128 "rtcstatscollector.cc",
129 "rtcstatscollector.h",
130 "rtpreceiver.cc",
131 "rtpreceiver.h",
132 "rtpsender.cc",
133 "rtpsender.h",
134 "sctputils.cc",
135 "sctputils.h",
136 "statscollector.cc",
137 "statscollector.h",
138 "streamcollection.h",
deadbeef804c1af2017-02-11 19:07:31 -0800139 "trackmediainfomap.cc",
140 "trackmediainfomap.h",
ossu7bb87ee2017-01-23 04:56:25 -0800141 "videocapturertracksource.cc",
142 "videocapturertracksource.h",
143 "videotrack.cc",
144 "videotrack.h",
145 "videotracksource.cc",
146 "videotracksource.h",
147 "webrtcsdp.cc",
148 "webrtcsdp.h",
149 "webrtcsession.cc",
150 "webrtcsession.h",
151 "webrtcsessiondescriptionfactory.cc",
152 "webrtcsessiondescriptionfactory.h",
153 ]
154
155 configs += [ ":libjingle_peerconnection_warnings_config" ]
156
157 if (!build_with_chromium && is_clang) {
158 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
159 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
160 }
161
162 deps = [
zhihuang38ede132017-06-15 12:52:32 -0700163 ":rtc_pc_base",
mbonadei7d9a55b2017-06-01 13:01:48 -0700164 "..:webrtc_common",
ossu7bb87ee2017-01-23 04:56:25 -0800165 "../api:call_api",
ossu7bb87ee2017-01-23 04:56:25 -0800166 "../api:rtc_stats_api",
ilnikd60d06a2017-04-05 03:02:20 -0700167 "../api/video_codecs:video_codecs_api",
ehmaldonado370dd472017-07-10 05:58:42 -0700168 "../base:rtc_base",
169 "../base:rtc_base_approved",
zhihuang38ede132017-06-15 12:52:32 -0700170 "../call:call_interfaces",
mbonadei7d9a55b2017-06-01 13:01:48 -0700171 "../logging:rtc_event_log_api",
zhihuang38ede132017-06-15 12:52:32 -0700172 "../media:rtc_data",
173 "../media:rtc_media_base",
mbonadei7d9a55b2017-06-01 13:01:48 -0700174 "../p2p:rtc_p2p",
ossu7bb87ee2017-01-23 04:56:25 -0800175 "../stats",
mbonadei7d9a55b2017-06-01 13:01:48 -0700176 "../system_wrappers:system_wrappers",
ossu7bb87ee2017-01-23 04:56:25 -0800177 ]
178
ossuda250062017-01-23 07:37:43 -0800179 public_deps = [
180 "../api:libjingle_peerconnection_api",
181 ]
zhihuang38ede132017-06-15 12:52:32 -0700182}
183
184# This target implements CreatePeerConnectionFactory methods that will create a
185# PeerConnection will full functionality (audio, video and data). Applications
186# that wish to reduce their binary size by ommitting functionality they don't
187# need should use CreateModularCreatePeerConnectionFactory instead, using the
188# "peerconnection" build target and other targets specific to their
189# requrements. See comment in peerconnectionfactoryinterface.h.
zhihuangab97e182017-06-22 01:28:59 -0700190rtc_static_library("create_pc_factory") {
zhihuang38ede132017-06-15 12:52:32 -0700191 sources = [
192 "createpeerconnectionfactory.cc",
193 ]
194
195 deps = [
196 "../api:audio_mixer_api",
197 "../api:libjingle_peerconnection_api",
198 "../api/audio_codecs:audio_codecs_api",
199 "../api/audio_codecs:builtin_audio_decoder_factory",
200 "../api/audio_codecs:builtin_audio_encoder_factory",
ehmaldonado370dd472017-07-10 05:58:42 -0700201 "../base:rtc_base",
202 "../base:rtc_base_approved",
zhihuang38ede132017-06-15 12:52:32 -0700203 "../call",
204 "../call:call_interfaces",
205 "../logging:rtc_event_log_api",
206 "../media:rtc_audio_video",
207 "../modules/audio_device:audio_device",
peaha9cc40b2017-06-29 08:32:09 -0700208 "../modules/audio_processing:audio_processing",
zhihuang38ede132017-06-15 12:52:32 -0700209 ]
210
211 configs += [ ":libjingle_peerconnection_warnings_config" ]
212
213 if (!build_with_chromium && is_clang) {
214 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
215 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
216 }
217}
218
219rtc_source_set("libjingle_peerconnection") {
220 public_deps = [
221 ":create_pc_factory",
222 ":peerconnection",
223 "../api:libjingle_peerconnection_api",
224 ]
ossuda250062017-01-23 07:37:43 -0800225
ossu7bb87ee2017-01-23 04:56:25 -0800226 if (rtc_use_quic) {
227 sources += [
228 "quicdatachannel.cc",
229 "quicdatachannel.h",
230 "quicdatatransport.cc",
231 "quicdatatransport.h",
232 ]
233 deps += [ "//third_party/libquic" ]
234 public_deps = [
235 "//third_party/libquic",
236 ]
237 }
238}
239
kjellander142f8c52016-06-13 00:08:24 -0700240if (rtc_include_tests) {
241 config("rtc_pc_unittests_config") {
242 # GN orders flags on a target before flags from configs. The default config
243 # adds -Wall, and this flag have to be after -Wall -- so they need to
244 # come from a config and can't be on the target directly.
245 if (!is_win && !is_clang) {
246 cflags = [ "-Wno-maybe-uninitialized" ] # Only exists for GCC.
247 }
248 }
249
ehmaldonado38a21322016-09-02 04:10:34 -0700250 rtc_test("rtc_pc_unittests") {
kjellander142f8c52016-06-13 00:08:24 -0700251 testonly = true
252
253 sources = [
254 "bundlefilter_unittest.cc",
255 "channel_unittest.cc",
256 "channelmanager_unittest.cc",
257 "currentspeakermonitor_unittest.cc",
258 "mediasession_unittest.cc",
259 "rtcpmuxfilter_unittest.cc",
zstein56162b92017-04-24 16:54:35 -0700260 "rtptransport_unittest.cc",
kjellander142f8c52016-06-13 00:08:24 -0700261 "srtpfilter_unittest.cc",
zstein4dde3df2017-07-07 14:26:25 -0700262 "srtpsession_unittest.cc",
263 "srtptestutil.h",
kjellander142f8c52016-06-13 00:08:24 -0700264 ]
265
266 include_dirs = [ "//third_party/libsrtp/srtp" ]
267
ehmaldonado7a2ce0b2016-09-05 01:35:44 -0700268 configs += [ ":rtc_pc_unittests_config" ]
kjellander142f8c52016-06-13 00:08:24 -0700269
kjellandere40a7ee2016-10-16 23:56:12 -0700270 if (!build_with_chromium && is_clang) {
kjellander142f8c52016-06-13 00:08:24 -0700271 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
ehmaldonado38a21322016-09-02 04:10:34 -0700272 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellander142f8c52016-06-13 00:08:24 -0700273 }
274
275 if (is_win) {
276 libs = [ "strmiids.lib" ]
277 }
278
279 deps = [
ossu7bb87ee2017-01-23 04:56:25 -0800280 ":libjingle_peerconnection",
kjellander142f8c52016-06-13 00:08:24 -0700281 ":rtc_pc",
ehmaldonado370dd472017-07-10 05:58:42 -0700282 "../base:rtc_base",
283 "../base:rtc_base_approved",
284 "../base:rtc_base_tests_main",
285 "../base:rtc_base_tests_utils",
mbonadei7d9a55b2017-06-01 13:01:48 -0700286 "../logging:rtc_event_log_api",
287 "../media:rtc_media_base",
mbonadei9087d492017-04-25 00:35:35 -0700288 "../media:rtc_media_tests_utils",
mbonadei7d9a55b2017-06-01 13:01:48 -0700289 "../p2p:p2p_test_utils",
290 "../p2p:rtc_p2p",
kjellander142f8c52016-06-13 00:08:24 -0700291 "../system_wrappers:metrics_default",
292 ]
293
294 if (rtc_build_libsrtp) {
295 deps += [ "//third_party/libsrtp" ]
296 }
297
298 if (is_android) {
299 deps += [ "//testing/android/native_test:native_test_support" ]
300 }
301 }
ossu7bb87ee2017-01-23 04:56:25 -0800302
deadbeefe814a0d2017-02-25 18:15:09 -0800303 rtc_source_set("pc_test_utils") {
304 testonly = true
305 sources = [
306 "test/fakeaudiocapturemodule.cc",
307 "test/fakeaudiocapturemodule.h",
308 "test/fakedatachannelprovider.h",
309 "test/fakeperiodicvideocapturer.h",
310 "test/fakertccertificategenerator.h",
311 "test/fakevideotrackrenderer.h",
312 "test/fakevideotracksource.h",
313 "test/mock_datachannel.h",
314 "test/mock_peerconnection.h",
315 "test/mock_webrtcsession.h",
316 "test/mockpeerconnectionobservers.h",
317 "test/peerconnectiontestwrapper.cc",
318 "test/peerconnectiontestwrapper.h",
319 "test/rtcstatsobtainer.h",
320 "test/testsdpstrings.h",
321 ]
322
323 deps = [
324 ":libjingle_peerconnection",
mbonadei7d9a55b2017-06-01 13:01:48 -0700325 "..:webrtc_common",
326 "../api:libjingle_peerconnection_test_api",
327 "../api:rtc_stats_api",
ehmaldonado370dd472017-07-10 05:58:42 -0700328 "../base:rtc_base",
329 "../base:rtc_base_approved",
330 "../base:rtc_base_tests_utils",
zhihuang38ede132017-06-15 12:52:32 -0700331 "../call:call_interfaces",
332 "../logging:rtc_event_log_api",
mbonadei7d9a55b2017-06-01 13:01:48 -0700333 "../media:rtc_media",
334 "../media:rtc_media_tests_utils",
335 "../modules/audio_device:audio_device",
336 "../p2p:p2p_test_utils",
337 "../test:test_support",
deadbeefe814a0d2017-02-25 18:15:09 -0800338 "//testing/gmock",
339 ]
340
341 if (!build_with_chromium && is_clang) {
342 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
343 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
344 }
345 }
346
ossu7bb87ee2017-01-23 04:56:25 -0800347 config("peerconnection_unittests_config") {
348 # The warnings below are enabled by default. Since GN orders compiler flags
349 # for a target before flags from configs, the only way to disable such
350 # warnings is by having them in a separate config, loaded from the target.
351 # TODO(kjellander): Make the code compile without disabling these flags.
352 # See https://bugs.webrtc.org/3307.
353 if (is_clang && is_win) {
354 cflags = [
355 # See https://bugs.chromium.org/p/webrtc/issues/detail?id=6267
356 # for -Wno-sign-compare
357 "-Wno-sign-compare",
ossu7bb87ee2017-01-23 04:56:25 -0800358 ]
359 }
360
361 if (!is_win) {
362 cflags = [ "-Wno-sign-compare" ]
363 }
364 }
365
366 rtc_test("peerconnection_unittests") {
367 check_includes = false # TODO(kjellander): Remove (bugs.webrtc.org/6828)
368 testonly = true
369 sources = [
370 "datachannel_unittest.cc",
371 "dtmfsender_unittest.cc",
deadbeef1dcb1642017-03-29 21:08:16 -0700372 "iceserverparsing_unittest.cc",
ossu7bb87ee2017-01-23 04:56:25 -0800373 "jsepsessiondescription_unittest.cc",
374 "localaudiosource_unittest.cc",
375 "mediaconstraintsinterface_unittest.cc",
376 "mediastream_unittest.cc",
deadbeef1dcb1642017-03-29 21:08:16 -0700377 "peerconnection_integrationtest.cc",
ossu7bb87ee2017-01-23 04:56:25 -0800378 "peerconnectionendtoend_unittest.cc",
379 "peerconnectionfactory_unittest.cc",
380 "peerconnectioninterface_unittest.cc",
381 "proxy_unittest.cc",
382 "rtcstats_integrationtest.cc",
383 "rtcstatscollector_unittest.cc",
384 "rtpsenderreceiver_unittest.cc",
385 "sctputils_unittest.cc",
386 "statscollector_unittest.cc",
ossu7bb87ee2017-01-23 04:56:25 -0800387 "test/fakeaudiocapturemodule_unittest.cc",
ossu7bb87ee2017-01-23 04:56:25 -0800388 "test/testsdpstrings.h",
deadbeef804c1af2017-02-11 19:07:31 -0800389 "trackmediainfomap_unittest.cc",
ossu7bb87ee2017-01-23 04:56:25 -0800390 "videocapturertracksource_unittest.cc",
391 "videotrack_unittest.cc",
392 "webrtcsdp_unittest.cc",
393 "webrtcsession_unittest.cc",
394 ]
395
396 if (rtc_enable_sctp) {
397 defines = [ "HAVE_SCTP" ]
398 }
399
400 configs += [ ":peerconnection_unittests_config" ]
401
402 if (!build_with_chromium && is_clang) {
403 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
404 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
405 }
406
407 # TODO(jschuh): Bug 1348: fix this warning.
408 configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
409
410 if (is_win) {
411 cflags = [
412 "/wd4245", # conversion from int to size_t, signed/unsigned mismatch.
413 "/wd4389", # signed/unsigned mismatch.
414 ]
415 }
416
417 if (rtc_use_quic) {
418 public_deps = [
419 "//third_party/libquic",
420 ]
421 sources += [
422 "quicdatachannel_unittest.cc",
423 "quicdatatransport_unittest.cc",
424 ]
425 }
426
427 deps = []
428 if (is_android) {
429 sources += [
430 "test/androidtestinitializer.cc",
431 "test/androidtestinitializer.h",
432 ]
433 deps += [
434 "//testing/android/native_test:native_test_support",
435 "//webrtc/sdk/android:libjingle_peerconnection_java",
436 "//webrtc/sdk/android:libjingle_peerconnection_jni",
437 ]
438 }
439
440 deps += [
441 ":libjingle_peerconnection",
deadbeefe814a0d2017-02-25 18:15:09 -0800442 ":pc_test_utils",
ossu7bb87ee2017-01-23 04:56:25 -0800443 "..:webrtc_common",
444 "../api:fakemetricsobserver",
ehmaldonado370dd472017-07-10 05:58:42 -0700445 "../base:rtc_base_tests_main",
446 "../base:rtc_base_tests_utils",
mbonadei9087d492017-04-25 00:35:35 -0700447 "../media:rtc_media_tests_utils",
ossu7bb87ee2017-01-23 04:56:25 -0800448 "../pc:rtc_pc",
449 "../system_wrappers:metrics_default",
kwiberg2b3aa142017-06-14 03:31:17 -0700450 "../test:audio_codec_mocks",
ossu7bb87ee2017-01-23 04:56:25 -0800451 "//testing/gmock",
452 ]
453
454 if (is_android) {
455 deps += [ "//testing/android/native_test:native_test_support" ]
456
457 shard_timeout = 900
458 }
459 }
kjellander142f8c52016-06-13 00:08:24 -0700460}