blob: 029d143163858194238dca8404ee055506a1811f [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") {
13 deps = [
14 ":rtc_media",
15 ]
16}
17
18config("rtc_media_defines_config") {
19 defines = [
20 "HAVE_WEBRTC_VIDEO",
21 "HAVE_WEBRTC_VOICE",
22 ]
23}
24
25config("rtc_media_warnings_config") {
26 # GN orders flags on a target before flags from configs. The default config
27 # adds these flags so to cancel them out they need to come from a config and
28 # cannot be on the target directly.
29 if (!is_win) {
30 cflags = [ "-Wno-deprecated-declarations" ]
31 cflags_cc = [ "-Wno-overloaded-virtual" ]
32 }
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
ehmaldonado38a21322016-09-02 04:10:34 -070045rtc_source_set("rtc_media") {
kjellanderc76dc952016-06-03 03:09:32 -070046 defines = []
47 libs = []
48 deps = []
49 sources = [
50 "base/audiosource.h",
51 "base/codec.cc",
52 "base/codec.h",
53 "base/cpuid.cc",
54 "base/cpuid.h",
55 "base/cryptoparams.h",
56 "base/device.h",
57 "base/fakescreencapturerfactory.h",
58 "base/hybriddataengine.h",
59 "base/mediachannel.h",
60 "base/mediacommon.h",
61 "base/mediaconstants.cc",
62 "base/mediaconstants.h",
63 "base/mediaengine.cc",
64 "base/mediaengine.h",
65 "base/rtpdataengine.cc",
66 "base/rtpdataengine.h",
67 "base/rtpdump.cc",
68 "base/rtpdump.h",
69 "base/rtputils.cc",
70 "base/rtputils.h",
71 "base/screencastid.h",
72 "base/streamparams.cc",
73 "base/streamparams.h",
74 "base/turnutils.cc",
75 "base/turnutils.h",
76 "base/videoadapter.cc",
77 "base/videoadapter.h",
78 "base/videobroadcaster.cc",
79 "base/videobroadcaster.h",
80 "base/videocapturer.cc",
81 "base/videocapturer.h",
82 "base/videocapturerfactory.h",
83 "base/videocommon.cc",
84 "base/videocommon.h",
85 "base/videoframe.cc",
86 "base/videoframe.h",
87 "base/videoframefactory.cc",
88 "base/videoframefactory.h",
89 "base/videorenderer.h",
90 "base/videosourcebase.cc",
91 "base/videosourcebase.h",
kjellanderc76dc952016-06-03 03:09:32 -070092 "devices/videorendererfactory.h",
93 "engine/nullwebrtcvideoengine.h",
ossu6f06cca2016-07-13 10:06:22 -070094 "engine/payload_type_mapper.cc",
95 "engine/payload_type_mapper.h",
kjellanderc76dc952016-06-03 03:09:32 -070096 "engine/simulcast.cc",
97 "engine/simulcast.h",
98 "engine/webrtccommon.h",
99 "engine/webrtcmediaengine.cc",
100 "engine/webrtcmediaengine.h",
101 "engine/webrtcvideocapturer.cc",
102 "engine/webrtcvideocapturer.h",
103 "engine/webrtcvideocapturerfactory.cc",
104 "engine/webrtcvideocapturerfactory.h",
105 "engine/webrtcvideodecoderfactory.h",
106 "engine/webrtcvideoencoderfactory.h",
107 "engine/webrtcvideoengine2.cc",
108 "engine/webrtcvideoengine2.h",
109 "engine/webrtcvideoframe.cc",
110 "engine/webrtcvideoframe.h",
111 "engine/webrtcvideoframefactory.cc",
112 "engine/webrtcvideoframefactory.h",
113 "engine/webrtcvoe.h",
114 "engine/webrtcvoiceengine.cc",
115 "engine/webrtcvoiceengine.h",
116 "sctp/sctpdataengine.cc",
117 "sctp/sctpdataengine.h",
118 ]
119
ehmaldonado7a2ce0b2016-09-05 01:35:44 -0700120 configs += [ ":rtc_media_warnings_config" ]
kjellanderc76dc952016-06-03 03:09:32 -0700121
kjellanderc76dc952016-06-03 03:09:32 -0700122 if (is_clang) {
kjellander82a94492016-06-12 22:12:01 -0700123 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
ehmaldonado38a21322016-09-02 04:10:34 -0700124 suppressed_configs += [
kjellander82a94492016-06-12 22:12:01 -0700125 "//build/config/clang:extra_warnings",
126 "//build/config/clang:find_bad_constructs",
127 ]
kjellanderc76dc952016-06-03 03:09:32 -0700128 }
129
130 if (is_win) {
131 cflags = [
132 "/wd4245", # conversion from "int" to "size_t", signed/unsigned mismatch.
133 "/wd4267", # conversion from "size_t" to "int", possible loss of data.
134 "/wd4389", # signed/unsigned mismatch.
135 ]
136 }
137
peah1bcfce52016-08-26 07:16:04 -0700138 if (rtc_enable_intelligibility_enhancer) {
139 defines += [ "WEBRTC_INTELLIGIBILITY_ENHANCER=1" ]
140 } else {
141 defines += [ "WEBRTC_INTELLIGIBILITY_ENHANCER=0" ]
142 }
143
kjellanderec5c9062016-08-19 01:07:30 -0700144 include_dirs = []
kjellanderc76dc952016-06-03 03:09:32 -0700145 if (rtc_build_libyuv) {
146 deps += [ "$rtc_libyuv_dir" ]
147 public_deps = [
148 "$rtc_libyuv_dir",
149 ]
150 } else {
151 # Need to add a directory normally exported by libyuv.
152 include_dirs += [ "$rtc_libyuv_dir/include" ]
153 }
154
155 if (rtc_build_usrsctp) {
kjellanderec5c9062016-08-19 01:07:30 -0700156 include_dirs += [
kjellanderc76dc952016-06-03 03:09:32 -0700157 # TODO(jiayl): move this into the public_configs of
158 # //third_party/usrsctp/BUILD.gn.
159 "//third_party/usrsctp/usrsctplib",
160 ]
161 deps += [ "//third_party/usrsctp" ]
162 }
163
ehmaldonadoe9cc6862016-09-05 06:10:18 -0700164 public_configs = []
kjellanderc76dc952016-06-03 03:09:32 -0700165 if (build_with_chromium) {
166 deps += [ "../modules/video_capture:video_capture" ]
167 } else {
kjellanderc76dc952016-06-03 03:09:32 -0700168 public_configs += [ ":rtc_media_defines_config" ]
169 deps += [ "../modules/video_capture:video_capture_internal_impl" ]
170 }
171 if (is_linux && rtc_use_gtk) {
172 sources += [
173 "devices/gtkvideorenderer.cc",
174 "devices/gtkvideorenderer.h",
175 ]
176 public_configs += [ ":gtk-lib" ]
177 }
178 if (is_win) {
179 sources += [
180 "devices/gdivideorenderer.cc",
181 "devices/gdivideorenderer.h",
182 ]
183 libs += [
184 "d3d9.lib",
185 "gdi32.lib",
186 "strmiids.lib",
187 ]
188 }
189 if (is_mac && current_cpu == "x86") {
190 sources += [
191 "devices/carbonvideorenderer.cc",
192 "devices/carbonvideorenderer.h",
193 ]
194 libs += [ "Carbon.framework" ]
195 }
196 if (is_ios || (is_mac && current_cpu != "x86")) {
197 defines += [ "CARBON_DEPRECATED=YES" ]
198 }
199
200 deps += [
201 "..:webrtc_common",
kjellandera69d9732016-08-31 07:33:05 -0700202 "../api:call_api",
kjellanderc76dc952016-06-03 03:09:32 -0700203 "../base:rtc_base_approved",
kjellander82a94492016-06-12 22:12:01 -0700204 "../call",
kjellanderc76dc952016-06-03 03:09:32 -0700205 "../libjingle/xmllite",
206 "../libjingle/xmpp",
kjellander82a94492016-06-12 22:12:01 -0700207 "../modules/video_coding",
kjellanderc76dc952016-06-03 03:09:32 -0700208 "../p2p",
209 "../system_wrappers",
kjellander82a94492016-06-12 22:12:01 -0700210 "../video",
kjellanderc76dc952016-06-03 03:09:32 -0700211 "../voice_engine",
212 ]
213}
kjellander82a94492016-06-12 22:12:01 -0700214
215if (rtc_include_tests) {
216 config("rtc_unittest_main_config") {
217 # GN orders flags on a target before flags from configs. The default config
218 # adds -Wall, and this flag have to be after -Wall -- so they need to
219 # come from a config and can"t be on the target directly.
220 if (is_clang && is_ios) {
221 cflags = [ "-Wno-unused-variable" ]
222 }
223 }
224
ehmaldonado38a21322016-09-02 04:10:34 -0700225 rtc_source_set("rtc_unittest_main") {
kjellander82a94492016-06-12 22:12:01 -0700226 testonly = true
227
kjellanderec5c9062016-08-19 01:07:30 -0700228 include_dirs = []
229 public_deps = []
kjellander82a94492016-06-12 22:12:01 -0700230 deps = []
231 sources = [
232 "base/fakemediaengine.h",
233 "base/fakenetworkinterface.h",
234 "base/fakertp.h",
235 "base/fakevideocapturer.h",
236 "base/fakevideorenderer.h",
hbosb24b1ce2016-08-16 01:19:43 -0700237 "base/test/mock_mediachannel.h",
kjellander82a94492016-06-12 22:12:01 -0700238 "base/testutils.cc",
239 "base/testutils.h",
240 "engine/fakewebrtccall.cc",
241 "engine/fakewebrtccall.h",
kjellander82a94492016-06-12 22:12:01 -0700242 "engine/fakewebrtcdeviceinfo.h",
243 "engine/fakewebrtcvcmfactory.h",
244 "engine/fakewebrtcvideocapturemodule.h",
245 "engine/fakewebrtcvideoengine.h",
246 "engine/fakewebrtcvoiceengine.h",
247 ]
248
ehmaldonado7a2ce0b2016-09-05 01:35:44 -0700249 configs += [ ":rtc_unittest_main_config" ]
kjellander82a94492016-06-12 22:12:01 -0700250
251 if (rtc_build_libyuv) {
252 deps += [ "$rtc_libyuv_dir" ]
kjellanderec5c9062016-08-19 01:07:30 -0700253 public_deps += [ "$rtc_libyuv_dir" ]
kjellander82a94492016-06-12 22:12:01 -0700254 } else {
255 # Need to add a directory normally exported by libyuv.
256 include_dirs += [ "$rtc_libyuv_dir/include" ]
257 }
258
259 if (is_clang) {
260 # Suppress warnings from the Chromium Clang plugin.
261 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
ehmaldonado38a21322016-09-02 04:10:34 -0700262 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellander82a94492016-06-12 22:12:01 -0700263 }
264
265 deps += [
266 "../base:rtc_base_tests_utils",
267 "//testing/gtest",
268 ]
269 public_deps += [ "//testing/gmock" ]
270 }
271
272 config("rtc_media_unittests_config") {
273 # GN orders flags on a target before flags from configs. The default config
274 # adds -Wall, and this flag have to be after -Wall -- so they need to
275 # come from a config and can"t be on the target directly.
276 # TODO(kjellander): Make the code compile without disabling these flags.
277 # See https://bugs.webrtc.org/3307.
278 if (is_clang && is_win) {
ehmaldonadod02fe4b2016-08-26 13:31:24 -0700279 cflags = [
280 # See https://bugs.chromium.org/p/webrtc/issues/detail?id=6266
281 # for -Wno-sign-compare
282 "-Wno-sign-compare",
283 "-Wno-unused-function",
284 ]
kjellander82a94492016-06-12 22:12:01 -0700285 }
286 if (!is_win) {
287 cflags = [ "-Wno-sign-compare" ]
288 cflags_cc = [ "-Wno-overloaded-virtual" ]
289 }
290 }
291
kjellander32c4a202016-08-30 02:53:49 -0700292 if (is_android || is_ios) {
293 rtc_media_unittests_resources = [
294 "//resources/media/captured-320x240-2s-48.frames",
295 "//resources/media/faces.1280x720_P420.yuv",
296 "//resources/media/faces_I420.jpg",
297 "//resources/media/faces_I422.jpg",
298 "//resources/media/faces_I444.jpg",
299 "//resources/media/faces_I411.jpg",
300 "//resources/media/faces_I400.jpg",
301 ]
302 }
303
304 if (is_ios) {
305 bundle_data("rtc_media_unittests_bundle_data") {
306 testonly = true
307 sources = rtc_media_unittests_resources
308 outputs = [
309 "{{bundle_resources_dir}}/{{source_file_part}}",
310 ]
311 }
312 }
313
ehmaldonado38a21322016-09-02 04:10:34 -0700314 rtc_test("rtc_media_unittests") {
kjellander82a94492016-06-12 22:12:01 -0700315 testonly = true
316
johan073ece42016-08-26 02:59:47 -0700317 defines = []
kjellander82a94492016-06-12 22:12:01 -0700318 deps = []
319 sources = [
320 "base/codec_unittest.cc",
321 "base/rtpdataengine_unittest.cc",
322 "base/rtpdump_unittest.cc",
323 "base/rtputils_unittest.cc",
324 "base/streamparams_unittest.cc",
325 "base/turnutils_unittest.cc",
326 "base/videoadapter_unittest.cc",
327 "base/videobroadcaster_unittest.cc",
328 "base/videocapturer_unittest.cc",
329 "base/videocommon_unittest.cc",
330 "base/videoengine_unittest.h",
331 "base/videoframe_unittest.h",
332 "engine/nullwebrtcvideoengine_unittest.cc",
ossuc54071d2016-08-17 02:45:41 -0700333 "engine/payload_type_mapper_unittest.cc",
kjellander82a94492016-06-12 22:12:01 -0700334 "engine/simulcast_unittest.cc",
335 "engine/webrtcmediaengine_unittest.cc",
336 "engine/webrtcvideocapturer_unittest.cc",
337 "engine/webrtcvideoengine2_unittest.cc",
338 "engine/webrtcvideoframe_unittest.cc",
339 "engine/webrtcvideoframefactory_unittest.cc",
340 "engine/webrtcvoiceengine_unittest.cc",
341 "sctp/sctpdataengine_unittest.cc",
342 ]
343
ehmaldonado7a2ce0b2016-09-05 01:35:44 -0700344 configs += [ ":rtc_media_unittests_config" ]
kjellander82a94492016-06-12 22:12:01 -0700345
johan073ece42016-08-26 02:59:47 -0700346 if (rtc_use_h264) {
347 defines += [ "WEBRTC_USE_H264" ]
348 }
kjellander82a94492016-06-12 22:12:01 -0700349 if (is_win) {
350 cflags = [
351 "/wd4245", # conversion from int to size_t, signed/unsigned mismatch.
352 "/wd4373", # virtual function override.
353 "/wd4389", # signed/unsigned mismatch.
354 ]
355 }
356
357 if (is_clang) {
358 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
ehmaldonado38a21322016-09-02 04:10:34 -0700359 suppressed_configs += [
kjellander82a94492016-06-12 22:12:01 -0700360 "//build/config/clang:extra_warnings",
361 "//build/config/clang:find_bad_constructs",
362 ]
363 }
364
365 if (is_android) {
366 deps += [ "//testing/android/native_test:native_test_support" ]
kjellander32c4a202016-08-30 02:53:49 -0700367 data = rtc_media_unittests_resources
kjellander28a0ffd2016-08-24 07:48:42 -0700368 shard_timeout = 900
369 }
kjellander32c4a202016-08-30 02:53:49 -0700370
371 if (is_ios) {
372 deps += [ ":rtc_media_unittests_bundle_data" ]
kjellander82a94492016-06-12 22:12:01 -0700373 }
374
375 deps += [
376 # TODO(kjellander): Move as part of work in bugs.webrtc.org/4243.
377 ":rtc_media",
378 ":rtc_unittest_main",
379 "../audio",
380 "../base:rtc_base_tests_utils",
381 "../system_wrappers:metrics_default",
382 ]
383 }
384}