blob: 2808191e2b5c298ee31fedf0e91dba994ce745da [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
9import("//build/config/linux/pkg_config.gni")
mbonadei9aa3f0a2017-01-24 06:58:22 -080010import("../webrtc.gni")
kjellanderc76dc952016-06-03 03:09:32 -070011
12group("media") {
Dan Minor9c686132018-01-15 10:20:00 -050013 deps = []
14 if (!build_with_mozilla) {
15 deps += [
16 ":rtc_media",
17 ":rtc_media_base",
18 ]
19 }
kjellanderc76dc952016-06-03 03:09:32 -070020}
21
22config("rtc_media_defines_config") {
23 defines = [
24 "HAVE_WEBRTC_VIDEO",
25 "HAVE_WEBRTC_VOICE",
26 ]
27}
28
zhihuang38ede132017-06-15 12:52:32 -070029config("rtc_media_warnings_config") {
30 # GN orders flags on a target before flags from configs. The default config
31 # adds these flags so to cancel them out they need to come from a config and
32 # cannot be on the target directly.
33 if (!is_win) {
34 cflags = [ "-Wno-deprecated-declarations" ]
35 }
36}
37
zhihuang130ca7e2017-06-21 01:02:59 -070038rtc_source_set("rtc_h264_profile_id") {
Per Kjellandera7f2d842018-01-10 15:54:53 +000039 visibility = [ "*" ]
zhihuang130ca7e2017-06-21 01:02:59 -070040 sources = [
41 "base/h264_profile_level_id.cc",
42 "base/h264_profile_level_id.h",
43 ]
44
45 if (!build_with_chromium && is_clang) {
46 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
47 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
48 }
49
50 deps = [
51 "..:webrtc_common",
kwiberg84f6a3f2017-09-05 08:43:13 -070052 "../api:optional",
ehmaldonadof6a861a2017-07-19 10:40:47 -070053 "../rtc_base:rtc_base",
54 "../rtc_base:rtc_base_approved",
zhihuang130ca7e2017-06-21 01:02:59 -070055 ]
56}
57
Niels Möller6daa2782018-01-23 10:37:42 +010058rtc_source_set("rtc_media_config") {
59 visibility = [ "*" ]
60 sources = [
61 "base/mediaconfig.h",
62 ]
63}
64
zhihuangab97e182017-06-22 01:28:59 -070065rtc_static_library("rtc_media_base") {
Per Kjellandera7f2d842018-01-10 15:54:53 +000066 visibility = [ "*" ]
kjellanderc76dc952016-06-03 03:09:32 -070067 defines = []
68 libs = []
Patrik Höglunda8005cf2017-12-13 16:05:42 +010069 deps = [
Niels Möllera6fe2612018-01-19 11:28:54 +010070 "../api:audio_options_api",
Patrik Höglunda8005cf2017-12-13 16:05:42 +010071 "../rtc_base:checks",
Tommi8d2c5a82018-03-19 11:12:48 +010072 "../rtc_base:rtc_base_approved",
73 "../rtc_base:rtc_task_queue",
Patrik Höglunda8005cf2017-12-13 16:05:42 +010074 "../rtc_base:sanitizer",
Tommi1829af62018-02-06 09:29:17 +010075 "../rtc_base:sequenced_task_checker",
Patrik Höglund3e113432017-12-15 14:40:10 +010076 "../rtc_base:stringutils",
Patrik Höglunda8005cf2017-12-13 16:05:42 +010077 ]
kjellanderc76dc952016-06-03 03:09:32 -070078 sources = [
nisse6f5a6c32016-09-22 01:25:59 -070079 "base/adaptedvideotracksource.cc",
80 "base/adaptedvideotracksource.h",
kjellanderc76dc952016-06-03 03:09:32 -070081 "base/audiosource.h",
82 "base/codec.cc",
83 "base/codec.h",
kjellanderc76dc952016-06-03 03:09:32 -070084 "base/cryptoparams.h",
85 "base/device.h",
Paulina Hensman11b34f42018-04-09 14:24:52 +020086 "base/mediachannel.cc",
kjellanderc76dc952016-06-03 03:09:32 -070087 "base/mediachannel.h",
kjellanderc76dc952016-06-03 03:09:32 -070088 "base/mediaconstants.cc",
89 "base/mediaconstants.h",
90 "base/mediaengine.cc",
91 "base/mediaengine.h",
92 "base/rtpdataengine.cc",
93 "base/rtpdataengine.h",
kjellanderc76dc952016-06-03 03:09:32 -070094 "base/rtputils.cc",
95 "base/rtputils.h",
kjellanderc76dc952016-06-03 03:09:32 -070096 "base/streamparams.cc",
97 "base/streamparams.h",
98 "base/turnutils.cc",
99 "base/turnutils.h",
100 "base/videoadapter.cc",
101 "base/videoadapter.h",
102 "base/videobroadcaster.cc",
103 "base/videobroadcaster.h",
104 "base/videocapturer.cc",
105 "base/videocapturer.h",
106 "base/videocapturerfactory.h",
107 "base/videocommon.cc",
108 "base/videocommon.h",
kjellanderc76dc952016-06-03 03:09:32 -0700109 "base/videosourcebase.cc",
110 "base/videosourcebase.h",
magjed0928a3c2016-11-25 00:40:18 -0800111 ]
112
magjed0928a3c2016-11-25 00:40:18 -0800113 if (!build_with_chromium && is_clang) {
114 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
115 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
116 }
117
magjed0928a3c2016-11-25 00:40:18 -0800118 deps += [
Mirko Bonadei75baa492018-01-11 17:07:30 +0100119 ":rtc_h264_profile_id",
Niels Möller6daa2782018-01-23 10:37:42 +0100120 ":rtc_media_config",
magjed0928a3c2016-11-25 00:40:18 -0800121 "..:webrtc_common",
kjellandera2ef4f92017-03-06 06:04:55 -0800122 "../api:libjingle_peerconnection_api",
Patrik Höglundaba85d12017-11-28 15:46:08 +0100123 "../api:optional",
Patrik Höglundaba85d12017-11-28 15:46:08 +0100124 "../api/audio_codecs:audio_codecs_api",
Niels Möllerc6ce9c52018-05-11 11:15:30 +0200125 "../api/video:video_frame",
126 "../api/video:video_frame_i420",
Patrik Höglundaba85d12017-11-28 15:46:08 +0100127 "../api/video_codecs:video_codecs_api",
128 "../call:call_interfaces",
129 "../call:video_stream_api",
Patrik Höglundbe214a22018-01-04 12:14:35 +0100130 "../common_video",
Patrik Höglundaba85d12017-11-28 15:46:08 +0100131 "../modules/audio_processing:audio_processing_statistics",
ehmaldonadof6a861a2017-07-19 10:40:47 -0700132 "../rtc_base:rtc_base",
133 "../rtc_base:rtc_base_approved",
Patrik Höglundaba85d12017-11-28 15:46:08 +0100134 "../system_wrappers:field_trial_api",
magjed0928a3c2016-11-25 00:40:18 -0800135 ]
kjellander8a116632017-04-21 05:17:08 -0700136
Dan Minor9c686132018-01-15 10:20:00 -0500137 if (!build_with_mozilla) {
138 deps += [ "../p2p" ]
139 }
140
kjellander8a116632017-04-21 05:17:08 -0700141 if (is_nacl) {
142 deps += [ "//native_client_sdk/src/libraries/nacl_io" ]
143 }
magjed0928a3c2016-11-25 00:40:18 -0800144}
145
Anders Carlssona114c882018-01-04 15:10:22 +0100146rtc_static_library("rtc_constants") {
magjed0928a3c2016-11-25 00:40:18 -0800147 defines = []
148 libs = []
Anders Carlssona114c882018-01-04 15:10:22 +0100149 deps = []
magjed0928a3c2016-11-25 00:40:18 -0800150 sources = [
mallikarjun829deda482017-11-20 17:48:13 +0530151 "engine/constants.cc",
charujain66748462017-09-14 13:53:02 -0700152 "engine/constants.h",
Anders Carlssona114c882018-01-04 15:10:22 +0100153 ]
154}
155
156rtc_static_library("rtc_internal_video_codecs") {
Per Kjellandera0f5f602018-01-10 15:57:32 +0000157 visibility = [ "*" ]
Karl Wiberg7ba22b82018-04-27 04:31:53 +0200158 allow_poison = [ "software_video_codecs" ]
Anders Carlssona114c882018-01-04 15:10:22 +0100159 defines = []
160 libs = []
Patrik Höglund99175c62018-01-08 11:05:10 +0100161 deps = [
Mirko Bonadei75baa492018-01-11 17:07:30 +0100162 ":rtc_h264_profile_id",
Patrik Höglund99175c62018-01-08 11:05:10 +0100163 "../modules/video_coding:video_codec_interface",
164 ]
Anders Carlssona114c882018-01-04 15:10:22 +0100165 sources = [
Magnus Jedvert07e0d012017-10-31 11:24:54 +0100166 "engine/convert_legacy_video_factory.cc",
167 "engine/convert_legacy_video_factory.h",
magjeddd407022016-12-01 00:27:27 -0800168 "engine/internaldecoderfactory.cc",
169 "engine/internaldecoderfactory.h",
magjed509e4fe2016-11-18 01:34:11 -0800170 "engine/internalencoderfactory.cc",
171 "engine/internalencoderfactory.h",
Emircan Uysalerd7ae3c32018-01-25 13:01:09 -0800172 "engine/multiplexcodecfactory.cc",
173 "engine/multiplexcodecfactory.h",
andersc063f0c02017-09-11 11:50:51 -0700174 "engine/scopedvideodecoder.cc",
175 "engine/scopedvideodecoder.h",
magjed3f897582017-08-28 08:05:42 -0700176 "engine/scopedvideoencoder.cc",
177 "engine/scopedvideoencoder.h",
magjed6cc25612017-07-10 03:26:36 -0700178 "engine/simulcast_encoder_adapter.cc",
179 "engine/simulcast_encoder_adapter.h",
Ilya Nikolaevskiyc22a3a62017-10-25 10:04:54 +0200180 "engine/vp8_encoder_simulcast_proxy.cc",
181 "engine/vp8_encoder_simulcast_proxy.h",
Anders Carlssona114c882018-01-04 15:10:22 +0100182 "engine/webrtcvideodecoderfactory.h",
Anders Carlssona114c882018-01-04 15:10:22 +0100183 "engine/webrtcvideoencoderfactory.h",
184 ]
185
186 configs += [ ":rtc_media_warnings_config" ]
187
188 if (!build_with_chromium && is_clang) {
189 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
190 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
191 }
192
193 if (is_win) {
194 cflags = [
195 "/wd4245", # conversion from "int" to "size_t", signed/unsigned mismatch.
196 "/wd4267", # conversion from "size_t" to "int", possible loss of data.
197 "/wd4389", # signed/unsigned mismatch.
198 ]
199 }
200
201 include_dirs = []
202
203 public_configs = []
204 deps += [
205 ":rtc_constants",
206 ":rtc_media_base",
Anders Carlssondd8c1652018-01-30 10:32:13 +0100207 ":rtc_software_fallback_wrappers",
Anders Carlssona114c882018-01-04 15:10:22 +0100208 "..:webrtc_common",
Niels Möllerc6ce9c52018-05-11 11:15:30 +0200209 "../api/video:video_frame_i420",
Anders Carlssona114c882018-01-04 15:10:22 +0100210 "../api/video_codecs:video_codecs_api",
211 "../call:call_interfaces",
212 "../call:video_stream_api",
213 "../modules/video_coding:webrtc_h264",
Emircan Uysalerd7ae3c32018-01-25 13:01:09 -0800214 "../modules/video_coding:webrtc_multiplex",
Anders Carlssona114c882018-01-04 15:10:22 +0100215 "../modules/video_coding:webrtc_vp8",
216 "../modules/video_coding:webrtc_vp8_helpers",
217 "../modules/video_coding:webrtc_vp9",
218 "../rtc_base:checks",
219 "../rtc_base:rtc_base_approved",
220 "../rtc_base:sequenced_task_checker",
221 "../system_wrappers",
222 "../system_wrappers:field_trial_api",
223 "../system_wrappers:metrics_api",
224 "//third_party/libyuv",
225 ]
226}
227
Anders Carlssondd8c1652018-01-30 10:32:13 +0100228rtc_static_library("rtc_software_fallback_wrappers") {
229 sources = [
230 "engine/videodecodersoftwarefallbackwrapper.cc",
231 "engine/videodecodersoftwarefallbackwrapper.h",
232 "engine/videoencodersoftwarefallbackwrapper.cc",
233 "engine/videoencodersoftwarefallbackwrapper.h",
234 ]
235
236 configs += [ ":rtc_media_warnings_config" ]
237
238 if (!build_with_chromium && is_clang) {
239 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
240 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
241 }
242
243 deps = [
244 ":rtc_h264_profile_id",
245 ":rtc_media_base",
246 "../api/video_codecs:video_codecs_api",
247 "../modules/video_coding:video_codec_interface",
248 "../rtc_base:checks",
249 "../rtc_base:rtc_base_approved",
Sami Kalliomäki99f52f82018-02-23 09:05:49 +0100250 "../rtc_base/system:fallthrough",
Anders Carlssondd8c1652018-01-30 10:32:13 +0100251 "../system_wrappers:field_trial_api",
252 ]
253}
254
Anders Carlssona114c882018-01-04 15:10:22 +0100255rtc_static_library("rtc_audio_video") {
Per Kjellandera7f2d842018-01-10 15:54:53 +0000256 visibility = [ "*" ]
Anders Carlsson1f433e42018-04-24 16:39:05 +0200257 allow_poison = [
258 "audio_codecs", # TODO(bugs.webrtc.org/8396): Remove.
259 "software_video_codecs", # TODO(bugs.webrtc.org/7925): Remove.
260 ]
Anders Carlssona114c882018-01-04 15:10:22 +0100261 defines = []
262 libs = []
263 deps = [
Mirko Bonadeica913b02018-01-26 15:11:40 +0100264 "../modules/audio_processing/aec_dump:aec_dump",
Patrik Höglunda97af1f2018-01-16 10:11:40 +0100265 "../modules/video_coding:video_codec_interface",
Patrik Höglund99175c62018-01-08 11:05:10 +0100266 "../modules/video_coding:video_coding",
Jonas Olssonabbe8412018-04-03 13:40:05 +0200267 "../rtc_base:audio_format_to_string",
Anders Carlssona114c882018-01-04 15:10:22 +0100268 "../rtc_base:checks",
269 ]
270
271 sources = [
272 "engine/adm_helpers.cc",
273 "engine/adm_helpers.h",
274 "engine/apm_helpers.cc",
275 "engine/apm_helpers.h",
276 "engine/nullwebrtcvideoengine.h",
277 "engine/payload_type_mapper.cc",
278 "engine/payload_type_mapper.h",
Anders Carlssondd8c1652018-01-30 10:32:13 +0100279 "engine/simulcast.cc",
280 "engine/simulcast.h",
kjellanderc76dc952016-06-03 03:09:32 -0700281 "engine/webrtcmediaengine.cc",
282 "engine/webrtcmediaengine.h",
283 "engine/webrtcvideocapturer.cc",
284 "engine/webrtcvideocapturer.h",
285 "engine/webrtcvideocapturerfactory.cc",
286 "engine/webrtcvideocapturerfactory.h",
Anders Carlssondd8c1652018-01-30 10:32:13 +0100287 "engine/webrtcvideodecoderfactory.cc",
288 "engine/webrtcvideodecoderfactory.h",
289 "engine/webrtcvideoencoderfactory.cc",
290 "engine/webrtcvideoencoderfactory.h",
eladalonf1841382017-06-12 01:16:46 -0700291 "engine/webrtcvideoengine.cc",
292 "engine/webrtcvideoengine.h",
kjellanderc76dc952016-06-03 03:09:32 -0700293 "engine/webrtcvoiceengine.cc",
294 "engine/webrtcvoiceengine.h",
kjellanderc76dc952016-06-03 03:09:32 -0700295 ]
296
zhihuang38ede132017-06-15 12:52:32 -0700297 configs += [ ":rtc_media_warnings_config" ]
deadbeef40610e22016-12-22 10:53:38 -0800298
kjellandere40a7ee2016-10-16 23:56:12 -0700299 if (!build_with_chromium && is_clang) {
kjellander82a94492016-06-12 22:12:01 -0700300 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
kjellander660312b2016-09-26 06:11:53 -0700301 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellanderc76dc952016-06-03 03:09:32 -0700302 }
303
304 if (is_win) {
305 cflags = [
306 "/wd4245", # conversion from "int" to "size_t", signed/unsigned mismatch.
307 "/wd4267", # conversion from "size_t" to "int", possible loss of data.
308 "/wd4389", # signed/unsigned mismatch.
309 ]
310 }
311
peah1bcfce52016-08-26 07:16:04 -0700312 if (rtc_enable_intelligibility_enhancer) {
313 defines += [ "WEBRTC_INTELLIGIBILITY_ENHANCER=1" ]
314 } else {
315 defines += [ "WEBRTC_INTELLIGIBILITY_ENHANCER=0" ]
316 }
317
minyue2e03c662017-02-01 17:31:11 -0800318 if (rtc_opus_support_120ms_ptime) {
319 defines += [ "WEBRTC_OPUS_SUPPORT_120MS_PTIME=1" ]
320 } else {
321 defines += [ "WEBRTC_OPUS_SUPPORT_120MS_PTIME=0" ]
322 }
323
kjellanderec5c9062016-08-19 01:07:30 -0700324 include_dirs = []
kjellanderc76dc952016-06-03 03:09:32 -0700325
ehmaldonadoe9cc6862016-09-05 06:10:18 -0700326 public_configs = []
kjellanderc76dc952016-06-03 03:09:32 -0700327 if (build_with_chromium) {
328 deps += [ "../modules/video_capture:video_capture" ]
329 } else {
kjellanderc76dc952016-06-03 03:09:32 -0700330 public_configs += [ ":rtc_media_defines_config" ]
331 deps += [ "../modules/video_capture:video_capture_internal_impl" ]
332 }
aleloi048cbdd2017-05-29 02:56:27 -0700333 if (rtc_enable_protobuf) {
334 deps += [ "../modules/audio_processing/aec_dump:aec_dump_impl" ]
335 } else {
336 deps += [ "../modules/audio_processing/aec_dump:null_aec_dump_factory" ]
337 }
Anders Carlssondd8c1652018-01-30 10:32:13 +0100338 if (rtc_use_builtin_sw_codecs) {
339 deps += [ ":rtc_internal_video_codecs" ]
340 }
kjellanderc76dc952016-06-03 03:09:32 -0700341 deps += [
Anders Carlssona114c882018-01-04 15:10:22 +0100342 ":rtc_constants",
magjed0928a3c2016-11-25 00:40:18 -0800343 ":rtc_media_base",
Anders Carlssondd8c1652018-01-30 10:32:13 +0100344 ":rtc_software_fallback_wrappers",
kjellanderc76dc952016-06-03 03:09:32 -0700345 "..:webrtc_common",
kjellandera69d9732016-08-31 07:33:05 -0700346 "../api:call_api",
zhihuang38ede132017-06-15 12:52:32 -0700347 "../api:libjingle_peerconnection_api",
kwiberg84f6a3f2017-09-05 08:43:13 -0700348 "../api:optional",
aleloia8eb7562016-11-28 07:02:13 -0800349 "../api:transport_api",
kjellandera2ef4f92017-03-06 06:04:55 -0800350 "../api/audio_codecs:audio_codecs_api",
Niels Möllerc6ce9c52018-05-11 11:15:30 +0200351 "../api/video:video_frame",
352 "../api/video:video_frame_i420",
ilnikd60d06a2017-04-05 03:02:20 -0700353 "../api/video_codecs:video_codecs_api",
kjellander82a94492016-06-12 22:12:01 -0700354 "../call",
Anders Carlssona114c882018-01-04 15:10:22 +0100355 "../call:call_interfaces",
aleloi440b6d92017-08-22 05:43:23 -0700356 "../call:video_stream_api",
kjellandera2ef4f92017-03-06 06:04:55 -0800357 "../common_video:common_video",
kjellandera2ef4f92017-03-06 06:04:55 -0800358 "../modules/audio_device:audio_device",
Paulina Hensman7bd79a02018-03-15 12:44:12 +0100359 "../modules/audio_device:audio_device_impl",
aleloi10111bc2016-11-17 06:48:48 -0800360 "../modules/audio_mixer:audio_mixer_impl",
kjellandera2ef4f92017-03-06 06:04:55 -0800361 "../modules/audio_processing:audio_processing",
362 "../modules/video_capture:video_capture_module",
zhihuang38ede132017-06-15 12:52:32 -0700363 "../pc:rtc_pc_base",
ehmaldonadof6a861a2017-07-19 10:40:47 -0700364 "../rtc_base:rtc_base",
ehmaldonadof6a861a2017-07-19 10:40:47 -0700365 "../rtc_base:rtc_task_queue",
Anders Carlssona114c882018-01-04 15:10:22 +0100366 "../rtc_base:stringutils",
kjellanderc76dc952016-06-03 03:09:32 -0700367 "../system_wrappers",
Anders Carlssona114c882018-01-04 15:10:22 +0100368 "../system_wrappers:field_trial_api",
369 "../system_wrappers:metrics_api",
kjellanderc76dc952016-06-03 03:09:32 -0700370 ]
371}
kjellander82a94492016-06-12 22:12:01 -0700372
zhihuang38ede132017-06-15 12:52:32 -0700373rtc_static_library("rtc_data") {
374 defines = []
375 deps = []
376
377 if (rtc_enable_sctp) {
378 sources = [
379 "sctp/sctptransport.cc",
380 "sctp/sctptransport.h",
381 "sctp/sctptransportinternal.h",
382 ]
Kári Tristan Helgason4d3e24a2017-12-01 15:26:41 +0100383 } else {
384 # libtool on mac does not like empty targets.
385 sources = [
Mirko Bonadei6c8e6662017-12-13 07:40:54 +0100386 "sctp/noop.cc",
Kári Tristan Helgason4d3e24a2017-12-01 15:26:41 +0100387 ]
zhihuang38ede132017-06-15 12:52:32 -0700388 }
389
390 configs += [ ":rtc_media_warnings_config" ]
391
392 if (!build_with_chromium && is_clang) {
393 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
394 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
395 }
396
397 if (is_win) {
398 cflags = [
399 "/wd4245", # conversion from "int" to "size_t", signed/unsigned mismatch.
400 "/wd4267", # conversion from "size_t" to "int", possible loss of data.
401 "/wd4389", # signed/unsigned mismatch.
402 ]
403 }
404
405 if (rtc_enable_sctp && rtc_build_usrsctp) {
406 include_dirs = [
407 # TODO(jiayl): move this into the public_configs of
408 # //third_party/usrsctp/BUILD.gn.
409 "//third_party/usrsctp/usrsctplib",
410 ]
411 deps += [ "//third_party/usrsctp" ]
412 }
413
414 deps += [
415 ":rtc_media_base",
416 "..:webrtc_common",
417 "../api:call_api",
418 "../api:transport_api",
zhihuang38ede132017-06-15 12:52:32 -0700419 "../p2p:rtc_p2p",
ehmaldonadof6a861a2017-07-19 10:40:47 -0700420 "../rtc_base:rtc_base",
421 "../rtc_base:rtc_base_approved",
zhihuang38ede132017-06-15 12:52:32 -0700422 "../system_wrappers",
423 ]
424}
425
426rtc_source_set("rtc_media") {
Per Kjellandera7f2d842018-01-10 15:54:53 +0000427 visibility = [ "*" ]
Anders Carlsson1f433e42018-04-24 16:39:05 +0200428 allow_poison = [
429 "audio_codecs", # TODO(bugs.webrtc.org/8396): Remove.
430 "software_video_codecs", # TODO(bugs.webrtc.org/7925): Remove.
431 ]
Mirko Bonadei75baa492018-01-11 17:07:30 +0100432 deps = [
zhihuang38ede132017-06-15 12:52:32 -0700433 ":rtc_audio_video",
434 ":rtc_data",
435 ]
436}
437
kjellander82a94492016-06-12 22:12:01 -0700438if (rtc_include_tests) {
439 config("rtc_unittest_main_config") {
440 # GN orders flags on a target before flags from configs. The default config
441 # adds -Wall, and this flag have to be after -Wall -- so they need to
442 # come from a config and can"t be on the target directly.
443 if (is_clang && is_ios) {
444 cflags = [ "-Wno-unused-variable" ]
445 }
446 }
447
mbonadei9087d492017-04-25 00:35:35 -0700448 rtc_source_set("rtc_media_tests_utils") {
kjellander82a94492016-06-12 22:12:01 -0700449 testonly = true
450
kjellanderec5c9062016-08-19 01:07:30 -0700451 include_dirs = []
kjellandera2ef4f92017-03-06 06:04:55 -0800452 deps = [
Mirko Bonadei75baa492018-01-11 17:07:30 +0100453 ":rtc_audio_video",
Patrik Höglundbe214a22018-01-04 12:14:35 +0100454 "../api:libjingle_peerconnection_api",
Niels Möllerc6ce9c52018-05-11 11:15:30 +0200455 "../api/video:video_frame_i420",
aleloi440b6d92017-08-22 05:43:23 -0700456 "../call:video_stream_api",
Patrik Höglundbe214a22018-01-04 12:14:35 +0100457 "../common_video:common_video",
kjellandera2ef4f92017-03-06 06:04:55 -0800458 "../modules/audio_coding:rent_a_codec",
459 "../modules/audio_processing:audio_processing",
Mirko Bonadeib5728d92017-12-06 07:51:33 +0100460 "../modules/rtp_rtcp:rtp_rtcp_format",
Patrik Höglund99175c62018-01-08 11:05:10 +0100461 "../modules/video_coding:video_codec_interface",
charujaincb728ea2017-09-18 03:08:08 -0700462 "../modules/video_coding:video_coding_utility",
kjellandera2ef4f92017-03-06 06:04:55 -0800463 "../p2p:rtc_p2p",
Patrik Höglunda8005cf2017-12-13 16:05:42 +0100464 "../rtc_base:checks",
Tommi8d2c5a82018-03-19 11:12:48 +0100465 "../rtc_base:rtc_task_queue",
Patrik Höglund3e113432017-12-15 14:40:10 +0100466 "../rtc_base:stringutils",
kjellandera2ef4f92017-03-06 06:04:55 -0800467 ]
kjellander82a94492016-06-12 22:12:01 -0700468 sources = [
Niels Möllera6cc0f92018-02-12 17:14:55 +0100469 "base/fakeframesource.cc",
470 "base/fakeframesource.h",
kjellander82a94492016-06-12 22:12:01 -0700471 "base/fakemediaengine.h",
472 "base/fakenetworkinterface.h",
jbauch5869f502017-06-29 12:31:36 -0700473 "base/fakertp.cc",
kjellander82a94492016-06-12 22:12:01 -0700474 "base/fakertp.h",
Tommi1829af62018-02-06 09:29:17 +0100475 "base/fakevideocapturer.cc",
kjellander82a94492016-06-12 22:12:01 -0700476 "base/fakevideocapturer.h",
477 "base/fakevideorenderer.h",
478 "base/testutils.cc",
479 "base/testutils.h",
480 "engine/fakewebrtccall.cc",
481 "engine/fakewebrtccall.h",
kjellander82a94492016-06-12 22:12:01 -0700482 "engine/fakewebrtcdeviceinfo.h",
483 "engine/fakewebrtcvcmfactory.h",
484 "engine/fakewebrtcvideocapturemodule.h",
Anders Carlsson67537952018-05-03 11:28:29 +0200485 "engine/fakewebrtcvideoengine.cc",
kjellander82a94492016-06-12 22:12:01 -0700486 "engine/fakewebrtcvideoengine.h",
kjellander82a94492016-06-12 22:12:01 -0700487 ]
488
ehmaldonado7a2ce0b2016-09-05 01:35:44 -0700489 configs += [ ":rtc_unittest_main_config" ]
kjellander82a94492016-06-12 22:12:01 -0700490
kjellandere40a7ee2016-10-16 23:56:12 -0700491 if (!build_with_chromium && is_clang) {
492 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
ehmaldonado38a21322016-09-02 04:10:34 -0700493 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellander82a94492016-06-12 22:12:01 -0700494 }
495
496 deps += [
Anders Carlssona114c882018-01-04 15:10:22 +0100497 ":rtc_internal_video_codecs",
kjellandera2ef4f92017-03-06 06:04:55 -0800498 ":rtc_media",
499 ":rtc_media_base",
500 "..:webrtc_common",
501 "../api:call_api",
Niels Möllerc6ce9c52018-05-11 11:15:30 +0200502 "../api/video:video_frame",
ilnikd60d06a2017-04-05 03:02:20 -0700503 "../api/video_codecs:video_codecs_api",
kjellandera2ef4f92017-03-06 06:04:55 -0800504 "../call:call_interfaces",
Sebastian Jansson8f83b422018-02-21 13:07:13 +0100505 "../call:mock_rtp_interfaces",
ehmaldonadof6a861a2017-07-19 10:40:47 -0700506 "../rtc_base:rtc_base",
507 "../rtc_base:rtc_base_approved",
508 "../rtc_base:rtc_base_tests_utils",
Tommi68561562018-02-13 19:47:50 +0100509 "../rtc_base:rtc_task_queue_for_test",
kjellandera2ef4f92017-03-06 06:04:55 -0800510 "../test:test_support",
kjellander82a94492016-06-12 22:12:01 -0700511 "//testing/gtest",
512 ]
kjellander82a94492016-06-12 22:12:01 -0700513 }
514
515 config("rtc_media_unittests_config") {
516 # GN orders flags on a target before flags from configs. The default config
517 # adds -Wall, and this flag have to be after -Wall -- so they need to
518 # come from a config and can"t be on the target directly.
519 # TODO(kjellander): Make the code compile without disabling these flags.
520 # See https://bugs.webrtc.org/3307.
521 if (is_clang && is_win) {
ehmaldonadod02fe4b2016-08-26 13:31:24 -0700522 cflags = [
523 # See https://bugs.chromium.org/p/webrtc/issues/detail?id=6266
524 # for -Wno-sign-compare
525 "-Wno-sign-compare",
ehmaldonadod02fe4b2016-08-26 13:31:24 -0700526 ]
kjellander82a94492016-06-12 22:12:01 -0700527 }
528 if (!is_win) {
529 cflags = [ "-Wno-sign-compare" ]
kjellander82a94492016-06-12 22:12:01 -0700530 }
531 }
532
ehmaldonado3a7f35b2016-09-14 05:10:01 -0700533 rtc_media_unittests_resources = [
Mirko Bonadei92ea95e2017-09-15 06:47:31 +0200534 "../resources/media/captured-320x240-2s-48.frames",
535 "../resources/media/faces.1280x720_P420.yuv",
536 "../resources/media/faces_I420.jpg",
537 "../resources/media/faces_I422.jpg",
538 "../resources/media/faces_I444.jpg",
539 "../resources/media/faces_I411.jpg",
540 "../resources/media/faces_I400.jpg",
ehmaldonado3a7f35b2016-09-14 05:10:01 -0700541 ]
kjellander32c4a202016-08-30 02:53:49 -0700542
543 if (is_ios) {
544 bundle_data("rtc_media_unittests_bundle_data") {
545 testonly = true
546 sources = rtc_media_unittests_resources
547 outputs = [
548 "{{bundle_resources_dir}}/{{source_file_part}}",
549 ]
550 }
551 }
552
ehmaldonado38a21322016-09-02 04:10:34 -0700553 rtc_test("rtc_media_unittests") {
kjellander82a94492016-06-12 22:12:01 -0700554 testonly = true
555
johan073ece42016-08-26 02:59:47 -0700556 defines = []
kjellandera2ef4f92017-03-06 06:04:55 -0800557 deps = [
Mirko Bonadei75baa492018-01-11 17:07:30 +0100558 ":rtc_audio_video",
Anders Carlssona114c882018-01-04 15:10:22 +0100559 ":rtc_constants",
Mirko Bonadei75baa492018-01-11 17:07:30 +0100560 ":rtc_data",
Niels Möllerc6ce9c52018-05-11 11:15:30 +0200561 "../api/video:video_frame_i420",
Patrik Höglund62139292017-12-19 16:44:45 +0100562 "../modules/audio_processing:mocks",
Patrik Höglund99175c62018-01-08 11:05:10 +0100563 "../modules/video_coding:video_codec_interface",
kjellandera2ef4f92017-03-06 06:04:55 -0800564 "../pc:rtc_pc",
Mirko Bonadeie51f7852017-12-06 11:23:19 +0100565 "../pc:rtc_pc_base",
Patrik Höglunda8005cf2017-12-13 16:05:42 +0100566 "../rtc_base:checks",
Tommi8d2c5a82018-03-19 11:12:48 +0100567 "../rtc_base:rtc_task_queue",
Patrik Höglund3e113432017-12-15 14:40:10 +0100568 "../rtc_base:stringutils",
kjellandera2ef4f92017-03-06 06:04:55 -0800569 "../test:field_trial",
570 ]
kjellander82a94492016-06-12 22:12:01 -0700571 sources = [
572 "base/codec_unittest.cc",
573 "base/rtpdataengine_unittest.cc",
kjellander82a94492016-06-12 22:12:01 -0700574 "base/rtputils_unittest.cc",
575 "base/streamparams_unittest.cc",
576 "base/turnutils_unittest.cc",
577 "base/videoadapter_unittest.cc",
578 "base/videobroadcaster_unittest.cc",
579 "base/videocapturer_unittest.cc",
580 "base/videocommon_unittest.cc",
solenberg76377c52017-02-21 00:54:31 -0800581 "engine/apm_helpers_unittest.cc",
magjeddd407022016-12-01 00:27:27 -0800582 "engine/internaldecoderfactory_unittest.cc",
Emircan Uysalerd7ae3c32018-01-25 13:01:09 -0800583 "engine/multiplexcodecfactory_unittest.cc",
kjellander82a94492016-06-12 22:12:01 -0700584 "engine/nullwebrtcvideoengine_unittest.cc",
ossuc54071d2016-08-17 02:45:41 -0700585 "engine/payload_type_mapper_unittest.cc",
magjed6cc25612017-07-10 03:26:36 -0700586 "engine/simulcast_encoder_adapter_unittest.cc",
kjellander82a94492016-06-12 22:12:01 -0700587 "engine/simulcast_unittest.cc",
magjedf6acc2a2016-11-22 01:43:03 -0800588 "engine/videodecodersoftwarefallbackwrapper_unittest.cc",
magjed614d5b72016-11-15 06:30:54 -0800589 "engine/videoencodersoftwarefallbackwrapper_unittest.cc",
Ilya Nikolaevskiyc22a3a62017-10-25 10:04:54 +0200590 "engine/vp8_encoder_simulcast_proxy_unittest.cc",
kjellander82a94492016-06-12 22:12:01 -0700591 "engine/webrtcmediaengine_unittest.cc",
592 "engine/webrtcvideocapturer_unittest.cc",
noahricbe850e12017-01-20 01:07:26 -0800593 "engine/webrtcvideoencoderfactory_unittest.cc",
eladalonf1841382017-06-12 01:16:46 -0700594 "engine/webrtcvideoengine_unittest.cc",
kjellander82a94492016-06-12 22:12:01 -0700595 ]
596
oprypin45197522017-06-22 01:47:20 -0700597 # TODO(kthelgason): Reenable this test on iOS.
598 # See bugs.webrtc.org/5569
599 if (!is_ios) {
600 sources += [ "engine/webrtcvoiceengine_unittest.cc" ]
601 }
602
deadbeef40610e22016-12-22 10:53:38 -0800603 if (rtc_enable_sctp) {
deadbeef953c2ce2017-01-09 14:53:41 -0800604 sources += [ "sctp/sctptransport_unittest.cc" ]
deadbeef40610e22016-12-22 10:53:38 -0800605 }
606
ehmaldonado7a2ce0b2016-09-05 01:35:44 -0700607 configs += [ ":rtc_media_unittests_config" ]
kjellander82a94492016-06-12 22:12:01 -0700608
johan073ece42016-08-26 02:59:47 -0700609 if (rtc_use_h264) {
610 defines += [ "WEBRTC_USE_H264" ]
611 }
ossu11bfc532017-02-16 05:37:06 -0800612
613 if (rtc_opus_support_120ms_ptime) {
614 defines += [ "WEBRTC_OPUS_SUPPORT_120MS_PTIME=1" ]
615 } else {
616 defines += [ "WEBRTC_OPUS_SUPPORT_120MS_PTIME=0" ]
617 }
618
kjellander82a94492016-06-12 22:12:01 -0700619 if (is_win) {
620 cflags = [
621 "/wd4245", # conversion from int to size_t, signed/unsigned mismatch.
kjellander82a94492016-06-12 22:12:01 -0700622 "/wd4389", # signed/unsigned mismatch.
623 ]
624 }
625
kjellandere40a7ee2016-10-16 23:56:12 -0700626 if (!build_with_chromium && is_clang) {
ehmaldonado38a21322016-09-02 04:10:34 -0700627 suppressed_configs += [
kjellander82a94492016-06-12 22:12:01 -0700628 "//build/config/clang:extra_warnings",
kjellandere40a7ee2016-10-16 23:56:12 -0700629
630 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
kjellander82a94492016-06-12 22:12:01 -0700631 "//build/config/clang:find_bad_constructs",
632 ]
633 }
634
ehmaldonado3a7f35b2016-09-14 05:10:01 -0700635 data = rtc_media_unittests_resources
636
kjellander82a94492016-06-12 22:12:01 -0700637 if (is_android) {
638 deps += [ "//testing/android/native_test:native_test_support" ]
kjellander28a0ffd2016-08-24 07:48:42 -0700639 shard_timeout = 900
640 }
kjellander32c4a202016-08-30 02:53:49 -0700641
642 if (is_ios) {
643 deps += [ ":rtc_media_unittests_bundle_data" ]
kjellander82a94492016-06-12 22:12:01 -0700644 }
645
646 deps += [
Anders Carlssona114c882018-01-04 15:10:22 +0100647 ":rtc_internal_video_codecs",
kjellander82a94492016-06-12 22:12:01 -0700648 ":rtc_media",
kjellandera2ef4f92017-03-06 06:04:55 -0800649 ":rtc_media_base",
mbonadei9087d492017-04-25 00:35:35 -0700650 ":rtc_media_tests_utils",
Anders Carlssondd8c1652018-01-30 10:32:13 +0100651 ":rtc_software_fallback_wrappers",
Seth Hampson24722b32017-12-22 09:36:42 -0800652 "../api:libjingle_peerconnection_api",
Emircan Uysalerdbcac7f2017-10-30 23:10:12 -0700653 "../api:mock_video_codec_factory",
kjellandera2ef4f92017-03-06 06:04:55 -0800654 "../api/audio_codecs:builtin_audio_decoder_factory",
ossueb1fde42017-05-02 06:46:30 -0700655 "../api/audio_codecs:builtin_audio_encoder_factory",
Niels Möllerc6ce9c52018-05-11 11:15:30 +0200656 "../api/video:video_frame",
ilnikd60d06a2017-04-05 03:02:20 -0700657 "../api/video_codecs:video_codecs_api",
kjellander82a94492016-06-12 22:12:01 -0700658 "../audio",
kjellandera2ef4f92017-03-06 06:04:55 -0800659 "../call:call_interfaces",
660 "../common_video:common_video",
661 "../logging:rtc_event_log_api",
Qingsi Wang970b0882018-02-01 11:04:46 -0800662 "../logging:rtc_event_log_impl_base",
aleloi5de52fd2016-11-10 01:05:34 -0800663 "../modules/audio_device:mock_audio_device",
kjellandera2ef4f92017-03-06 06:04:55 -0800664 "../modules/audio_processing:audio_processing",
magjed6cc25612017-07-10 03:26:36 -0700665 "../modules/video_coding:simulcast_test_utility",
kjellandera2ef4f92017-03-06 06:04:55 -0800666 "../modules/video_coding:video_coding_utility",
Anders Carlssona114c882018-01-04 15:10:22 +0100667 "../modules/video_coding:webrtc_vp8_helpers",
deadbeef59edb922017-04-18 15:49:09 -0700668 "../p2p:p2p_test_utils",
ehmaldonadof6a861a2017-07-19 10:40:47 -0700669 "../rtc_base:rtc_base",
670 "../rtc_base:rtc_base_approved",
671 "../rtc_base:rtc_base_tests_main",
672 "../rtc_base:rtc_base_tests_utils",
kjellander82a94492016-06-12 22:12:01 -0700673 "../system_wrappers:metrics_default",
Ilya Nikolaevskiy2ffe3e82018-01-17 19:57:24 +0000674 "../system_wrappers:runtime_enabled_features_default",
kwiberg37e99fd2017-04-10 05:15:48 -0700675 "../test:audio_codec_mocks",
kjellandera2ef4f92017-03-06 06:04:55 -0800676 "../test:test_support",
Ilya Nikolaevskiyc22a3a62017-10-25 10:04:54 +0200677 "../test:video_test_common",
kjellander82a94492016-06-12 22:12:01 -0700678 ]
679 }
680}