blob: 93f98a974da0add122eafdbf10ab50a55efb8355 [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")
10import("../build/webrtc.gni")
11
12group("media") {
kjellander705ecc52016-09-15 00:53:26 -070013 public_deps = [
kjellanderc76dc952016-06-03 03:09:32 -070014 ":rtc_media",
magjed0928a3c2016-11-25 00:40:18 -080015 ":rtc_media_base",
kjellanderc76dc952016-06-03 03:09:32 -070016 ]
17}
18
19config("rtc_media_defines_config") {
20 defines = [
21 "HAVE_WEBRTC_VIDEO",
22 "HAVE_WEBRTC_VOICE",
23 ]
24}
25
26config("rtc_media_warnings_config") {
27 # GN orders flags on a target before flags from configs. The default config
28 # adds these flags so to cancel them out they need to come from a config and
29 # cannot be on the target directly.
30 if (!is_win) {
31 cflags = [ "-Wno-deprecated-declarations" ]
kjellanderc76dc952016-06-03 03:09:32 -070032 }
33}
34
35if (is_linux && rtc_use_gtk) {
36 pkg_config("gtk-lib") {
37 packages = [
38 "gobject-2.0",
39 "gthread-2.0",
40 "gtk+-2.0",
41 ]
42 }
43}
44
magjed0928a3c2016-11-25 00:40:18 -080045rtc_static_library("rtc_media_base") {
kjellanderc76dc952016-06-03 03:09:32 -070046 defines = []
47 libs = []
48 deps = []
49 sources = [
nisse6f5a6c32016-09-22 01:25:59 -070050 "base/adaptedvideotracksource.cc",
51 "base/adaptedvideotracksource.h",
kjellanderc76dc952016-06-03 03:09:32 -070052 "base/audiosource.h",
53 "base/codec.cc",
54 "base/codec.h",
kjellanderc76dc952016-06-03 03:09:32 -070055 "base/cryptoparams.h",
56 "base/device.h",
kjellanderc76dc952016-06-03 03:09:32 -070057 "base/hybriddataengine.h",
58 "base/mediachannel.h",
kjellanderc76dc952016-06-03 03:09:32 -070059 "base/mediaconstants.cc",
60 "base/mediaconstants.h",
61 "base/mediaengine.cc",
62 "base/mediaengine.h",
63 "base/rtpdataengine.cc",
64 "base/rtpdataengine.h",
65 "base/rtpdump.cc",
66 "base/rtpdump.h",
67 "base/rtputils.cc",
68 "base/rtputils.h",
kjellanderc76dc952016-06-03 03:09:32 -070069 "base/streamparams.cc",
70 "base/streamparams.h",
71 "base/turnutils.cc",
72 "base/turnutils.h",
73 "base/videoadapter.cc",
74 "base/videoadapter.h",
75 "base/videobroadcaster.cc",
76 "base/videobroadcaster.h",
77 "base/videocapturer.cc",
78 "base/videocapturer.h",
79 "base/videocapturerfactory.h",
80 "base/videocommon.cc",
81 "base/videocommon.h",
kjellanderc76dc952016-06-03 03:09:32 -070082 "base/videoframe.h",
kjellanderc76dc952016-06-03 03:09:32 -070083 "base/videosourcebase.cc",
84 "base/videosourcebase.h",
magjed0928a3c2016-11-25 00:40:18 -080085 ]
86
87 configs += [ ":rtc_media_warnings_config" ]
88
89 if (!build_with_chromium && is_clang) {
90 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
91 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
92 }
93
94 include_dirs = []
95 if (rtc_build_libyuv) {
96 deps += [ "$rtc_libyuv_dir" ]
97 public_deps = [
98 "$rtc_libyuv_dir",
99 ]
100 } else {
101 # Need to add a directory normally exported by libyuv.
102 include_dirs += [ "$rtc_libyuv_dir/include" ]
103 }
104
105 deps += [
106 "..:webrtc_common",
107 "../base:rtc_base_approved",
108 "../p2p",
109 ]
110}
111
112rtc_static_library("rtc_media") {
113 defines = []
114 libs = []
115 deps = []
116 sources = [
117 # TODO(magjed): Remove base header files once Chromium is updated.
118 "base/adaptedvideotracksource.h",
119 "base/audiosource.h",
120 "base/codec.h",
121 "base/cryptoparams.h",
122 "base/device.h",
123 "base/hybriddataengine.h",
124 "base/mediachannel.h",
125 "base/mediaconstants.h",
126 "base/mediaengine.h",
127 "base/rtpdataengine.h",
128 "base/rtpdump.h",
129 "base/rtputils.h",
130 "base/streamparams.h",
131 "base/turnutils.h",
132 "base/videoadapter.h",
133 "base/videobroadcaster.h",
134 "base/videocapturer.h",
135 "base/videocapturerfactory.h",
136 "base/videocommon.h",
137 "base/videoframe.h",
138 "base/videosourcebase.h",
magjed509e4fe2016-11-18 01:34:11 -0800139 "engine/internalencoderfactory.cc",
140 "engine/internalencoderfactory.h",
kjellanderc76dc952016-06-03 03:09:32 -0700141 "engine/nullwebrtcvideoengine.h",
ossu6f06cca2016-07-13 10:06:22 -0700142 "engine/payload_type_mapper.cc",
143 "engine/payload_type_mapper.h",
kjellanderc76dc952016-06-03 03:09:32 -0700144 "engine/simulcast.cc",
145 "engine/simulcast.h",
magjedf6acc2a2016-11-22 01:43:03 -0800146 "engine/videodecodersoftwarefallbackwrapper.cc",
147 "engine/videodecodersoftwarefallbackwrapper.h",
magjed614d5b72016-11-15 06:30:54 -0800148 "engine/videoencodersoftwarefallbackwrapper.cc",
149 "engine/videoencodersoftwarefallbackwrapper.h",
kjellanderc76dc952016-06-03 03:09:32 -0700150 "engine/webrtccommon.h",
151 "engine/webrtcmediaengine.cc",
152 "engine/webrtcmediaengine.h",
153 "engine/webrtcvideocapturer.cc",
154 "engine/webrtcvideocapturer.h",
155 "engine/webrtcvideocapturerfactory.cc",
156 "engine/webrtcvideocapturerfactory.h",
157 "engine/webrtcvideodecoderfactory.h",
magjed1e45cc62016-10-28 07:43:45 -0700158 "engine/webrtcvideoencoderfactory.cc",
kjellanderc76dc952016-06-03 03:09:32 -0700159 "engine/webrtcvideoencoderfactory.h",
160 "engine/webrtcvideoengine2.cc",
161 "engine/webrtcvideoengine2.h",
kjellanderc76dc952016-06-03 03:09:32 -0700162 "engine/webrtcvideoframe.h",
kjellanderc76dc952016-06-03 03:09:32 -0700163 "engine/webrtcvoe.h",
164 "engine/webrtcvoiceengine.cc",
165 "engine/webrtcvoiceengine.h",
166 "sctp/sctpdataengine.cc",
167 "sctp/sctpdataengine.h",
168 ]
169
ehmaldonado7a2ce0b2016-09-05 01:35:44 -0700170 configs += [ ":rtc_media_warnings_config" ]
kjellanderc76dc952016-06-03 03:09:32 -0700171
kjellandere40a7ee2016-10-16 23:56:12 -0700172 if (!build_with_chromium && is_clang) {
kjellander82a94492016-06-12 22:12:01 -0700173 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
kjellander660312b2016-09-26 06:11:53 -0700174 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellanderc76dc952016-06-03 03:09:32 -0700175 }
176
177 if (is_win) {
178 cflags = [
179 "/wd4245", # conversion from "int" to "size_t", signed/unsigned mismatch.
180 "/wd4267", # conversion from "size_t" to "int", possible loss of data.
181 "/wd4389", # signed/unsigned mismatch.
182 ]
183 }
184
peah1bcfce52016-08-26 07:16:04 -0700185 if (rtc_enable_intelligibility_enhancer) {
186 defines += [ "WEBRTC_INTELLIGIBILITY_ENHANCER=1" ]
187 } else {
188 defines += [ "WEBRTC_INTELLIGIBILITY_ENHANCER=0" ]
189 }
190
kjellanderec5c9062016-08-19 01:07:30 -0700191 include_dirs = []
kjellanderc76dc952016-06-03 03:09:32 -0700192 if (rtc_build_libyuv) {
193 deps += [ "$rtc_libyuv_dir" ]
194 public_deps = [
195 "$rtc_libyuv_dir",
196 ]
197 } else {
198 # Need to add a directory normally exported by libyuv.
199 include_dirs += [ "$rtc_libyuv_dir/include" ]
200 }
201
202 if (rtc_build_usrsctp) {
kjellanderec5c9062016-08-19 01:07:30 -0700203 include_dirs += [
kjellanderc76dc952016-06-03 03:09:32 -0700204 # TODO(jiayl): move this into the public_configs of
205 # //third_party/usrsctp/BUILD.gn.
206 "//third_party/usrsctp/usrsctplib",
207 ]
208 deps += [ "//third_party/usrsctp" ]
209 }
210
ehmaldonadoe9cc6862016-09-05 06:10:18 -0700211 public_configs = []
kjellanderc76dc952016-06-03 03:09:32 -0700212 if (build_with_chromium) {
213 deps += [ "../modules/video_capture:video_capture" ]
214 } else {
kjellanderc76dc952016-06-03 03:09:32 -0700215 public_configs += [ ":rtc_media_defines_config" ]
216 deps += [ "../modules/video_capture:video_capture_internal_impl" ]
217 }
218 if (is_linux && rtc_use_gtk) {
219 sources += [
220 "devices/gtkvideorenderer.cc",
221 "devices/gtkvideorenderer.h",
222 ]
223 public_configs += [ ":gtk-lib" ]
224 }
kjellanderc76dc952016-06-03 03:09:32 -0700225 deps += [
magjed0928a3c2016-11-25 00:40:18 -0800226 ":rtc_media_base",
kjellanderc76dc952016-06-03 03:09:32 -0700227 "..:webrtc_common",
kjellandera69d9732016-08-31 07:33:05 -0700228 "../api:call_api",
aleloia8eb7562016-11-28 07:02:13 -0800229 "../api:transport_api",
kjellanderc76dc952016-06-03 03:09:32 -0700230 "../base:rtc_base_approved",
kjellander82a94492016-06-12 22:12:01 -0700231 "../call",
aleloi10111bc2016-11-17 06:48:48 -0800232 "../modules/audio_mixer:audio_mixer_impl",
kjellander82a94492016-06-12 22:12:01 -0700233 "../modules/video_coding",
kjellanderc76dc952016-06-03 03:09:32 -0700234 "../system_wrappers",
235 "../voice_engine",
236 ]
237}
kjellander82a94492016-06-12 22:12:01 -0700238
239if (rtc_include_tests) {
240 config("rtc_unittest_main_config") {
241 # GN orders flags on a target before flags from configs. The default config
242 # adds -Wall, and this flag have to be after -Wall -- so they need to
243 # come from a config and can"t be on the target directly.
244 if (is_clang && is_ios) {
245 cflags = [ "-Wno-unused-variable" ]
246 }
247 }
248
ehmaldonado38a21322016-09-02 04:10:34 -0700249 rtc_source_set("rtc_unittest_main") {
kjellander82a94492016-06-12 22:12:01 -0700250 testonly = true
251
kjellanderec5c9062016-08-19 01:07:30 -0700252 include_dirs = []
253 public_deps = []
kjellander82a94492016-06-12 22:12:01 -0700254 deps = []
255 sources = [
256 "base/fakemediaengine.h",
257 "base/fakenetworkinterface.h",
258 "base/fakertp.h",
259 "base/fakevideocapturer.h",
260 "base/fakevideorenderer.h",
hbosb24b1ce2016-08-16 01:19:43 -0700261 "base/test/mock_mediachannel.h",
kjellander82a94492016-06-12 22:12:01 -0700262 "base/testutils.cc",
263 "base/testutils.h",
264 "engine/fakewebrtccall.cc",
265 "engine/fakewebrtccall.h",
kjellander82a94492016-06-12 22:12:01 -0700266 "engine/fakewebrtcdeviceinfo.h",
267 "engine/fakewebrtcvcmfactory.h",
268 "engine/fakewebrtcvideocapturemodule.h",
269 "engine/fakewebrtcvideoengine.h",
270 "engine/fakewebrtcvoiceengine.h",
271 ]
272
ehmaldonado7a2ce0b2016-09-05 01:35:44 -0700273 configs += [ ":rtc_unittest_main_config" ]
kjellander82a94492016-06-12 22:12:01 -0700274
275 if (rtc_build_libyuv) {
276 deps += [ "$rtc_libyuv_dir" ]
kjellanderec5c9062016-08-19 01:07:30 -0700277 public_deps += [ "$rtc_libyuv_dir" ]
kjellander82a94492016-06-12 22:12:01 -0700278 } else {
279 # Need to add a directory normally exported by libyuv.
280 include_dirs += [ "$rtc_libyuv_dir/include" ]
281 }
282
kjellandere40a7ee2016-10-16 23:56:12 -0700283 if (!build_with_chromium && is_clang) {
284 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
ehmaldonado38a21322016-09-02 04:10:34 -0700285 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellander82a94492016-06-12 22:12:01 -0700286 }
287
288 deps += [
289 "../base:rtc_base_tests_utils",
290 "//testing/gtest",
291 ]
292 public_deps += [ "//testing/gmock" ]
293 }
294
295 config("rtc_media_unittests_config") {
296 # GN orders flags on a target before flags from configs. The default config
297 # adds -Wall, and this flag have to be after -Wall -- so they need to
298 # come from a config and can"t be on the target directly.
299 # TODO(kjellander): Make the code compile without disabling these flags.
300 # See https://bugs.webrtc.org/3307.
301 if (is_clang && is_win) {
ehmaldonadod02fe4b2016-08-26 13:31:24 -0700302 cflags = [
303 # See https://bugs.chromium.org/p/webrtc/issues/detail?id=6266
304 # for -Wno-sign-compare
305 "-Wno-sign-compare",
306 "-Wno-unused-function",
307 ]
kjellander82a94492016-06-12 22:12:01 -0700308 }
309 if (!is_win) {
310 cflags = [ "-Wno-sign-compare" ]
kjellander82a94492016-06-12 22:12:01 -0700311 }
312 }
313
ehmaldonado3a7f35b2016-09-14 05:10:01 -0700314 rtc_media_unittests_resources = [
315 "//resources/media/captured-320x240-2s-48.frames",
316 "//resources/media/faces.1280x720_P420.yuv",
317 "//resources/media/faces_I420.jpg",
318 "//resources/media/faces_I422.jpg",
319 "//resources/media/faces_I444.jpg",
320 "//resources/media/faces_I411.jpg",
321 "//resources/media/faces_I400.jpg",
322 ]
kjellander32c4a202016-08-30 02:53:49 -0700323
324 if (is_ios) {
325 bundle_data("rtc_media_unittests_bundle_data") {
326 testonly = true
327 sources = rtc_media_unittests_resources
328 outputs = [
329 "{{bundle_resources_dir}}/{{source_file_part}}",
330 ]
331 }
332 }
333
ehmaldonado38a21322016-09-02 04:10:34 -0700334 rtc_test("rtc_media_unittests") {
kjellander82a94492016-06-12 22:12:01 -0700335 testonly = true
336
johan073ece42016-08-26 02:59:47 -0700337 defines = []
kjellander82a94492016-06-12 22:12:01 -0700338 deps = []
339 sources = [
340 "base/codec_unittest.cc",
341 "base/rtpdataengine_unittest.cc",
342 "base/rtpdump_unittest.cc",
343 "base/rtputils_unittest.cc",
344 "base/streamparams_unittest.cc",
345 "base/turnutils_unittest.cc",
346 "base/videoadapter_unittest.cc",
347 "base/videobroadcaster_unittest.cc",
348 "base/videocapturer_unittest.cc",
349 "base/videocommon_unittest.cc",
350 "base/videoengine_unittest.h",
kjellander82a94492016-06-12 22:12:01 -0700351 "engine/nullwebrtcvideoengine_unittest.cc",
ossuc54071d2016-08-17 02:45:41 -0700352 "engine/payload_type_mapper_unittest.cc",
kjellander82a94492016-06-12 22:12:01 -0700353 "engine/simulcast_unittest.cc",
magjedf6acc2a2016-11-22 01:43:03 -0800354 "engine/videodecodersoftwarefallbackwrapper_unittest.cc",
magjed614d5b72016-11-15 06:30:54 -0800355 "engine/videoencodersoftwarefallbackwrapper_unittest.cc",
kjellander82a94492016-06-12 22:12:01 -0700356 "engine/webrtcmediaengine_unittest.cc",
357 "engine/webrtcvideocapturer_unittest.cc",
358 "engine/webrtcvideoengine2_unittest.cc",
kjellander82a94492016-06-12 22:12:01 -0700359 "engine/webrtcvoiceengine_unittest.cc",
360 "sctp/sctpdataengine_unittest.cc",
361 ]
362
ehmaldonado7a2ce0b2016-09-05 01:35:44 -0700363 configs += [ ":rtc_media_unittests_config" ]
kjellander82a94492016-06-12 22:12:01 -0700364
johan073ece42016-08-26 02:59:47 -0700365 if (rtc_use_h264) {
366 defines += [ "WEBRTC_USE_H264" ]
367 }
kjellander82a94492016-06-12 22:12:01 -0700368 if (is_win) {
369 cflags = [
370 "/wd4245", # conversion from int to size_t, signed/unsigned mismatch.
371 "/wd4373", # virtual function override.
372 "/wd4389", # signed/unsigned mismatch.
373 ]
374 }
375
kjellandere40a7ee2016-10-16 23:56:12 -0700376 if (!build_with_chromium && is_clang) {
ehmaldonado38a21322016-09-02 04:10:34 -0700377 suppressed_configs += [
kjellander82a94492016-06-12 22:12:01 -0700378 "//build/config/clang:extra_warnings",
kjellandere40a7ee2016-10-16 23:56:12 -0700379
380 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
kjellander82a94492016-06-12 22:12:01 -0700381 "//build/config/clang:find_bad_constructs",
382 ]
383 }
384
ehmaldonado3a7f35b2016-09-14 05:10:01 -0700385 data = rtc_media_unittests_resources
386
kjellander82a94492016-06-12 22:12:01 -0700387 if (is_android) {
388 deps += [ "//testing/android/native_test:native_test_support" ]
kjellander28a0ffd2016-08-24 07:48:42 -0700389 shard_timeout = 900
390 }
kjellander32c4a202016-08-30 02:53:49 -0700391
392 if (is_ios) {
393 deps += [ ":rtc_media_unittests_bundle_data" ]
kjellander82a94492016-06-12 22:12:01 -0700394 }
395
396 deps += [
397 # TODO(kjellander): Move as part of work in bugs.webrtc.org/4243.
398 ":rtc_media",
399 ":rtc_unittest_main",
400 "../audio",
401 "../base:rtc_base_tests_utils",
aleloi5de52fd2016-11-10 01:05:34 -0800402 "../modules/audio_device:mock_audio_device",
kjellander82a94492016-06-12 22:12:01 -0700403 "../system_wrappers:metrics_default",
404 ]
405 }
406}