blob: e2d9217ba8a7978c3271a89c0dd3f9e36c291a0d [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")
kjellander82a94492016-06-12 22:12:01 -070011import("//testing/test.gni")
kjellanderc76dc952016-06-03 03:09:32 -070012
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 03:09:32 -070093 "devices/videorendererfactory.h",
94 "engine/nullwebrtcvideoengine.h",
ossu6f06cca2016-07-13 10:06:22 -070095 "engine/payload_type_mapper.cc",
96 "engine/payload_type_mapper.h",
kjellanderc76dc952016-06-03 03:09:32 -070097 "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-12 22:12:01 -0700129 # 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 03:09:32 -0700134 }
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
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
164 if (build_with_chromium) {
165 deps += [ "../modules/video_capture:video_capture" ]
166 } else {
kjellanderc76dc952016-06-03 03:09:32 -0700167 public_configs += [ ":rtc_media_defines_config" ]
168 deps += [ "../modules/video_capture:video_capture_internal_impl" ]
169 }
170 if (is_linux && rtc_use_gtk) {
171 sources += [
172 "devices/gtkvideorenderer.cc",
173 "devices/gtkvideorenderer.h",
174 ]
175 public_configs += [ ":gtk-lib" ]
176 }
177 if (is_win) {
178 sources += [
179 "devices/gdivideorenderer.cc",
180 "devices/gdivideorenderer.h",
181 ]
182 libs += [
183 "d3d9.lib",
184 "gdi32.lib",
185 "strmiids.lib",
186 ]
187 }
188 if (is_mac && current_cpu == "x86") {
189 sources += [
190 "devices/carbonvideorenderer.cc",
191 "devices/carbonvideorenderer.h",
192 ]
193 libs += [ "Carbon.framework" ]
194 }
195 if (is_ios || (is_mac && current_cpu != "x86")) {
196 defines += [ "CARBON_DEPRECATED=YES" ]
197 }
198
199 deps += [
200 "..:webrtc_common",
201 "../base:rtc_base_approved",
kjellander82a94492016-06-12 22:12:01 -0700202 "../call",
kjellanderc76dc952016-06-03 03:09:32 -0700203 "../libjingle/xmllite",
204 "../libjingle/xmpp",
kjellander82a94492016-06-12 22:12:01 -0700205 "../modules/video_coding",
kjellanderc76dc952016-06-03 03:09:32 -0700206 "../p2p",
207 "../system_wrappers",
kjellander82a94492016-06-12 22:12:01 -0700208 "../video",
kjellanderc76dc952016-06-03 03:09:32 -0700209 "../voice_engine",
210 ]
211}
kjellander82a94492016-06-12 22:12:01 -0700212
213if (rtc_include_tests) {
214 config("rtc_unittest_main_config") {
215 # GN orders flags on a target before flags from configs. The default config
216 # adds -Wall, and this flag have to be after -Wall -- so they need to
217 # come from a config and can"t be on the target directly.
218 if (is_clang && is_ios) {
219 cflags = [ "-Wno-unused-variable" ]
220 }
221 }
222
223 source_set("rtc_unittest_main") {
224 testonly = true
225
kjellanderec5c9062016-08-19 01:07:30 -0700226 include_dirs = []
227 public_deps = []
kjellander82a94492016-06-12 22:12:01 -0700228 deps = []
229 sources = [
230 "base/fakemediaengine.h",
231 "base/fakenetworkinterface.h",
232 "base/fakertp.h",
233 "base/fakevideocapturer.h",
234 "base/fakevideorenderer.h",
hbosb24b1ce2016-08-16 01:19:43 -0700235 "base/test/mock_mediachannel.h",
kjellander82a94492016-06-12 22:12:01 -0700236 "base/testutils.cc",
237 "base/testutils.h",
238 "engine/fakewebrtccall.cc",
239 "engine/fakewebrtccall.h",
240 "engine/fakewebrtccommon.h",
241 "engine/fakewebrtcdeviceinfo.h",
242 "engine/fakewebrtcvcmfactory.h",
243 "engine/fakewebrtcvideocapturemodule.h",
244 "engine/fakewebrtcvideoengine.h",
245 "engine/fakewebrtcvoiceengine.h",
246 ]
247
248 configs += [
249 "..:common_config",
250 ":rtc_unittest_main_config",
251 ]
252 public_configs = [ "..:common_inherited_config" ]
253
254 if (rtc_build_libyuv) {
255 deps += [ "$rtc_libyuv_dir" ]
kjellanderec5c9062016-08-19 01:07:30 -0700256 public_deps += [ "$rtc_libyuv_dir" ]
kjellander82a94492016-06-12 22:12:01 -0700257 } else {
258 # Need to add a directory normally exported by libyuv.
259 include_dirs += [ "$rtc_libyuv_dir/include" ]
260 }
261
262 if (is_clang) {
263 # Suppress warnings from the Chromium Clang plugin.
264 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
265 configs -= [ "//build/config/clang:find_bad_constructs" ]
266 }
267
268 deps += [
269 "../base:rtc_base_tests_utils",
270 "//testing/gtest",
271 ]
272 public_deps += [ "//testing/gmock" ]
273 }
274
275 config("rtc_media_unittests_config") {
276 # GN orders flags on a target before flags from configs. The default config
277 # adds -Wall, and this flag have to be after -Wall -- so they need to
278 # come from a config and can"t be on the target directly.
279 # TODO(kjellander): Make the code compile without disabling these flags.
280 # See https://bugs.webrtc.org/3307.
281 if (is_clang && is_win) {
ehmaldonado4bc4d272016-08-25 04:15:40 -0700282 cflags = [ "-Wno-unused-function" ]
kjellander82a94492016-06-12 22:12:01 -0700283 }
284 if (!is_win) {
285 cflags = [ "-Wno-sign-compare" ]
286 cflags_cc = [ "-Wno-overloaded-virtual" ]
287 }
288 }
289
290 test("rtc_media_unittests") {
291 testonly = true
292
johan073ece42016-08-26 02:59:47 -0700293 defines = []
kjellander82a94492016-06-12 22:12:01 -0700294 deps = []
295 sources = [
296 "base/codec_unittest.cc",
297 "base/rtpdataengine_unittest.cc",
298 "base/rtpdump_unittest.cc",
299 "base/rtputils_unittest.cc",
300 "base/streamparams_unittest.cc",
301 "base/turnutils_unittest.cc",
302 "base/videoadapter_unittest.cc",
303 "base/videobroadcaster_unittest.cc",
304 "base/videocapturer_unittest.cc",
305 "base/videocommon_unittest.cc",
306 "base/videoengine_unittest.h",
307 "base/videoframe_unittest.h",
308 "engine/nullwebrtcvideoengine_unittest.cc",
ossuc54071d2016-08-17 02:45:41 -0700309 "engine/payload_type_mapper_unittest.cc",
kjellander82a94492016-06-12 22:12:01 -0700310 "engine/simulcast_unittest.cc",
311 "engine/webrtcmediaengine_unittest.cc",
312 "engine/webrtcvideocapturer_unittest.cc",
313 "engine/webrtcvideoengine2_unittest.cc",
314 "engine/webrtcvideoframe_unittest.cc",
315 "engine/webrtcvideoframefactory_unittest.cc",
316 "engine/webrtcvoiceengine_unittest.cc",
317 "sctp/sctpdataengine_unittest.cc",
318 ]
319
320 configs += [
321 "..:common_config",
322 ":rtc_media_unittests_config",
323 ]
324 public_configs = [ "..:common_inherited_config" ]
325
johan073ece42016-08-26 02:59:47 -0700326 if (rtc_use_h264) {
327 defines += [ "WEBRTC_USE_H264" ]
328 }
kjellander82a94492016-06-12 22:12:01 -0700329 if (is_win) {
330 cflags = [
331 "/wd4245", # conversion from int to size_t, signed/unsigned mismatch.
332 "/wd4373", # virtual function override.
333 "/wd4389", # signed/unsigned mismatch.
334 ]
335 }
336
337 if (is_clang) {
338 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
339 configs -= [
340 "//build/config/clang:extra_warnings",
341 "//build/config/clang:find_bad_constructs",
342 ]
343 }
344
345 if (is_android) {
346 deps += [ "//testing/android/native_test:native_test_support" ]
kjellander28a0ffd2016-08-24 07:48:42 -0700347 shard_timeout = 900
348 }
349 if (is_android || is_ios) {
kjellander82a94492016-06-12 22:12:01 -0700350 data = [
351 "//resources/media/captured-320x240-2s-48.frames",
352 "//resources/media/faces.1280x720_P420.yuv",
353 "//resources/media/faces_I420.jpg",
354 "//resources/media/faces_I422.jpg",
355 "//resources/media/faces_I444.jpg",
356 "//resources/media/faces_I411.jpg",
357 "//resources/media/faces_I400.jpg",
358 ]
359 }
360
361 deps += [
362 # TODO(kjellander): Move as part of work in bugs.webrtc.org/4243.
363 ":rtc_media",
364 ":rtc_unittest_main",
365 "../audio",
366 "../base:rtc_base_tests_utils",
367 "../system_wrappers:metrics_default",
368 ]
369 }
370}