blob: 2720a1e8a86cf3b9dd3108109e432bf0beb9ca57 [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",
64 "../media:rtc_media_base",
mbonadei7d9a55b2017-06-01 13:01:48 -070065 "../p2p:rtc_p2p",
kjellanderc76dc952016-06-03 03:09:32 -070066 ]
67
kjellanderc76dc952016-06-03 03:09:32 -070068 if (rtc_build_libsrtp) {
69 deps += [ "//third_party/libsrtp" ]
70 }
71
ehmaldonadoe9cc6862016-09-05 06:10:18 -070072 public_configs = [ ":rtc_pc_config" ]
kjellanderc76dc952016-06-03 03:09:32 -070073
kjellandere40a7ee2016-10-16 23:56:12 -070074 if (!build_with_chromium && is_clang) {
kjellander142f8c52016-06-13 00:08:24 -070075 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
ehmaldonado38a21322016-09-02 04:10:34 -070076 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellanderc76dc952016-06-03 03:09:32 -070077 }
78}
kjellander142f8c52016-06-13 00:08:24 -070079
zhihuang38ede132017-06-15 12:52:32 -070080rtc_source_set("rtc_pc") {
81 public_deps = [
82 ":rtc_pc_base",
83 ]
84
85 deps = [
86 "../media:rtc_audio_video",
87 ]
88}
89
ossu7bb87ee2017-01-23 04:56:25 -080090config("libjingle_peerconnection_warnings_config") {
91 # GN orders flags on a target before flags from configs. The default config
92 # adds these flags so to cancel them out they need to come from a config and
93 # cannot be on the target directly.
94 if (!is_win && !is_clang) {
95 cflags = [ "-Wno-maybe-uninitialized" ] # Only exists for GCC.
96 }
97}
98
zhihuang38ede132017-06-15 12:52:32 -070099rtc_static_library("peerconnection") {
ossu7bb87ee2017-01-23 04:56:25 -0800100 cflags = []
101 sources = [
102 "audiotrack.cc",
103 "audiotrack.h",
104 "datachannel.cc",
105 "datachannel.h",
106 "dtmfsender.cc",
107 "dtmfsender.h",
deadbeef1dcb1642017-03-29 21:08:16 -0700108 "iceserverparsing.cc",
109 "iceserverparsing.h",
ossu7bb87ee2017-01-23 04:56:25 -0800110 "jsepicecandidate.cc",
111 "jsepsessiondescription.cc",
112 "localaudiosource.cc",
113 "localaudiosource.h",
ossu7bb87ee2017-01-23 04:56:25 -0800114 "mediastream.cc",
115 "mediastream.h",
116 "mediastreamobserver.cc",
117 "mediastreamobserver.h",
118 "mediastreamtrack.h",
ossu7bb87ee2017-01-23 04:56:25 -0800119 "peerconnection.cc",
120 "peerconnection.h",
121 "peerconnectionfactory.cc",
122 "peerconnectionfactory.h",
123 "remoteaudiosource.cc",
124 "remoteaudiosource.h",
125 "rtcstatscollector.cc",
126 "rtcstatscollector.h",
127 "rtpreceiver.cc",
128 "rtpreceiver.h",
129 "rtpsender.cc",
130 "rtpsender.h",
131 "sctputils.cc",
132 "sctputils.h",
133 "statscollector.cc",
134 "statscollector.h",
135 "streamcollection.h",
deadbeef804c1af2017-02-11 19:07:31 -0800136 "trackmediainfomap.cc",
137 "trackmediainfomap.h",
ossu7bb87ee2017-01-23 04:56:25 -0800138 "videocapturertracksource.cc",
139 "videocapturertracksource.h",
140 "videotrack.cc",
141 "videotrack.h",
142 "videotracksource.cc",
143 "videotracksource.h",
144 "webrtcsdp.cc",
145 "webrtcsdp.h",
146 "webrtcsession.cc",
147 "webrtcsession.h",
148 "webrtcsessiondescriptionfactory.cc",
149 "webrtcsessiondescriptionfactory.h",
150 ]
151
152 configs += [ ":libjingle_peerconnection_warnings_config" ]
153
154 if (!build_with_chromium && is_clang) {
155 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
156 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
157 }
158
159 deps = [
zhihuang38ede132017-06-15 12:52:32 -0700160 ":rtc_pc_base",
mbonadei7d9a55b2017-06-01 13:01:48 -0700161 "..:webrtc_common",
ossu7bb87ee2017-01-23 04:56:25 -0800162 "../api:call_api",
ossu7bb87ee2017-01-23 04:56:25 -0800163 "../api:rtc_stats_api",
ilnikd60d06a2017-04-05 03:02:20 -0700164 "../api/video_codecs:video_codecs_api",
mbonadei7d9a55b2017-06-01 13:01:48 -0700165 "../base:rtc_base",
166 "../base:rtc_base_approved",
zhihuang38ede132017-06-15 12:52:32 -0700167 "../call:call_interfaces",
mbonadei7d9a55b2017-06-01 13:01:48 -0700168 "../logging:rtc_event_log_api",
zhihuang38ede132017-06-15 12:52:32 -0700169 "../media:rtc_data",
170 "../media:rtc_media_base",
mbonadei7d9a55b2017-06-01 13:01:48 -0700171 "../p2p:rtc_p2p",
ossu7bb87ee2017-01-23 04:56:25 -0800172 "../stats",
mbonadei7d9a55b2017-06-01 13:01:48 -0700173 "../system_wrappers:system_wrappers",
ossu7bb87ee2017-01-23 04:56:25 -0800174 ]
175
ossuda250062017-01-23 07:37:43 -0800176 public_deps = [
177 "../api:libjingle_peerconnection_api",
178 ]
zhihuang38ede132017-06-15 12:52:32 -0700179}
180
181# This target implements CreatePeerConnectionFactory methods that will create a
182# PeerConnection will full functionality (audio, video and data). Applications
183# that wish to reduce their binary size by ommitting functionality they don't
184# need should use CreateModularCreatePeerConnectionFactory instead, using the
185# "peerconnection" build target and other targets specific to their
186# requrements. See comment in peerconnectionfactoryinterface.h.
187rtc_source_set("create_pc_factory") {
188 sources = [
189 "createpeerconnectionfactory.cc",
190 ]
191
192 deps = [
193 "../api:audio_mixer_api",
194 "../api:libjingle_peerconnection_api",
195 "../api/audio_codecs:audio_codecs_api",
196 "../api/audio_codecs:builtin_audio_decoder_factory",
197 "../api/audio_codecs:builtin_audio_encoder_factory",
198 "../base:rtc_base",
199 "../base:rtc_base_approved",
200 "../call",
201 "../call:call_interfaces",
202 "../logging:rtc_event_log_api",
203 "../media:rtc_audio_video",
204 "../modules/audio_device:audio_device",
205 ]
206
207 configs += [ ":libjingle_peerconnection_warnings_config" ]
208
209 if (!build_with_chromium && is_clang) {
210 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
211 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
212 }
213}
214
215rtc_source_set("libjingle_peerconnection") {
216 public_deps = [
217 ":create_pc_factory",
218 ":peerconnection",
219 "../api:libjingle_peerconnection_api",
220 ]
ossuda250062017-01-23 07:37:43 -0800221
ossu7bb87ee2017-01-23 04:56:25 -0800222 if (rtc_use_quic) {
223 sources += [
224 "quicdatachannel.cc",
225 "quicdatachannel.h",
226 "quicdatatransport.cc",
227 "quicdatatransport.h",
228 ]
229 deps += [ "//third_party/libquic" ]
230 public_deps = [
231 "//third_party/libquic",
232 ]
233 }
234}
235
kjellander142f8c52016-06-13 00:08:24 -0700236if (rtc_include_tests) {
237 config("rtc_pc_unittests_config") {
238 # GN orders flags on a target before flags from configs. The default config
239 # adds -Wall, and this flag have to be after -Wall -- so they need to
240 # come from a config and can't be on the target directly.
241 if (!is_win && !is_clang) {
242 cflags = [ "-Wno-maybe-uninitialized" ] # Only exists for GCC.
243 }
244 }
245
ehmaldonado38a21322016-09-02 04:10:34 -0700246 rtc_test("rtc_pc_unittests") {
kjellander142f8c52016-06-13 00:08:24 -0700247 testonly = true
248
249 sources = [
250 "bundlefilter_unittest.cc",
251 "channel_unittest.cc",
252 "channelmanager_unittest.cc",
253 "currentspeakermonitor_unittest.cc",
254 "mediasession_unittest.cc",
255 "rtcpmuxfilter_unittest.cc",
zstein56162b92017-04-24 16:54:35 -0700256 "rtptransport_unittest.cc",
kjellander142f8c52016-06-13 00:08:24 -0700257 "srtpfilter_unittest.cc",
258 ]
259
260 include_dirs = [ "//third_party/libsrtp/srtp" ]
261
ehmaldonado7a2ce0b2016-09-05 01:35:44 -0700262 configs += [ ":rtc_pc_unittests_config" ]
kjellander142f8c52016-06-13 00:08:24 -0700263
kjellandere40a7ee2016-10-16 23:56:12 -0700264 if (!build_with_chromium && is_clang) {
kjellander142f8c52016-06-13 00:08:24 -0700265 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
ehmaldonado38a21322016-09-02 04:10:34 -0700266 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellander142f8c52016-06-13 00:08:24 -0700267 }
268
269 if (is_win) {
270 libs = [ "strmiids.lib" ]
271 }
272
273 deps = [
ossu7bb87ee2017-01-23 04:56:25 -0800274 ":libjingle_peerconnection",
kjellander142f8c52016-06-13 00:08:24 -0700275 ":rtc_pc",
mbonadei7d9a55b2017-06-01 13:01:48 -0700276 "../base:rtc_base",
277 "../base:rtc_base_approved",
mbonadei9087d492017-04-25 00:35:35 -0700278 "../base:rtc_base_tests_main",
kjellander142f8c52016-06-13 00:08:24 -0700279 "../base:rtc_base_tests_utils",
mbonadei7d9a55b2017-06-01 13:01:48 -0700280 "../logging:rtc_event_log_api",
281 "../media:rtc_media_base",
mbonadei9087d492017-04-25 00:35:35 -0700282 "../media:rtc_media_tests_utils",
mbonadei7d9a55b2017-06-01 13:01:48 -0700283 "../p2p:p2p_test_utils",
284 "../p2p:rtc_p2p",
kjellander142f8c52016-06-13 00:08:24 -0700285 "../system_wrappers:metrics_default",
286 ]
287
288 if (rtc_build_libsrtp) {
289 deps += [ "//third_party/libsrtp" ]
290 }
291
292 if (is_android) {
293 deps += [ "//testing/android/native_test:native_test_support" ]
294 }
295 }
ossu7bb87ee2017-01-23 04:56:25 -0800296
deadbeefe814a0d2017-02-25 18:15:09 -0800297 rtc_source_set("pc_test_utils") {
298 testonly = true
299 sources = [
300 "test/fakeaudiocapturemodule.cc",
301 "test/fakeaudiocapturemodule.h",
302 "test/fakedatachannelprovider.h",
303 "test/fakeperiodicvideocapturer.h",
304 "test/fakertccertificategenerator.h",
305 "test/fakevideotrackrenderer.h",
306 "test/fakevideotracksource.h",
307 "test/mock_datachannel.h",
308 "test/mock_peerconnection.h",
309 "test/mock_webrtcsession.h",
310 "test/mockpeerconnectionobservers.h",
311 "test/peerconnectiontestwrapper.cc",
312 "test/peerconnectiontestwrapper.h",
313 "test/rtcstatsobtainer.h",
314 "test/testsdpstrings.h",
315 ]
316
317 deps = [
318 ":libjingle_peerconnection",
mbonadei7d9a55b2017-06-01 13:01:48 -0700319 "..:webrtc_common",
320 "../api:libjingle_peerconnection_test_api",
321 "../api:rtc_stats_api",
322 "../base:rtc_base",
323 "../base:rtc_base_approved",
deadbeefe814a0d2017-02-25 18:15:09 -0800324 "../base:rtc_base_tests_utils",
zhihuang38ede132017-06-15 12:52:32 -0700325 "../call:call_interfaces",
326 "../logging:rtc_event_log_api",
mbonadei7d9a55b2017-06-01 13:01:48 -0700327 "../media:rtc_media",
328 "../media:rtc_media_tests_utils",
329 "../modules/audio_device:audio_device",
330 "../p2p:p2p_test_utils",
331 "../test:test_support",
deadbeefe814a0d2017-02-25 18:15:09 -0800332 "//testing/gmock",
333 ]
334
335 if (!build_with_chromium && is_clang) {
336 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
337 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
338 }
339 }
340
ossu7bb87ee2017-01-23 04:56:25 -0800341 config("peerconnection_unittests_config") {
342 # The warnings below are enabled by default. Since GN orders compiler flags
343 # for a target before flags from configs, the only way to disable such
344 # warnings is by having them in a separate config, loaded from the target.
345 # TODO(kjellander): Make the code compile without disabling these flags.
346 # See https://bugs.webrtc.org/3307.
347 if (is_clang && is_win) {
348 cflags = [
349 # See https://bugs.chromium.org/p/webrtc/issues/detail?id=6267
350 # for -Wno-sign-compare
351 "-Wno-sign-compare",
352 "-Wno-unused-function",
353 ]
354 }
355
356 if (!is_win) {
357 cflags = [ "-Wno-sign-compare" ]
358 }
359 }
360
361 rtc_test("peerconnection_unittests") {
362 check_includes = false # TODO(kjellander): Remove (bugs.webrtc.org/6828)
363 testonly = true
364 sources = [
365 "datachannel_unittest.cc",
366 "dtmfsender_unittest.cc",
deadbeef1dcb1642017-03-29 21:08:16 -0700367 "iceserverparsing_unittest.cc",
ossu7bb87ee2017-01-23 04:56:25 -0800368 "jsepsessiondescription_unittest.cc",
369 "localaudiosource_unittest.cc",
370 "mediaconstraintsinterface_unittest.cc",
371 "mediastream_unittest.cc",
deadbeef1dcb1642017-03-29 21:08:16 -0700372 "peerconnection_integrationtest.cc",
ossu7bb87ee2017-01-23 04:56:25 -0800373 "peerconnectionendtoend_unittest.cc",
374 "peerconnectionfactory_unittest.cc",
375 "peerconnectioninterface_unittest.cc",
376 "proxy_unittest.cc",
377 "rtcstats_integrationtest.cc",
378 "rtcstatscollector_unittest.cc",
379 "rtpsenderreceiver_unittest.cc",
380 "sctputils_unittest.cc",
381 "statscollector_unittest.cc",
ossu7bb87ee2017-01-23 04:56:25 -0800382 "test/fakeaudiocapturemodule_unittest.cc",
ossu7bb87ee2017-01-23 04:56:25 -0800383 "test/testsdpstrings.h",
deadbeef804c1af2017-02-11 19:07:31 -0800384 "trackmediainfomap_unittest.cc",
ossu7bb87ee2017-01-23 04:56:25 -0800385 "videocapturertracksource_unittest.cc",
386 "videotrack_unittest.cc",
387 "webrtcsdp_unittest.cc",
388 "webrtcsession_unittest.cc",
389 ]
390
391 if (rtc_enable_sctp) {
392 defines = [ "HAVE_SCTP" ]
393 }
394
395 configs += [ ":peerconnection_unittests_config" ]
396
397 if (!build_with_chromium && is_clang) {
398 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
399 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
400 }
401
402 # TODO(jschuh): Bug 1348: fix this warning.
403 configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
404
405 if (is_win) {
406 cflags = [
407 "/wd4245", # conversion from int to size_t, signed/unsigned mismatch.
408 "/wd4389", # signed/unsigned mismatch.
409 ]
410 }
411
412 if (rtc_use_quic) {
413 public_deps = [
414 "//third_party/libquic",
415 ]
416 sources += [
417 "quicdatachannel_unittest.cc",
418 "quicdatatransport_unittest.cc",
419 ]
420 }
421
422 deps = []
423 if (is_android) {
424 sources += [
425 "test/androidtestinitializer.cc",
426 "test/androidtestinitializer.h",
427 ]
428 deps += [
429 "//testing/android/native_test:native_test_support",
430 "//webrtc/sdk/android:libjingle_peerconnection_java",
431 "//webrtc/sdk/android:libjingle_peerconnection_jni",
432 ]
433 }
434
435 deps += [
436 ":libjingle_peerconnection",
deadbeefe814a0d2017-02-25 18:15:09 -0800437 ":pc_test_utils",
ossu7bb87ee2017-01-23 04:56:25 -0800438 "..:webrtc_common",
439 "../api:fakemetricsobserver",
mbonadei9087d492017-04-25 00:35:35 -0700440 "../base:rtc_base_tests_main",
ossu7bb87ee2017-01-23 04:56:25 -0800441 "../base:rtc_base_tests_utils",
mbonadei9087d492017-04-25 00:35:35 -0700442 "../media:rtc_media_tests_utils",
ossu7bb87ee2017-01-23 04:56:25 -0800443 "../pc:rtc_pc",
444 "../system_wrappers:metrics_default",
kwiberg2b3aa142017-06-14 03:31:17 -0700445 "../test:audio_codec_mocks",
ossu7bb87ee2017-01-23 04:56:25 -0800446 "//testing/gmock",
447 ]
448
449 if (is_android) {
450 deps += [ "//testing/android/native_test:native_test_support" ]
451
452 shard_timeout = 900
453 }
454 }
kjellander142f8c52016-06-13 00:08:24 -0700455}