blob: 75f1a317766fddddd2614f53d3ec286aacc270ed [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",
kjellanderc76dc952016-06-03 03:09:32 -0700229 "../base:rtc_base_approved",
kjellander82a94492016-06-12 22:12:01 -0700230 "../call",
aleloi10111bc2016-11-17 06:48:48 -0800231 "../modules/audio_mixer:audio_mixer_impl",
kjellander82a94492016-06-12 22:12:01 -0700232 "../modules/video_coding",
kjellanderc76dc952016-06-03 03:09:32 -0700233 "../system_wrappers",
234 "../voice_engine",
235 ]
236}
kjellander82a94492016-06-12 22:12:01 -0700237
238if (rtc_include_tests) {
239 config("rtc_unittest_main_config") {
240 # GN orders flags on a target before flags from configs. The default config
241 # adds -Wall, and this flag have to be after -Wall -- so they need to
242 # come from a config and can"t be on the target directly.
243 if (is_clang && is_ios) {
244 cflags = [ "-Wno-unused-variable" ]
245 }
246 }
247
ehmaldonado38a21322016-09-02 04:10:34 -0700248 rtc_source_set("rtc_unittest_main") {
kjellander82a94492016-06-12 22:12:01 -0700249 testonly = true
250
kjellanderec5c9062016-08-19 01:07:30 -0700251 include_dirs = []
252 public_deps = []
kjellander82a94492016-06-12 22:12:01 -0700253 deps = []
254 sources = [
255 "base/fakemediaengine.h",
256 "base/fakenetworkinterface.h",
257 "base/fakertp.h",
258 "base/fakevideocapturer.h",
259 "base/fakevideorenderer.h",
hbosb24b1ce2016-08-16 01:19:43 -0700260 "base/test/mock_mediachannel.h",
kjellander82a94492016-06-12 22:12:01 -0700261 "base/testutils.cc",
262 "base/testutils.h",
263 "engine/fakewebrtccall.cc",
264 "engine/fakewebrtccall.h",
kjellander82a94492016-06-12 22:12:01 -0700265 "engine/fakewebrtcdeviceinfo.h",
266 "engine/fakewebrtcvcmfactory.h",
267 "engine/fakewebrtcvideocapturemodule.h",
268 "engine/fakewebrtcvideoengine.h",
269 "engine/fakewebrtcvoiceengine.h",
270 ]
271
ehmaldonado7a2ce0b2016-09-05 01:35:44 -0700272 configs += [ ":rtc_unittest_main_config" ]
kjellander82a94492016-06-12 22:12:01 -0700273
274 if (rtc_build_libyuv) {
275 deps += [ "$rtc_libyuv_dir" ]
kjellanderec5c9062016-08-19 01:07:30 -0700276 public_deps += [ "$rtc_libyuv_dir" ]
kjellander82a94492016-06-12 22:12:01 -0700277 } else {
278 # Need to add a directory normally exported by libyuv.
279 include_dirs += [ "$rtc_libyuv_dir/include" ]
280 }
281
kjellandere40a7ee2016-10-16 23:56:12 -0700282 if (!build_with_chromium && is_clang) {
283 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
ehmaldonado38a21322016-09-02 04:10:34 -0700284 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellander82a94492016-06-12 22:12:01 -0700285 }
286
287 deps += [
288 "../base:rtc_base_tests_utils",
289 "//testing/gtest",
290 ]
291 public_deps += [ "//testing/gmock" ]
292 }
293
294 config("rtc_media_unittests_config") {
295 # GN orders flags on a target before flags from configs. The default config
296 # adds -Wall, and this flag have to be after -Wall -- so they need to
297 # come from a config and can"t be on the target directly.
298 # TODO(kjellander): Make the code compile without disabling these flags.
299 # See https://bugs.webrtc.org/3307.
300 if (is_clang && is_win) {
ehmaldonadod02fe4b2016-08-26 13:31:24 -0700301 cflags = [
302 # See https://bugs.chromium.org/p/webrtc/issues/detail?id=6266
303 # for -Wno-sign-compare
304 "-Wno-sign-compare",
305 "-Wno-unused-function",
306 ]
kjellander82a94492016-06-12 22:12:01 -0700307 }
308 if (!is_win) {
309 cflags = [ "-Wno-sign-compare" ]
kjellander82a94492016-06-12 22:12:01 -0700310 }
311 }
312
ehmaldonado3a7f35b2016-09-14 05:10:01 -0700313 rtc_media_unittests_resources = [
314 "//resources/media/captured-320x240-2s-48.frames",
315 "//resources/media/faces.1280x720_P420.yuv",
316 "//resources/media/faces_I420.jpg",
317 "//resources/media/faces_I422.jpg",
318 "//resources/media/faces_I444.jpg",
319 "//resources/media/faces_I411.jpg",
320 "//resources/media/faces_I400.jpg",
321 ]
kjellander32c4a202016-08-30 02:53:49 -0700322
323 if (is_ios) {
324 bundle_data("rtc_media_unittests_bundle_data") {
325 testonly = true
326 sources = rtc_media_unittests_resources
327 outputs = [
328 "{{bundle_resources_dir}}/{{source_file_part}}",
329 ]
330 }
331 }
332
ehmaldonado38a21322016-09-02 04:10:34 -0700333 rtc_test("rtc_media_unittests") {
kjellander82a94492016-06-12 22:12:01 -0700334 testonly = true
335
johan073ece42016-08-26 02:59:47 -0700336 defines = []
kjellander82a94492016-06-12 22:12:01 -0700337 deps = []
338 sources = [
339 "base/codec_unittest.cc",
340 "base/rtpdataengine_unittest.cc",
341 "base/rtpdump_unittest.cc",
342 "base/rtputils_unittest.cc",
343 "base/streamparams_unittest.cc",
344 "base/turnutils_unittest.cc",
345 "base/videoadapter_unittest.cc",
346 "base/videobroadcaster_unittest.cc",
347 "base/videocapturer_unittest.cc",
348 "base/videocommon_unittest.cc",
349 "base/videoengine_unittest.h",
kjellander82a94492016-06-12 22:12:01 -0700350 "engine/nullwebrtcvideoengine_unittest.cc",
ossuc54071d2016-08-17 02:45:41 -0700351 "engine/payload_type_mapper_unittest.cc",
kjellander82a94492016-06-12 22:12:01 -0700352 "engine/simulcast_unittest.cc",
magjedf6acc2a2016-11-22 01:43:03 -0800353 "engine/videodecodersoftwarefallbackwrapper_unittest.cc",
magjed614d5b72016-11-15 06:30:54 -0800354 "engine/videoencodersoftwarefallbackwrapper_unittest.cc",
kjellander82a94492016-06-12 22:12:01 -0700355 "engine/webrtcmediaengine_unittest.cc",
356 "engine/webrtcvideocapturer_unittest.cc",
357 "engine/webrtcvideoengine2_unittest.cc",
kjellander82a94492016-06-12 22:12:01 -0700358 "engine/webrtcvoiceengine_unittest.cc",
359 "sctp/sctpdataengine_unittest.cc",
360 ]
361
ehmaldonado7a2ce0b2016-09-05 01:35:44 -0700362 configs += [ ":rtc_media_unittests_config" ]
kjellander82a94492016-06-12 22:12:01 -0700363
johan073ece42016-08-26 02:59:47 -0700364 if (rtc_use_h264) {
365 defines += [ "WEBRTC_USE_H264" ]
366 }
kjellander82a94492016-06-12 22:12:01 -0700367 if (is_win) {
368 cflags = [
369 "/wd4245", # conversion from int to size_t, signed/unsigned mismatch.
370 "/wd4373", # virtual function override.
371 "/wd4389", # signed/unsigned mismatch.
372 ]
373 }
374
kjellandere40a7ee2016-10-16 23:56:12 -0700375 if (!build_with_chromium && is_clang) {
ehmaldonado38a21322016-09-02 04:10:34 -0700376 suppressed_configs += [
kjellander82a94492016-06-12 22:12:01 -0700377 "//build/config/clang:extra_warnings",
kjellandere40a7ee2016-10-16 23:56:12 -0700378
379 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
kjellander82a94492016-06-12 22:12:01 -0700380 "//build/config/clang:find_bad_constructs",
381 ]
382 }
383
ehmaldonado3a7f35b2016-09-14 05:10:01 -0700384 data = rtc_media_unittests_resources
385
kjellander82a94492016-06-12 22:12:01 -0700386 if (is_android) {
387 deps += [ "//testing/android/native_test:native_test_support" ]
kjellander28a0ffd2016-08-24 07:48:42 -0700388 shard_timeout = 900
389 }
kjellander32c4a202016-08-30 02:53:49 -0700390
391 if (is_ios) {
392 deps += [ ":rtc_media_unittests_bundle_data" ]
kjellander82a94492016-06-12 22:12:01 -0700393 }
394
395 deps += [
396 # TODO(kjellander): Move as part of work in bugs.webrtc.org/4243.
397 ":rtc_media",
398 ":rtc_unittest_main",
399 "../audio",
400 "../base:rtc_base_tests_utils",
aleloi5de52fd2016-11-10 01:05:34 -0800401 "../modules/audio_device:mock_audio_device",
kjellander82a94492016-06-12 22:12:01 -0700402 "../system_wrappers:metrics_default",
403 ]
404 }
405}