blob: 5f9a0af4222aa2b6d46839a8ed840ee1d115f43b [file] [log] [blame]
kjellanderc76dc952016-06-03 10:09:321# 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")
kjellander82a94492016-06-13 05:12:0111import("//testing/test.gni")
kjellanderc76dc952016-06-03 10:09:3212
13group("media") {
14 deps = [
15 ":rtc_media",
16 ]
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" ]
32 cflags_cc = [ "-Wno-overloaded-virtual" ]
33 }
34}
35
36if (is_linux && rtc_use_gtk) {
37 pkg_config("gtk-lib") {
38 packages = [
39 "gobject-2.0",
40 "gthread-2.0",
41 "gtk+-2.0",
42 ]
43 }
44}
45
46source_set("rtc_media") {
47 defines = []
48 libs = []
49 deps = []
50 sources = [
51 "base/audiosource.h",
52 "base/codec.cc",
53 "base/codec.h",
54 "base/cpuid.cc",
55 "base/cpuid.h",
56 "base/cryptoparams.h",
57 "base/device.h",
58 "base/fakescreencapturerfactory.h",
59 "base/hybriddataengine.h",
60 "base/mediachannel.h",
61 "base/mediacommon.h",
62 "base/mediaconstants.cc",
63 "base/mediaconstants.h",
64 "base/mediaengine.cc",
65 "base/mediaengine.h",
66 "base/rtpdataengine.cc",
67 "base/rtpdataengine.h",
68 "base/rtpdump.cc",
69 "base/rtpdump.h",
70 "base/rtputils.cc",
71 "base/rtputils.h",
72 "base/screencastid.h",
73 "base/streamparams.cc",
74 "base/streamparams.h",
75 "base/turnutils.cc",
76 "base/turnutils.h",
77 "base/videoadapter.cc",
78 "base/videoadapter.h",
79 "base/videobroadcaster.cc",
80 "base/videobroadcaster.h",
81 "base/videocapturer.cc",
82 "base/videocapturer.h",
83 "base/videocapturerfactory.h",
84 "base/videocommon.cc",
85 "base/videocommon.h",
86 "base/videoframe.cc",
87 "base/videoframe.h",
88 "base/videoframefactory.cc",
89 "base/videoframefactory.h",
90 "base/videorenderer.h",
91 "base/videosourcebase.cc",
92 "base/videosourcebase.h",
kjellanderc76dc952016-06-03 10:09:3293 "devices/videorendererfactory.h",
94 "engine/nullwebrtcvideoengine.h",
ossu6f06cca2016-07-13 17:06:2295 "engine/payload_type_mapper.cc",
96 "engine/payload_type_mapper.h",
kjellanderc76dc952016-06-03 10:09:3297 "engine/simulcast.cc",
98 "engine/simulcast.h",
99 "engine/webrtccommon.h",
100 "engine/webrtcmediaengine.cc",
101 "engine/webrtcmediaengine.h",
102 "engine/webrtcvideocapturer.cc",
103 "engine/webrtcvideocapturer.h",
104 "engine/webrtcvideocapturerfactory.cc",
105 "engine/webrtcvideocapturerfactory.h",
106 "engine/webrtcvideodecoderfactory.h",
107 "engine/webrtcvideoencoderfactory.h",
108 "engine/webrtcvideoengine2.cc",
109 "engine/webrtcvideoengine2.h",
110 "engine/webrtcvideoframe.cc",
111 "engine/webrtcvideoframe.h",
112 "engine/webrtcvideoframefactory.cc",
113 "engine/webrtcvideoframefactory.h",
114 "engine/webrtcvoe.h",
115 "engine/webrtcvoiceengine.cc",
116 "engine/webrtcvoiceengine.h",
117 "sctp/sctpdataengine.cc",
118 "sctp/sctpdataengine.h",
119 ]
120
121 configs += [
122 "..:common_config",
123 ":rtc_media_warnings_config",
124 ]
125
126 public_configs = [ "..:common_inherited_config" ]
127
128 if (is_clang) {
kjellander82a94492016-06-13 05:12:01129 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
130 configs -= [
131 "//build/config/clang:extra_warnings",
132 "//build/config/clang:find_bad_constructs",
133 ]
kjellanderc76dc952016-06-03 10:09:32134 }
135
136 if (is_win) {
137 cflags = [
138 "/wd4245", # conversion from "int" to "size_t", signed/unsigned mismatch.
139 "/wd4267", # conversion from "size_t" to "int", possible loss of data.
140 "/wd4389", # signed/unsigned mismatch.
141 ]
142 }
143
peah1bcfce52016-08-26 14:16:04144 if (rtc_enable_intelligibility_enhancer) {
145 defines += [ "WEBRTC_INTELLIGIBILITY_ENHANCER=1" ]
146 } else {
147 defines += [ "WEBRTC_INTELLIGIBILITY_ENHANCER=0" ]
148 }
149
kjellanderec5c9062016-08-19 08:07:30150 include_dirs = []
kjellanderc76dc952016-06-03 10:09:32151 if (rtc_build_libyuv) {
152 deps += [ "$rtc_libyuv_dir" ]
153 public_deps = [
154 "$rtc_libyuv_dir",
155 ]
156 } else {
157 # Need to add a directory normally exported by libyuv.
158 include_dirs += [ "$rtc_libyuv_dir/include" ]
159 }
160
161 if (rtc_build_usrsctp) {
kjellanderec5c9062016-08-19 08:07:30162 include_dirs += [
kjellanderc76dc952016-06-03 10:09:32163 # TODO(jiayl): move this into the public_configs of
164 # //third_party/usrsctp/BUILD.gn.
165 "//third_party/usrsctp/usrsctplib",
166 ]
167 deps += [ "//third_party/usrsctp" ]
168 }
169
170 if (build_with_chromium) {
171 deps += [ "../modules/video_capture:video_capture" ]
172 } else {
kjellanderc76dc952016-06-03 10:09:32173 public_configs += [ ":rtc_media_defines_config" ]
174 deps += [ "../modules/video_capture:video_capture_internal_impl" ]
175 }
176 if (is_linux && rtc_use_gtk) {
177 sources += [
178 "devices/gtkvideorenderer.cc",
179 "devices/gtkvideorenderer.h",
180 ]
181 public_configs += [ ":gtk-lib" ]
182 }
183 if (is_win) {
184 sources += [
185 "devices/gdivideorenderer.cc",
186 "devices/gdivideorenderer.h",
187 ]
188 libs += [
189 "d3d9.lib",
190 "gdi32.lib",
191 "strmiids.lib",
192 ]
193 }
194 if (is_mac && current_cpu == "x86") {
195 sources += [
196 "devices/carbonvideorenderer.cc",
197 "devices/carbonvideorenderer.h",
198 ]
199 libs += [ "Carbon.framework" ]
200 }
201 if (is_ios || (is_mac && current_cpu != "x86")) {
202 defines += [ "CARBON_DEPRECATED=YES" ]
203 }
204
205 deps += [
206 "..:webrtc_common",
207 "../base:rtc_base_approved",
kjellander82a94492016-06-13 05:12:01208 "../call",
kjellanderc76dc952016-06-03 10:09:32209 "../libjingle/xmllite",
210 "../libjingle/xmpp",
kjellander82a94492016-06-13 05:12:01211 "../modules/video_coding",
kjellanderc76dc952016-06-03 10:09:32212 "../p2p",
213 "../system_wrappers",
kjellander82a94492016-06-13 05:12:01214 "../video",
kjellanderc76dc952016-06-03 10:09:32215 "../voice_engine",
216 ]
217}
kjellander82a94492016-06-13 05:12:01218
219if (rtc_include_tests) {
220 config("rtc_unittest_main_config") {
221 # GN orders flags on a target before flags from configs. The default config
222 # adds -Wall, and this flag have to be after -Wall -- so they need to
223 # come from a config and can"t be on the target directly.
224 if (is_clang && is_ios) {
225 cflags = [ "-Wno-unused-variable" ]
226 }
227 }
228
229 source_set("rtc_unittest_main") {
230 testonly = true
231
kjellanderec5c9062016-08-19 08:07:30232 include_dirs = []
233 public_deps = []
kjellander82a94492016-06-13 05:12:01234 deps = []
235 sources = [
236 "base/fakemediaengine.h",
237 "base/fakenetworkinterface.h",
238 "base/fakertp.h",
239 "base/fakevideocapturer.h",
240 "base/fakevideorenderer.h",
hbosb24b1ce2016-08-16 08:19:43241 "base/test/mock_mediachannel.h",
kjellander82a94492016-06-13 05:12:01242 "base/testutils.cc",
243 "base/testutils.h",
244 "engine/fakewebrtccall.cc",
245 "engine/fakewebrtccall.h",
246 "engine/fakewebrtccommon.h",
247 "engine/fakewebrtcdeviceinfo.h",
248 "engine/fakewebrtcvcmfactory.h",
249 "engine/fakewebrtcvideocapturemodule.h",
250 "engine/fakewebrtcvideoengine.h",
251 "engine/fakewebrtcvoiceengine.h",
252 ]
253
254 configs += [
255 "..:common_config",
256 ":rtc_unittest_main_config",
257 ]
258 public_configs = [ "..:common_inherited_config" ]
259
260 if (rtc_build_libyuv) {
261 deps += [ "$rtc_libyuv_dir" ]
kjellanderec5c9062016-08-19 08:07:30262 public_deps += [ "$rtc_libyuv_dir" ]
kjellander82a94492016-06-13 05:12:01263 } else {
264 # Need to add a directory normally exported by libyuv.
265 include_dirs += [ "$rtc_libyuv_dir/include" ]
266 }
267
268 if (is_clang) {
269 # Suppress warnings from the Chromium Clang plugin.
270 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
271 configs -= [ "//build/config/clang:find_bad_constructs" ]
272 }
273
274 deps += [
275 "../base:rtc_base_tests_utils",
276 "//testing/gtest",
277 ]
278 public_deps += [ "//testing/gmock" ]
279 }
280
281 config("rtc_media_unittests_config") {
282 # GN orders flags on a target before flags from configs. The default config
283 # adds -Wall, and this flag have to be after -Wall -- so they need to
284 # come from a config and can"t be on the target directly.
285 # TODO(kjellander): Make the code compile without disabling these flags.
286 # See https://bugs.webrtc.org/3307.
287 if (is_clang && is_win) {
ehmaldonado4bc4d272016-08-25 11:15:40288 cflags = [ "-Wno-unused-function" ]
kjellander82a94492016-06-13 05:12:01289 }
290 if (!is_win) {
291 cflags = [ "-Wno-sign-compare" ]
292 cflags_cc = [ "-Wno-overloaded-virtual" ]
293 }
294 }
295
296 test("rtc_media_unittests") {
297 testonly = true
298
johan073ece42016-08-26 09:59:47299 defines = []
kjellander82a94492016-06-13 05:12:01300 deps = []
301 sources = [
302 "base/codec_unittest.cc",
303 "base/rtpdataengine_unittest.cc",
304 "base/rtpdump_unittest.cc",
305 "base/rtputils_unittest.cc",
306 "base/streamparams_unittest.cc",
307 "base/turnutils_unittest.cc",
308 "base/videoadapter_unittest.cc",
309 "base/videobroadcaster_unittest.cc",
310 "base/videocapturer_unittest.cc",
311 "base/videocommon_unittest.cc",
312 "base/videoengine_unittest.h",
313 "base/videoframe_unittest.h",
314 "engine/nullwebrtcvideoengine_unittest.cc",
ossuc54071d2016-08-17 09:45:41315 "engine/payload_type_mapper_unittest.cc",
kjellander82a94492016-06-13 05:12:01316 "engine/simulcast_unittest.cc",
317 "engine/webrtcmediaengine_unittest.cc",
318 "engine/webrtcvideocapturer_unittest.cc",
319 "engine/webrtcvideoengine2_unittest.cc",
320 "engine/webrtcvideoframe_unittest.cc",
321 "engine/webrtcvideoframefactory_unittest.cc",
322 "engine/webrtcvoiceengine_unittest.cc",
323 "sctp/sctpdataengine_unittest.cc",
324 ]
325
326 configs += [
327 "..:common_config",
328 ":rtc_media_unittests_config",
329 ]
330 public_configs = [ "..:common_inherited_config" ]
331
johan073ece42016-08-26 09:59:47332 if (rtc_use_h264) {
333 defines += [ "WEBRTC_USE_H264" ]
334 }
kjellander82a94492016-06-13 05:12:01335 if (is_win) {
336 cflags = [
337 "/wd4245", # conversion from int to size_t, signed/unsigned mismatch.
338 "/wd4373", # virtual function override.
339 "/wd4389", # signed/unsigned mismatch.
340 ]
341 }
342
343 if (is_clang) {
344 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
345 configs -= [
346 "//build/config/clang:extra_warnings",
347 "//build/config/clang:find_bad_constructs",
348 ]
349 }
350
351 if (is_android) {
352 deps += [ "//testing/android/native_test:native_test_support" ]
kjellander28a0ffd2016-08-24 14:48:42353 shard_timeout = 900
354 }
355 if (is_android || is_ios) {
kjellander82a94492016-06-13 05:12:01356 data = [
357 "//resources/media/captured-320x240-2s-48.frames",
358 "//resources/media/faces.1280x720_P420.yuv",
359 "//resources/media/faces_I420.jpg",
360 "//resources/media/faces_I422.jpg",
361 "//resources/media/faces_I444.jpg",
362 "//resources/media/faces_I411.jpg",
363 "//resources/media/faces_I400.jpg",
364 ]
365 }
366
367 deps += [
368 # TODO(kjellander): Move as part of work in bugs.webrtc.org/4243.
369 ":rtc_media",
370 ":rtc_unittest_main",
371 "../audio",
372 "../base:rtc_base_tests_utils",
373 "../system_wrappers:metrics_default",
374 ]
375 }
376}