blob: b61de328c35da8b528eb0458ea352b3af53f6da1 [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")
11
12group("media") {
kjellander705ecc52016-09-15 07:53:2613 public_deps = [
kjellanderc76dc952016-06-03 10:09:3214 ":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 07:38:5245rtc_static_library("rtc_media") {
kjellanderc76dc952016-06-03 10:09:3246 defines = []
47 libs = []
48 deps = []
49 sources = [
nisse6f5a6c32016-09-22 08:25:5950 "base/adaptedvideotracksource.cc",
51 "base/adaptedvideotracksource.h",
kjellanderc76dc952016-06-03 10:09:3252 "base/audiosource.h",
53 "base/codec.cc",
54 "base/codec.h",
kjellanderc76dc952016-06-03 10:09:3255 "base/cryptoparams.h",
56 "base/device.h",
kjellanderc76dc952016-06-03 10:09:3257 "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-09 05:21:3584 "base/videoframe.cc",
kjellanderc76dc952016-06-03 10:09:3285 "base/videoframe.h",
kjellanderc76dc952016-06-03 10:09:3286 "base/videosourcebase.cc",
87 "base/videosourcebase.h",
kjellanderc76dc952016-06-03 10:09:3288 "devices/videorendererfactory.h",
89 "engine/nullwebrtcvideoengine.h",
ossu6f06cca2016-07-13 17:06:2290 "engine/payload_type_mapper.cc",
91 "engine/payload_type_mapper.h",
kjellanderc76dc952016-06-03 10:09:3292 "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-09 05:21:35105 "engine/webrtcvideoframe.cc",
kjellanderc76dc952016-06-03 10:09:32106 "engine/webrtcvideoframe.h",
kjellanderc76dc952016-06-03 10:09:32107 "engine/webrtcvoe.h",
108 "engine/webrtcvoiceengine.cc",
109 "engine/webrtcvoiceengine.h",
110 "sctp/sctpdataengine.cc",
111 "sctp/sctpdataengine.h",
112 ]
113
ehmaldonado7a2ce0b2016-09-05 08:35:44114 configs += [ ":rtc_media_warnings_config" ]
kjellanderc76dc952016-06-03 10:09:32115
kjellandere40a7ee2016-10-17 06:56:12116 if (!build_with_chromium && is_clang) {
kjellander82a94492016-06-13 05:12:01117 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
kjellander660312b2016-09-26 13:11:53118 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellanderc76dc952016-06-03 10:09:32119 }
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 14:16:04129 if (rtc_enable_intelligibility_enhancer) {
130 defines += [ "WEBRTC_INTELLIGIBILITY_ENHANCER=1" ]
131 } else {
132 defines += [ "WEBRTC_INTELLIGIBILITY_ENHANCER=0" ]
133 }
134
kjellanderec5c9062016-08-19 08:07:30135 include_dirs = []
kjellanderc76dc952016-06-03 10:09:32136 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 08:07:30147 include_dirs += [
kjellanderc76dc952016-06-03 10:09:32148 # 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 13:10:18155 public_configs = []
kjellanderc76dc952016-06-03 10:09:32156 if (build_with_chromium) {
157 deps += [ "../modules/video_capture:video_capture" ]
158 } else {
kjellanderc76dc952016-06-03 10:09:32159 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 10:09:32180 deps += [
181 "..:webrtc_common",
kjellandera69d9732016-08-31 14:33:05182 "../api:call_api",
kjellanderc76dc952016-06-03 10:09:32183 "../base:rtc_base_approved",
kjellander82a94492016-06-13 05:12:01184 "../call",
kjellanderc76dc952016-06-03 10:09:32185 "../libjingle/xmllite",
186 "../libjingle/xmpp",
kjellander82a94492016-06-13 05:12:01187 "../modules/video_coding",
kjellanderc76dc952016-06-03 10:09:32188 "../p2p",
189 "../system_wrappers",
kjellander82a94492016-06-13 05:12:01190 "../video",
kjellanderc76dc952016-06-03 10:09:32191 "../voice_engine",
192 ]
193}
kjellander82a94492016-06-13 05:12:01194
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 11:10:34205 rtc_source_set("rtc_unittest_main") {
kjellander82a94492016-06-13 05:12:01206 testonly = true
207
kjellanderec5c9062016-08-19 08:07:30208 include_dirs = []
209 public_deps = []
kjellander82a94492016-06-13 05:12:01210 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 08:19:43217 "base/test/mock_mediachannel.h",
kjellander82a94492016-06-13 05:12:01218 "base/testutils.cc",
219 "base/testutils.h",
220 "engine/fakewebrtccall.cc",
221 "engine/fakewebrtccall.h",
kjellander82a94492016-06-13 05:12:01222 "engine/fakewebrtcdeviceinfo.h",
223 "engine/fakewebrtcvcmfactory.h",
224 "engine/fakewebrtcvideocapturemodule.h",
225 "engine/fakewebrtcvideoengine.h",
226 "engine/fakewebrtcvoiceengine.h",
227 ]
228
ehmaldonado7a2ce0b2016-09-05 08:35:44229 configs += [ ":rtc_unittest_main_config" ]
kjellander82a94492016-06-13 05:12:01230
231 if (rtc_build_libyuv) {
232 deps += [ "$rtc_libyuv_dir" ]
kjellanderec5c9062016-08-19 08:07:30233 public_deps += [ "$rtc_libyuv_dir" ]
kjellander82a94492016-06-13 05:12:01234 } else {
235 # Need to add a directory normally exported by libyuv.
236 include_dirs += [ "$rtc_libyuv_dir/include" ]
237 }
238
kjellandere40a7ee2016-10-17 06:56:12239 if (!build_with_chromium && is_clang) {
240 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
ehmaldonado38a21322016-09-02 11:10:34241 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellander82a94492016-06-13 05:12:01242 }
243
244 deps += [
245 "../base:rtc_base_tests_utils",
246 "//testing/gtest",
247 ]
248 public_deps += [ "//testing/gmock" ]
249 }
250
251 config("rtc_media_unittests_config") {
252 # GN orders flags on a target before flags from configs. The default config
253 # adds -Wall, and this flag have to be after -Wall -- so they need to
254 # come from a config and can"t be on the target directly.
255 # TODO(kjellander): Make the code compile without disabling these flags.
256 # See https://bugs.webrtc.org/3307.
257 if (is_clang && is_win) {
ehmaldonadod02fe4b2016-08-26 20:31:24258 cflags = [
259 # See https://bugs.chromium.org/p/webrtc/issues/detail?id=6266
260 # for -Wno-sign-compare
261 "-Wno-sign-compare",
262 "-Wno-unused-function",
263 ]
kjellander82a94492016-06-13 05:12:01264 }
265 if (!is_win) {
266 cflags = [ "-Wno-sign-compare" ]
267 cflags_cc = [ "-Wno-overloaded-virtual" ]
268 }
269 }
270
ehmaldonado3a7f35b2016-09-14 12:10:01271 rtc_media_unittests_resources = [
272 "//resources/media/captured-320x240-2s-48.frames",
273 "//resources/media/faces.1280x720_P420.yuv",
274 "//resources/media/faces_I420.jpg",
275 "//resources/media/faces_I422.jpg",
276 "//resources/media/faces_I444.jpg",
277 "//resources/media/faces_I411.jpg",
278 "//resources/media/faces_I400.jpg",
279 ]
kjellander32c4a202016-08-30 09:53:49280
281 if (is_ios) {
282 bundle_data("rtc_media_unittests_bundle_data") {
283 testonly = true
284 sources = rtc_media_unittests_resources
285 outputs = [
286 "{{bundle_resources_dir}}/{{source_file_part}}",
287 ]
288 }
289 }
290
ehmaldonado38a21322016-09-02 11:10:34291 rtc_test("rtc_media_unittests") {
kjellander82a94492016-06-13 05:12:01292 testonly = true
293
johan073ece42016-08-26 09:59:47294 defines = []
kjellander82a94492016-06-13 05:12:01295 deps = []
296 sources = [
297 "base/codec_unittest.cc",
298 "base/rtpdataengine_unittest.cc",
299 "base/rtpdump_unittest.cc",
300 "base/rtputils_unittest.cc",
301 "base/streamparams_unittest.cc",
302 "base/turnutils_unittest.cc",
303 "base/videoadapter_unittest.cc",
304 "base/videobroadcaster_unittest.cc",
305 "base/videocapturer_unittest.cc",
306 "base/videocommon_unittest.cc",
307 "base/videoengine_unittest.h",
kjellanderd36dd492016-10-09 05:21:35308 "base/videoframe_unittest.h",
kjellander82a94492016-06-13 05:12:01309 "engine/nullwebrtcvideoengine_unittest.cc",
ossuc54071d2016-08-17 09:45:41310 "engine/payload_type_mapper_unittest.cc",
kjellander82a94492016-06-13 05:12:01311 "engine/simulcast_unittest.cc",
312 "engine/webrtcmediaengine_unittest.cc",
313 "engine/webrtcvideocapturer_unittest.cc",
314 "engine/webrtcvideoengine2_unittest.cc",
kjellanderd36dd492016-10-09 05:21:35315 "engine/webrtcvideoframe_unittest.cc",
kjellander82a94492016-06-13 05:12:01316 "engine/webrtcvoiceengine_unittest.cc",
317 "sctp/sctpdataengine_unittest.cc",
318 ]
319
ehmaldonado7a2ce0b2016-09-05 08:35:44320 configs += [ ":rtc_media_unittests_config" ]
kjellander82a94492016-06-13 05:12:01321
johan073ece42016-08-26 09:59:47322 if (rtc_use_h264) {
323 defines += [ "WEBRTC_USE_H264" ]
324 }
kjellander82a94492016-06-13 05:12:01325 if (is_win) {
326 cflags = [
327 "/wd4245", # conversion from int to size_t, signed/unsigned mismatch.
328 "/wd4373", # virtual function override.
329 "/wd4389", # signed/unsigned mismatch.
330 ]
331 }
332
kjellandere40a7ee2016-10-17 06:56:12333 if (!build_with_chromium && is_clang) {
ehmaldonado38a21322016-09-02 11:10:34334 suppressed_configs += [
kjellander82a94492016-06-13 05:12:01335 "//build/config/clang:extra_warnings",
kjellandere40a7ee2016-10-17 06:56:12336
337 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
kjellander82a94492016-06-13 05:12:01338 "//build/config/clang:find_bad_constructs",
339 ]
340 }
341
ehmaldonado3a7f35b2016-09-14 12:10:01342 data = rtc_media_unittests_resources
343
kjellander82a94492016-06-13 05:12:01344 if (is_android) {
345 deps += [ "//testing/android/native_test:native_test_support" ]
kjellander28a0ffd2016-08-24 14:48:42346 shard_timeout = 900
347 }
kjellander32c4a202016-08-30 09:53:49348
349 if (is_ios) {
350 deps += [ ":rtc_media_unittests_bundle_data" ]
kjellander82a94492016-06-13 05:12:01351 }
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}