blob: 122c404455a98186cb1d4785766204de58986369 [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",
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
kjellanderb62dbbe2016-09-23 00:38:52 -070045rtc_static_library("rtc_media") {
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",
59 "base/mediacommon.h",
60 "base/mediaconstants.cc",
61 "base/mediaconstants.h",
62 "base/mediaengine.cc",
63 "base/mediaengine.h",
64 "base/rtpdataengine.cc",
65 "base/rtpdataengine.h",
66 "base/rtpdump.cc",
67 "base/rtpdump.h",
68 "base/rtputils.cc",
69 "base/rtputils.h",
70 "base/screencastid.h",
71 "base/streamparams.cc",
72 "base/streamparams.h",
73 "base/turnutils.cc",
74 "base/turnutils.h",
75 "base/videoadapter.cc",
76 "base/videoadapter.h",
77 "base/videobroadcaster.cc",
78 "base/videobroadcaster.h",
79 "base/videocapturer.cc",
80 "base/videocapturer.h",
81 "base/videocapturerfactory.h",
82 "base/videocommon.cc",
83 "base/videocommon.h",
kjellanderd36dd492016-10-08 22:21:35 -070084 "base/videoframe.cc",
kjellanderc76dc952016-06-03 03:09:32 -070085 "base/videoframe.h",
kjellanderc76dc952016-06-03 03:09:32 -070086 "base/videosourcebase.cc",
87 "base/videosourcebase.h",
kjellanderc76dc952016-06-03 03:09:32 -070088 "devices/videorendererfactory.h",
89 "engine/nullwebrtcvideoengine.h",
ossu6f06cca2016-07-13 10:06:22 -070090 "engine/payload_type_mapper.cc",
91 "engine/payload_type_mapper.h",
kjellanderc76dc952016-06-03 03:09:32 -070092 "engine/simulcast.cc",
93 "engine/simulcast.h",
94 "engine/webrtccommon.h",
95 "engine/webrtcmediaengine.cc",
96 "engine/webrtcmediaengine.h",
97 "engine/webrtcvideocapturer.cc",
98 "engine/webrtcvideocapturer.h",
99 "engine/webrtcvideocapturerfactory.cc",
100 "engine/webrtcvideocapturerfactory.h",
101 "engine/webrtcvideodecoderfactory.h",
102 "engine/webrtcvideoencoderfactory.h",
103 "engine/webrtcvideoengine2.cc",
104 "engine/webrtcvideoengine2.h",
kjellanderd36dd492016-10-08 22:21:35 -0700105 "engine/webrtcvideoframe.cc",
kjellanderc76dc952016-06-03 03:09:32 -0700106 "engine/webrtcvideoframe.h",
kjellanderc76dc952016-06-03 03:09:32 -0700107 "engine/webrtcvoe.h",
108 "engine/webrtcvoiceengine.cc",
109 "engine/webrtcvoiceengine.h",
110 "sctp/sctpdataengine.cc",
111 "sctp/sctpdataengine.h",
112 ]
113
ehmaldonado7a2ce0b2016-09-05 01:35:44 -0700114 configs += [ ":rtc_media_warnings_config" ]
kjellanderc76dc952016-06-03 03:09:32 -0700115
kjellanderc76dc952016-06-03 03:09:32 -0700116 if (is_clang) {
kjellander82a94492016-06-12 22:12:01 -0700117 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
kjellander660312b2016-09-26 06:11:53 -0700118 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellanderc76dc952016-06-03 03:09:32 -0700119 }
120
121 if (is_win) {
122 cflags = [
123 "/wd4245", # conversion from "int" to "size_t", signed/unsigned mismatch.
124 "/wd4267", # conversion from "size_t" to "int", possible loss of data.
125 "/wd4389", # signed/unsigned mismatch.
126 ]
127 }
128
peah1bcfce52016-08-26 07:16:04 -0700129 if (rtc_enable_intelligibility_enhancer) {
130 defines += [ "WEBRTC_INTELLIGIBILITY_ENHANCER=1" ]
131 } else {
132 defines += [ "WEBRTC_INTELLIGIBILITY_ENHANCER=0" ]
133 }
134
kjellanderec5c9062016-08-19 01:07:30 -0700135 include_dirs = []
kjellanderc76dc952016-06-03 03:09:32 -0700136 if (rtc_build_libyuv) {
137 deps += [ "$rtc_libyuv_dir" ]
138 public_deps = [
139 "$rtc_libyuv_dir",
140 ]
141 } else {
142 # Need to add a directory normally exported by libyuv.
143 include_dirs += [ "$rtc_libyuv_dir/include" ]
144 }
145
146 if (rtc_build_usrsctp) {
kjellanderec5c9062016-08-19 01:07:30 -0700147 include_dirs += [
kjellanderc76dc952016-06-03 03:09:32 -0700148 # TODO(jiayl): move this into the public_configs of
149 # //third_party/usrsctp/BUILD.gn.
150 "//third_party/usrsctp/usrsctplib",
151 ]
152 deps += [ "//third_party/usrsctp" ]
153 }
154
ehmaldonadoe9cc6862016-09-05 06:10:18 -0700155 public_configs = []
kjellanderc76dc952016-06-03 03:09:32 -0700156 if (build_with_chromium) {
157 deps += [ "../modules/video_capture:video_capture" ]
158 } else {
kjellanderc76dc952016-06-03 03:09:32 -0700159 public_configs += [ ":rtc_media_defines_config" ]
160 deps += [ "../modules/video_capture:video_capture_internal_impl" ]
161 }
162 if (is_linux && rtc_use_gtk) {
163 sources += [
164 "devices/gtkvideorenderer.cc",
165 "devices/gtkvideorenderer.h",
166 ]
167 public_configs += [ ":gtk-lib" ]
168 }
169 if (is_win) {
170 sources += [
171 "devices/gdivideorenderer.cc",
172 "devices/gdivideorenderer.h",
173 ]
174 libs += [
175 "d3d9.lib",
176 "gdi32.lib",
177 "strmiids.lib",
178 ]
179 }
kjellanderc76dc952016-06-03 03:09:32 -0700180 deps += [
181 "..:webrtc_common",
kjellandera69d9732016-08-31 07:33:05 -0700182 "../api:call_api",
kjellanderc76dc952016-06-03 03:09:32 -0700183 "../base:rtc_base_approved",
kjellander82a94492016-06-12 22:12:01 -0700184 "../call",
kjellanderc76dc952016-06-03 03:09:32 -0700185 "../libjingle/xmllite",
186 "../libjingle/xmpp",
kjellander82a94492016-06-12 22:12:01 -0700187 "../modules/video_coding",
kjellanderc76dc952016-06-03 03:09:32 -0700188 "../p2p",
189 "../system_wrappers",
kjellander82a94492016-06-12 22:12:01 -0700190 "../video",
kjellanderc76dc952016-06-03 03:09:32 -0700191 "../voice_engine",
192 ]
193}
kjellander82a94492016-06-12 22:12:01 -0700194
195if (rtc_include_tests) {
196 config("rtc_unittest_main_config") {
197 # GN orders flags on a target before flags from configs. The default config
198 # adds -Wall, and this flag have to be after -Wall -- so they need to
199 # come from a config and can"t be on the target directly.
200 if (is_clang && is_ios) {
201 cflags = [ "-Wno-unused-variable" ]
202 }
203 }
204
ehmaldonado38a21322016-09-02 04:10:34 -0700205 rtc_source_set("rtc_unittest_main") {
kjellander82a94492016-06-12 22:12:01 -0700206 testonly = true
207
kjellanderec5c9062016-08-19 01:07:30 -0700208 include_dirs = []
209 public_deps = []
kjellander82a94492016-06-12 22:12:01 -0700210 deps = []
211 sources = [
212 "base/fakemediaengine.h",
213 "base/fakenetworkinterface.h",
214 "base/fakertp.h",
215 "base/fakevideocapturer.h",
216 "base/fakevideorenderer.h",
hbosb24b1ce2016-08-16 01:19:43 -0700217 "base/test/mock_mediachannel.h",
kjellander82a94492016-06-12 22:12:01 -0700218 "base/testutils.cc",
219 "base/testutils.h",
220 "engine/fakewebrtccall.cc",
221 "engine/fakewebrtccall.h",
kjellander82a94492016-06-12 22:12:01 -0700222 "engine/fakewebrtcdeviceinfo.h",
223 "engine/fakewebrtcvcmfactory.h",
224 "engine/fakewebrtcvideocapturemodule.h",
225 "engine/fakewebrtcvideoengine.h",
226 "engine/fakewebrtcvoiceengine.h",
227 ]
228
ehmaldonado7a2ce0b2016-09-05 01:35:44 -0700229 configs += [ ":rtc_unittest_main_config" ]
kjellander82a94492016-06-12 22:12:01 -0700230
231 if (rtc_build_libyuv) {
232 deps += [ "$rtc_libyuv_dir" ]
kjellanderec5c9062016-08-19 01:07:30 -0700233 public_deps += [ "$rtc_libyuv_dir" ]
kjellander82a94492016-06-12 22:12:01 -0700234 } else {
235 # Need to add a directory normally exported by libyuv.
236 include_dirs += [ "$rtc_libyuv_dir/include" ]
237 }
238
239 if (is_clang) {
240 # Suppress warnings from the Chromium Clang plugin.
241 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
ehmaldonado38a21322016-09-02 04:10:34 -0700242 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellander82a94492016-06-12 22:12:01 -0700243 }
244
245 deps += [
246 "../base:rtc_base_tests_utils",
247 "//testing/gtest",
248 ]
249 public_deps += [ "//testing/gmock" ]
250 }
251
252 config("rtc_media_unittests_config") {
253 # GN orders flags on a target before flags from configs. The default config
254 # adds -Wall, and this flag have to be after -Wall -- so they need to
255 # come from a config and can"t be on the target directly.
256 # TODO(kjellander): Make the code compile without disabling these flags.
257 # See https://bugs.webrtc.org/3307.
258 if (is_clang && is_win) {
ehmaldonadod02fe4b2016-08-26 13:31:24 -0700259 cflags = [
260 # See https://bugs.chromium.org/p/webrtc/issues/detail?id=6266
261 # for -Wno-sign-compare
262 "-Wno-sign-compare",
263 "-Wno-unused-function",
264 ]
kjellander82a94492016-06-12 22:12:01 -0700265 }
266 if (!is_win) {
267 cflags = [ "-Wno-sign-compare" ]
268 cflags_cc = [ "-Wno-overloaded-virtual" ]
269 }
270 }
271
ehmaldonado3a7f35b2016-09-14 05:10:01 -0700272 rtc_media_unittests_resources = [
273 "//resources/media/captured-320x240-2s-48.frames",
274 "//resources/media/faces.1280x720_P420.yuv",
275 "//resources/media/faces_I420.jpg",
276 "//resources/media/faces_I422.jpg",
277 "//resources/media/faces_I444.jpg",
278 "//resources/media/faces_I411.jpg",
279 "//resources/media/faces_I400.jpg",
280 ]
kjellander32c4a202016-08-30 02:53:49 -0700281
282 if (is_ios) {
283 bundle_data("rtc_media_unittests_bundle_data") {
284 testonly = true
285 sources = rtc_media_unittests_resources
286 outputs = [
287 "{{bundle_resources_dir}}/{{source_file_part}}",
288 ]
289 }
290 }
291
ehmaldonado38a21322016-09-02 04:10:34 -0700292 rtc_test("rtc_media_unittests") {
kjellander82a94492016-06-12 22:12:01 -0700293 testonly = true
294
johan073ece42016-08-26 02:59:47 -0700295 defines = []
kjellander82a94492016-06-12 22:12:01 -0700296 deps = []
297 sources = [
298 "base/codec_unittest.cc",
299 "base/rtpdataengine_unittest.cc",
300 "base/rtpdump_unittest.cc",
301 "base/rtputils_unittest.cc",
302 "base/streamparams_unittest.cc",
303 "base/turnutils_unittest.cc",
304 "base/videoadapter_unittest.cc",
305 "base/videobroadcaster_unittest.cc",
306 "base/videocapturer_unittest.cc",
307 "base/videocommon_unittest.cc",
308 "base/videoengine_unittest.h",
kjellanderd36dd492016-10-08 22:21:35 -0700309 "base/videoframe_unittest.h",
kjellander82a94492016-06-12 22:12:01 -0700310 "engine/nullwebrtcvideoengine_unittest.cc",
ossuc54071d2016-08-17 02:45:41 -0700311 "engine/payload_type_mapper_unittest.cc",
kjellander82a94492016-06-12 22:12:01 -0700312 "engine/simulcast_unittest.cc",
313 "engine/webrtcmediaengine_unittest.cc",
314 "engine/webrtcvideocapturer_unittest.cc",
315 "engine/webrtcvideoengine2_unittest.cc",
kjellanderd36dd492016-10-08 22:21:35 -0700316 "engine/webrtcvideoframe_unittest.cc",
kjellander82a94492016-06-12 22:12:01 -0700317 "engine/webrtcvoiceengine_unittest.cc",
318 "sctp/sctpdataengine_unittest.cc",
319 ]
320
ehmaldonado7a2ce0b2016-09-05 01:35:44 -0700321 configs += [ ":rtc_media_unittests_config" ]
kjellander82a94492016-06-12 22:12:01 -0700322
johan073ece42016-08-26 02:59:47 -0700323 if (rtc_use_h264) {
324 defines += [ "WEBRTC_USE_H264" ]
325 }
kjellander82a94492016-06-12 22:12:01 -0700326 if (is_win) {
327 cflags = [
328 "/wd4245", # conversion from int to size_t, signed/unsigned mismatch.
329 "/wd4373", # virtual function override.
330 "/wd4389", # signed/unsigned mismatch.
331 ]
332 }
333
334 if (is_clang) {
335 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
ehmaldonado38a21322016-09-02 04:10:34 -0700336 suppressed_configs += [
kjellander82a94492016-06-12 22:12:01 -0700337 "//build/config/clang:extra_warnings",
338 "//build/config/clang:find_bad_constructs",
339 ]
340 }
341
ehmaldonado3a7f35b2016-09-14 05:10:01 -0700342 data = rtc_media_unittests_resources
343
kjellander82a94492016-06-12 22:12:01 -0700344 if (is_android) {
345 deps += [ "//testing/android/native_test:native_test_support" ]
kjellander28a0ffd2016-08-24 07:48:42 -0700346 shard_timeout = 900
347 }
kjellander32c4a202016-08-30 02:53:49 -0700348
349 if (is_ios) {
350 deps += [ ":rtc_media_unittests_bundle_data" ]
kjellander82a94492016-06-12 22:12:01 -0700351 }
352
353 deps += [
354 # TODO(kjellander): Move as part of work in bugs.webrtc.org/4243.
355 ":rtc_media",
356 ":rtc_unittest_main",
357 "../audio",
358 "../base:rtc_base_tests_utils",
359 "../system_wrappers:metrics_default",
360 ]
361 }
362}