blob: a00fe6fe356c8416897735ed9dd9509ae2d17c95 [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
144 if (rtc_build_libyuv) {
145 deps += [ "$rtc_libyuv_dir" ]
146 public_deps = [
147 "$rtc_libyuv_dir",
148 ]
149 } else {
150 # Need to add a directory normally exported by libyuv.
151 include_dirs += [ "$rtc_libyuv_dir/include" ]
152 }
153
154 if (rtc_build_usrsctp) {
155 include_dirs = [
156 # TODO(jiayl): move this into the public_configs of
157 # //third_party/usrsctp/BUILD.gn.
158 "//third_party/usrsctp/usrsctplib",
159 ]
160 deps += [ "//third_party/usrsctp" ]
161 }
162
163 if (build_with_chromium) {
164 deps += [ "../modules/video_capture:video_capture" ]
165 } else {
kjellanderc76dc952016-06-03 03:09:32 -0700166 public_configs += [ ":rtc_media_defines_config" ]
167 deps += [ "../modules/video_capture:video_capture_internal_impl" ]
168 }
169 if (is_linux && rtc_use_gtk) {
170 sources += [
171 "devices/gtkvideorenderer.cc",
172 "devices/gtkvideorenderer.h",
173 ]
174 public_configs += [ ":gtk-lib" ]
175 }
176 if (is_win) {
177 sources += [
178 "devices/gdivideorenderer.cc",
179 "devices/gdivideorenderer.h",
180 ]
181 libs += [
182 "d3d9.lib",
183 "gdi32.lib",
184 "strmiids.lib",
185 ]
186 }
187 if (is_mac && current_cpu == "x86") {
188 sources += [
189 "devices/carbonvideorenderer.cc",
190 "devices/carbonvideorenderer.h",
191 ]
192 libs += [ "Carbon.framework" ]
193 }
194 if (is_ios || (is_mac && current_cpu != "x86")) {
195 defines += [ "CARBON_DEPRECATED=YES" ]
196 }
197
198 deps += [
199 "..:webrtc_common",
200 "../base:rtc_base_approved",
kjellander82a94492016-06-12 22:12:01 -0700201 "../call",
kjellanderc76dc952016-06-03 03:09:32 -0700202 "../libjingle/xmllite",
203 "../libjingle/xmpp",
kjellander82a94492016-06-12 22:12:01 -0700204 "../modules/video_coding",
kjellanderc76dc952016-06-03 03:09:32 -0700205 "../p2p",
206 "../system_wrappers",
kjellander82a94492016-06-12 22:12:01 -0700207 "../video",
kjellanderc76dc952016-06-03 03:09:32 -0700208 "../voice_engine",
209 ]
210}
kjellander82a94492016-06-12 22:12:01 -0700211
212if (rtc_include_tests) {
213 config("rtc_unittest_main_config") {
214 # GN orders flags on a target before flags from configs. The default config
215 # adds -Wall, and this flag have to be after -Wall -- so they need to
216 # come from a config and can"t be on the target directly.
217 if (is_clang && is_ios) {
218 cflags = [ "-Wno-unused-variable" ]
219 }
220 }
221
222 source_set("rtc_unittest_main") {
223 testonly = true
224
225 deps = []
226 sources = [
227 "base/fakemediaengine.h",
228 "base/fakenetworkinterface.h",
229 "base/fakertp.h",
230 "base/fakevideocapturer.h",
231 "base/fakevideorenderer.h",
hbosb24b1ce2016-08-16 01:19:43 -0700232 "base/test/mock_mediachannel.h",
kjellander82a94492016-06-12 22:12:01 -0700233 "base/testutils.cc",
234 "base/testutils.h",
235 "engine/fakewebrtccall.cc",
236 "engine/fakewebrtccall.h",
237 "engine/fakewebrtccommon.h",
238 "engine/fakewebrtcdeviceinfo.h",
239 "engine/fakewebrtcvcmfactory.h",
240 "engine/fakewebrtcvideocapturemodule.h",
241 "engine/fakewebrtcvideoengine.h",
242 "engine/fakewebrtcvoiceengine.h",
243 ]
244
245 configs += [
246 "..:common_config",
247 ":rtc_unittest_main_config",
248 ]
249 public_configs = [ "..:common_inherited_config" ]
250
251 if (rtc_build_libyuv) {
252 deps += [ "$rtc_libyuv_dir" ]
253 public_deps = [
254 "$rtc_libyuv_dir",
255 ]
256 } else {
257 # Need to add a directory normally exported by libyuv.
258 include_dirs += [ "$rtc_libyuv_dir/include" ]
259 }
260
261 if (is_clang) {
262 # Suppress warnings from the Chromium Clang plugin.
263 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
264 configs -= [ "//build/config/clang:find_bad_constructs" ]
265 }
266
267 deps += [
268 "../base:rtc_base_tests_utils",
269 "//testing/gtest",
270 ]
271 public_deps += [ "//testing/gmock" ]
272 }
273
274 config("rtc_media_unittests_config") {
275 # GN orders flags on a target before flags from configs. The default config
276 # adds -Wall, and this flag have to be after -Wall -- so they need to
277 # come from a config and can"t be on the target directly.
278 # TODO(kjellander): Make the code compile without disabling these flags.
279 # See https://bugs.webrtc.org/3307.
280 if (is_clang && is_win) {
281 cflags += [ "-Wno-unused-function" ]
282 }
283 if (!is_win) {
284 cflags = [ "-Wno-sign-compare" ]
285 cflags_cc = [ "-Wno-overloaded-virtual" ]
286 }
287 }
288
289 test("rtc_media_unittests") {
290 testonly = true
291
292 deps = []
293 sources = [
294 "base/codec_unittest.cc",
295 "base/rtpdataengine_unittest.cc",
296 "base/rtpdump_unittest.cc",
297 "base/rtputils_unittest.cc",
298 "base/streamparams_unittest.cc",
299 "base/turnutils_unittest.cc",
300 "base/videoadapter_unittest.cc",
301 "base/videobroadcaster_unittest.cc",
302 "base/videocapturer_unittest.cc",
303 "base/videocommon_unittest.cc",
304 "base/videoengine_unittest.h",
305 "base/videoframe_unittest.h",
306 "engine/nullwebrtcvideoengine_unittest.cc",
307 "engine/simulcast_unittest.cc",
308 "engine/webrtcmediaengine_unittest.cc",
309 "engine/webrtcvideocapturer_unittest.cc",
310 "engine/webrtcvideoengine2_unittest.cc",
311 "engine/webrtcvideoframe_unittest.cc",
312 "engine/webrtcvideoframefactory_unittest.cc",
313 "engine/webrtcvoiceengine_unittest.cc",
314 "sctp/sctpdataengine_unittest.cc",
315 ]
316
317 configs += [
318 "..:common_config",
319 ":rtc_media_unittests_config",
320 ]
321 public_configs = [ "..:common_inherited_config" ]
322
323 if (is_win) {
324 cflags = [
325 "/wd4245", # conversion from int to size_t, signed/unsigned mismatch.
326 "/wd4373", # virtual function override.
327 "/wd4389", # signed/unsigned mismatch.
328 ]
329 }
330
331 if (is_clang) {
332 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
333 configs -= [
334 "//build/config/clang:extra_warnings",
335 "//build/config/clang:find_bad_constructs",
336 ]
337 }
338
339 if (is_android) {
340 deps += [ "//testing/android/native_test:native_test_support" ]
341
342 # This needs to be kept in sync with the rtc_media_unittests.isolate file.
343 # TODO(kjellander); Move this to android_assets targets instead.
344 data = [
345 "//resources/media/captured-320x240-2s-48.frames",
346 "//resources/media/faces.1280x720_P420.yuv",
347 "//resources/media/faces_I420.jpg",
348 "//resources/media/faces_I422.jpg",
349 "//resources/media/faces_I444.jpg",
350 "//resources/media/faces_I411.jpg",
351 "//resources/media/faces_I400.jpg",
352 ]
353 }
354
355 deps += [
356 # TODO(kjellander): Move as part of work in bugs.webrtc.org/4243.
357 ":rtc_media",
358 ":rtc_unittest_main",
359 "../audio",
360 "../base:rtc_base_tests_utils",
361 "../system_wrappers:metrics_default",
362 ]
363 }
364}