blob: 4719db64c0a4ba73b18787d5f62c89e710c32ca6 [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.
188rtc_source_set("create_pc_factory") {
189 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",
206 ]
207
208 configs += [ ":libjingle_peerconnection_warnings_config" ]
209
210 if (!build_with_chromium && is_clang) {
211 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
212 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
213 }
214}
215
216rtc_source_set("libjingle_peerconnection") {
217 public_deps = [
218 ":create_pc_factory",
219 ":peerconnection",
220 "../api:libjingle_peerconnection_api",
221 ]
ossuda250062017-01-23 07:37:43 -0800222
ossu7bb87ee2017-01-23 04:56:25 -0800223 if (rtc_use_quic) {
224 sources += [
225 "quicdatachannel.cc",
226 "quicdatachannel.h",
227 "quicdatatransport.cc",
228 "quicdatatransport.h",
229 ]
230 deps += [ "//third_party/libquic" ]
231 public_deps = [
232 "//third_party/libquic",
233 ]
234 }
235}
236
kjellander142f8c52016-06-13 00:08:24 -0700237if (rtc_include_tests) {
238 config("rtc_pc_unittests_config") {
239 # GN orders flags on a target before flags from configs. The default config
240 # adds -Wall, and this flag have to be after -Wall -- so they need to
241 # come from a config and can't be on the target directly.
242 if (!is_win && !is_clang) {
243 cflags = [ "-Wno-maybe-uninitialized" ] # Only exists for GCC.
244 }
245 }
246
ehmaldonado38a21322016-09-02 04:10:34 -0700247 rtc_test("rtc_pc_unittests") {
kjellander142f8c52016-06-13 00:08:24 -0700248 testonly = true
249
250 sources = [
251 "bundlefilter_unittest.cc",
252 "channel_unittest.cc",
253 "channelmanager_unittest.cc",
254 "currentspeakermonitor_unittest.cc",
255 "mediasession_unittest.cc",
256 "rtcpmuxfilter_unittest.cc",
zstein56162b92017-04-24 16:54:35 -0700257 "rtptransport_unittest.cc",
kjellander142f8c52016-06-13 00:08:24 -0700258 "srtpfilter_unittest.cc",
259 ]
260
261 include_dirs = [ "//third_party/libsrtp/srtp" ]
262
ehmaldonado7a2ce0b2016-09-05 01:35:44 -0700263 configs += [ ":rtc_pc_unittests_config" ]
kjellander142f8c52016-06-13 00:08:24 -0700264
kjellandere40a7ee2016-10-16 23:56:12 -0700265 if (!build_with_chromium && is_clang) {
kjellander142f8c52016-06-13 00:08:24 -0700266 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
ehmaldonado38a21322016-09-02 04:10:34 -0700267 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellander142f8c52016-06-13 00:08:24 -0700268 }
269
270 if (is_win) {
271 libs = [ "strmiids.lib" ]
272 }
273
274 deps = [
ossu7bb87ee2017-01-23 04:56:25 -0800275 ":libjingle_peerconnection",
kjellander142f8c52016-06-13 00:08:24 -0700276 ":rtc_pc",
mbonadei7d9a55b2017-06-01 13:01:48 -0700277 "../base:rtc_base",
278 "../base:rtc_base_approved",
mbonadei9087d492017-04-25 00:35:35 -0700279 "../base:rtc_base_tests_main",
kjellander142f8c52016-06-13 00:08:24 -0700280 "../base:rtc_base_tests_utils",
mbonadei7d9a55b2017-06-01 13:01:48 -0700281 "../logging:rtc_event_log_api",
282 "../media:rtc_media_base",
mbonadei9087d492017-04-25 00:35:35 -0700283 "../media:rtc_media_tests_utils",
mbonadei7d9a55b2017-06-01 13:01:48 -0700284 "../p2p:p2p_test_utils",
285 "../p2p:rtc_p2p",
kjellander142f8c52016-06-13 00:08:24 -0700286 "../system_wrappers:metrics_default",
287 ]
288
289 if (rtc_build_libsrtp) {
290 deps += [ "//third_party/libsrtp" ]
291 }
292
293 if (is_android) {
294 deps += [ "//testing/android/native_test:native_test_support" ]
295 }
296 }
ossu7bb87ee2017-01-23 04:56:25 -0800297
deadbeefe814a0d2017-02-25 18:15:09 -0800298 rtc_source_set("pc_test_utils") {
299 testonly = true
300 sources = [
301 "test/fakeaudiocapturemodule.cc",
302 "test/fakeaudiocapturemodule.h",
303 "test/fakedatachannelprovider.h",
304 "test/fakeperiodicvideocapturer.h",
305 "test/fakertccertificategenerator.h",
306 "test/fakevideotrackrenderer.h",
307 "test/fakevideotracksource.h",
308 "test/mock_datachannel.h",
309 "test/mock_peerconnection.h",
310 "test/mock_webrtcsession.h",
311 "test/mockpeerconnectionobservers.h",
312 "test/peerconnectiontestwrapper.cc",
313 "test/peerconnectiontestwrapper.h",
314 "test/rtcstatsobtainer.h",
315 "test/testsdpstrings.h",
316 ]
317
318 deps = [
319 ":libjingle_peerconnection",
mbonadei7d9a55b2017-06-01 13:01:48 -0700320 "..:webrtc_common",
321 "../api:libjingle_peerconnection_test_api",
322 "../api:rtc_stats_api",
323 "../base:rtc_base",
324 "../base:rtc_base_approved",
deadbeefe814a0d2017-02-25 18:15:09 -0800325 "../base:rtc_base_tests_utils",
zhihuang38ede132017-06-15 12:52:32 -0700326 "../call:call_interfaces",
327 "../logging:rtc_event_log_api",
mbonadei7d9a55b2017-06-01 13:01:48 -0700328 "../media:rtc_media",
329 "../media:rtc_media_tests_utils",
330 "../modules/audio_device:audio_device",
331 "../p2p:p2p_test_utils",
332 "../test:test_support",
deadbeefe814a0d2017-02-25 18:15:09 -0800333 "//testing/gmock",
334 ]
335
336 if (!build_with_chromium && is_clang) {
337 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
338 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
339 }
340 }
341
ossu7bb87ee2017-01-23 04:56:25 -0800342 config("peerconnection_unittests_config") {
343 # The warnings below are enabled by default. Since GN orders compiler flags
344 # for a target before flags from configs, the only way to disable such
345 # warnings is by having them in a separate config, loaded from the target.
346 # TODO(kjellander): Make the code compile without disabling these flags.
347 # See https://bugs.webrtc.org/3307.
348 if (is_clang && is_win) {
349 cflags = [
350 # See https://bugs.chromium.org/p/webrtc/issues/detail?id=6267
351 # for -Wno-sign-compare
352 "-Wno-sign-compare",
353 "-Wno-unused-function",
354 ]
355 }
356
357 if (!is_win) {
358 cflags = [ "-Wno-sign-compare" ]
359 }
360 }
361
362 rtc_test("peerconnection_unittests") {
363 check_includes = false # TODO(kjellander): Remove (bugs.webrtc.org/6828)
364 testonly = true
365 sources = [
366 "datachannel_unittest.cc",
367 "dtmfsender_unittest.cc",
deadbeef1dcb1642017-03-29 21:08:16 -0700368 "iceserverparsing_unittest.cc",
ossu7bb87ee2017-01-23 04:56:25 -0800369 "jsepsessiondescription_unittest.cc",
370 "localaudiosource_unittest.cc",
371 "mediaconstraintsinterface_unittest.cc",
372 "mediastream_unittest.cc",
deadbeef1dcb1642017-03-29 21:08:16 -0700373 "peerconnection_integrationtest.cc",
ossu7bb87ee2017-01-23 04:56:25 -0800374 "peerconnectionendtoend_unittest.cc",
375 "peerconnectionfactory_unittest.cc",
376 "peerconnectioninterface_unittest.cc",
377 "proxy_unittest.cc",
378 "rtcstats_integrationtest.cc",
379 "rtcstatscollector_unittest.cc",
380 "rtpsenderreceiver_unittest.cc",
381 "sctputils_unittest.cc",
382 "statscollector_unittest.cc",
ossu7bb87ee2017-01-23 04:56:25 -0800383 "test/fakeaudiocapturemodule_unittest.cc",
ossu7bb87ee2017-01-23 04:56:25 -0800384 "test/testsdpstrings.h",
deadbeef804c1af2017-02-11 19:07:31 -0800385 "trackmediainfomap_unittest.cc",
ossu7bb87ee2017-01-23 04:56:25 -0800386 "videocapturertracksource_unittest.cc",
387 "videotrack_unittest.cc",
388 "webrtcsdp_unittest.cc",
389 "webrtcsession_unittest.cc",
390 ]
391
392 if (rtc_enable_sctp) {
393 defines = [ "HAVE_SCTP" ]
394 }
395
396 configs += [ ":peerconnection_unittests_config" ]
397
398 if (!build_with_chromium && is_clang) {
399 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
400 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
401 }
402
403 # TODO(jschuh): Bug 1348: fix this warning.
404 configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
405
406 if (is_win) {
407 cflags = [
408 "/wd4245", # conversion from int to size_t, signed/unsigned mismatch.
409 "/wd4389", # signed/unsigned mismatch.
410 ]
411 }
412
413 if (rtc_use_quic) {
414 public_deps = [
415 "//third_party/libquic",
416 ]
417 sources += [
418 "quicdatachannel_unittest.cc",
419 "quicdatatransport_unittest.cc",
420 ]
421 }
422
423 deps = []
424 if (is_android) {
425 sources += [
426 "test/androidtestinitializer.cc",
427 "test/androidtestinitializer.h",
428 ]
429 deps += [
430 "//testing/android/native_test:native_test_support",
431 "//webrtc/sdk/android:libjingle_peerconnection_java",
432 "//webrtc/sdk/android:libjingle_peerconnection_jni",
433 ]
434 }
435
436 deps += [
437 ":libjingle_peerconnection",
deadbeefe814a0d2017-02-25 18:15:09 -0800438 ":pc_test_utils",
ossu7bb87ee2017-01-23 04:56:25 -0800439 "..:webrtc_common",
440 "../api:fakemetricsobserver",
mbonadei9087d492017-04-25 00:35:35 -0700441 "../base:rtc_base_tests_main",
ossu7bb87ee2017-01-23 04:56:25 -0800442 "../base:rtc_base_tests_utils",
mbonadei9087d492017-04-25 00:35:35 -0700443 "../media:rtc_media_tests_utils",
ossu7bb87ee2017-01-23 04:56:25 -0800444 "../pc:rtc_pc",
445 "../system_wrappers:metrics_default",
kwiberg2b3aa142017-06-14 03:31:17 -0700446 "../test:audio_codec_mocks",
ossu7bb87ee2017-01-23 04:56:25 -0800447 "//testing/gmock",
448 ]
449
450 if (is_android) {
451 deps += [ "//testing/android/native_test:native_test_support" ]
452
453 shard_timeout = 900
454 }
455 }
kjellander142f8c52016-06-13 00:08:24 -0700456}