blob: 8ed07b14a5572e8562f3ee0b10c4e1dfd5d55fa2 [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" ]
kjellanderc76dc952016-06-03 03:09:32 -070031 }
32}
33
34if (is_linux && rtc_use_gtk) {
35 pkg_config("gtk-lib") {
36 packages = [
37 "gobject-2.0",
38 "gthread-2.0",
39 "gtk+-2.0",
40 ]
41 }
42}
43
magjed0d0d7532016-11-17 07:51:30 -080044rtc_static_library("rtc_media") {
kjellanderc76dc952016-06-03 03:09:32 -070045 defines = []
46 libs = []
47 deps = []
48 sources = [
nisse6f5a6c32016-09-22 01:25:59 -070049 "base/adaptedvideotracksource.cc",
50 "base/adaptedvideotracksource.h",
kjellanderc76dc952016-06-03 03:09:32 -070051 "base/audiosource.h",
52 "base/codec.cc",
53 "base/codec.h",
kjellanderc76dc952016-06-03 03:09:32 -070054 "base/cryptoparams.h",
55 "base/device.h",
kjellanderc76dc952016-06-03 03:09:32 -070056 "base/hybriddataengine.h",
57 "base/mediachannel.h",
kjellanderc76dc952016-06-03 03:09:32 -070058 "base/mediaconstants.cc",
59 "base/mediaconstants.h",
60 "base/mediaengine.cc",
61 "base/mediaengine.h",
62 "base/rtpdataengine.cc",
63 "base/rtpdataengine.h",
64 "base/rtpdump.cc",
65 "base/rtpdump.h",
66 "base/rtputils.cc",
67 "base/rtputils.h",
kjellanderc76dc952016-06-03 03:09:32 -070068 "base/streamparams.cc",
69 "base/streamparams.h",
70 "base/turnutils.cc",
71 "base/turnutils.h",
72 "base/videoadapter.cc",
73 "base/videoadapter.h",
74 "base/videobroadcaster.cc",
75 "base/videobroadcaster.h",
76 "base/videocapturer.cc",
77 "base/videocapturer.h",
78 "base/videocapturerfactory.h",
79 "base/videocommon.cc",
80 "base/videocommon.h",
kjellanderc76dc952016-06-03 03:09:32 -070081 "base/videoframe.h",
kjellanderc76dc952016-06-03 03:09:32 -070082 "base/videosourcebase.cc",
83 "base/videosourcebase.h",
magjed509e4fe2016-11-18 01:34:11 -080084 "engine/internalencoderfactory.cc",
85 "engine/internalencoderfactory.h",
kjellanderc76dc952016-06-03 03:09:32 -070086 "engine/nullwebrtcvideoengine.h",
ossu6f06cca2016-07-13 10:06:22 -070087 "engine/payload_type_mapper.cc",
88 "engine/payload_type_mapper.h",
kjellanderc76dc952016-06-03 03:09:32 -070089 "engine/simulcast.cc",
90 "engine/simulcast.h",
magjedf6acc2a2016-11-22 01:43:03 -080091 "engine/videodecodersoftwarefallbackwrapper.cc",
92 "engine/videodecodersoftwarefallbackwrapper.h",
magjed614d5b72016-11-15 06:30:54 -080093 "engine/videoencodersoftwarefallbackwrapper.cc",
94 "engine/videoencodersoftwarefallbackwrapper.h",
kjellanderc76dc952016-06-03 03:09:32 -070095 "engine/webrtccommon.h",
96 "engine/webrtcmediaengine.cc",
97 "engine/webrtcmediaengine.h",
98 "engine/webrtcvideocapturer.cc",
99 "engine/webrtcvideocapturer.h",
100 "engine/webrtcvideocapturerfactory.cc",
101 "engine/webrtcvideocapturerfactory.h",
102 "engine/webrtcvideodecoderfactory.h",
magjed1e45cc62016-10-28 07:43:45 -0700103 "engine/webrtcvideoencoderfactory.cc",
kjellanderc76dc952016-06-03 03:09:32 -0700104 "engine/webrtcvideoencoderfactory.h",
105 "engine/webrtcvideoengine2.cc",
106 "engine/webrtcvideoengine2.h",
kjellanderc76dc952016-06-03 03:09:32 -0700107 "engine/webrtcvideoframe.h",
kjellanderc76dc952016-06-03 03:09:32 -0700108 "engine/webrtcvoe.h",
109 "engine/webrtcvoiceengine.cc",
110 "engine/webrtcvoiceengine.h",
111 "sctp/sctpdataengine.cc",
112 "sctp/sctpdataengine.h",
113 ]
114
ehmaldonado7a2ce0b2016-09-05 01:35:44 -0700115 configs += [ ":rtc_media_warnings_config" ]
kjellanderc76dc952016-06-03 03:09:32 -0700116
kjellandere40a7ee2016-10-16 23:56:12 -0700117 if (!build_with_chromium && is_clang) {
kjellander82a94492016-06-12 22:12:01 -0700118 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
kjellander660312b2016-09-26 06:11:53 -0700119 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellanderc76dc952016-06-03 03:09:32 -0700120 }
121
122 if (is_win) {
123 cflags = [
124 "/wd4245", # conversion from "int" to "size_t", signed/unsigned mismatch.
125 "/wd4267", # conversion from "size_t" to "int", possible loss of data.
126 "/wd4389", # signed/unsigned mismatch.
127 ]
128 }
129
peah1bcfce52016-08-26 07:16:04 -0700130 if (rtc_enable_intelligibility_enhancer) {
131 defines += [ "WEBRTC_INTELLIGIBILITY_ENHANCER=1" ]
132 } else {
133 defines += [ "WEBRTC_INTELLIGIBILITY_ENHANCER=0" ]
134 }
135
kjellanderec5c9062016-08-19 01:07:30 -0700136 include_dirs = []
kjellanderc76dc952016-06-03 03:09:32 -0700137 if (rtc_build_libyuv) {
138 deps += [ "$rtc_libyuv_dir" ]
139 public_deps = [
140 "$rtc_libyuv_dir",
141 ]
142 } else {
143 # Need to add a directory normally exported by libyuv.
144 include_dirs += [ "$rtc_libyuv_dir/include" ]
145 }
146
147 if (rtc_build_usrsctp) {
kjellanderec5c9062016-08-19 01:07:30 -0700148 include_dirs += [
kjellanderc76dc952016-06-03 03:09:32 -0700149 # TODO(jiayl): move this into the public_configs of
150 # //third_party/usrsctp/BUILD.gn.
151 "//third_party/usrsctp/usrsctplib",
152 ]
153 deps += [ "//third_party/usrsctp" ]
154 }
155
ehmaldonadoe9cc6862016-09-05 06:10:18 -0700156 public_configs = []
kjellanderc76dc952016-06-03 03:09:32 -0700157 if (build_with_chromium) {
158 deps += [ "../modules/video_capture:video_capture" ]
159 } else {
kjellanderc76dc952016-06-03 03:09:32 -0700160 public_configs += [ ":rtc_media_defines_config" ]
161 deps += [ "../modules/video_capture:video_capture_internal_impl" ]
162 }
163 if (is_linux && rtc_use_gtk) {
164 sources += [
165 "devices/gtkvideorenderer.cc",
166 "devices/gtkvideorenderer.h",
167 ]
168 public_configs += [ ":gtk-lib" ]
169 }
kjellanderc76dc952016-06-03 03:09:32 -0700170 deps += [
171 "..:webrtc_common",
kjellandera69d9732016-08-31 07:33:05 -0700172 "../api:call_api",
kjellanderc76dc952016-06-03 03:09:32 -0700173 "../base:rtc_base_approved",
kjellander82a94492016-06-12 22:12:01 -0700174 "../call",
aleloi10111bc2016-11-17 06:48:48 -0800175 "../modules/audio_mixer:audio_mixer_impl",
kjellander82a94492016-06-12 22:12:01 -0700176 "../modules/video_coding",
magjed0d0d7532016-11-17 07:51:30 -0800177 "../p2p",
kjellanderc76dc952016-06-03 03:09:32 -0700178 "../system_wrappers",
magjed0d0d7532016-11-17 07:51:30 -0800179 "../video",
kjellanderc76dc952016-06-03 03:09:32 -0700180 "../voice_engine",
181 ]
182}
kjellander82a94492016-06-12 22:12:01 -0700183
184if (rtc_include_tests) {
185 config("rtc_unittest_main_config") {
186 # GN orders flags on a target before flags from configs. The default config
187 # adds -Wall, and this flag have to be after -Wall -- so they need to
188 # come from a config and can"t be on the target directly.
189 if (is_clang && is_ios) {
190 cflags = [ "-Wno-unused-variable" ]
191 }
192 }
193
ehmaldonado38a21322016-09-02 04:10:34 -0700194 rtc_source_set("rtc_unittest_main") {
kjellander82a94492016-06-12 22:12:01 -0700195 testonly = true
196
kjellanderec5c9062016-08-19 01:07:30 -0700197 include_dirs = []
198 public_deps = []
kjellander82a94492016-06-12 22:12:01 -0700199 deps = []
200 sources = [
201 "base/fakemediaengine.h",
202 "base/fakenetworkinterface.h",
203 "base/fakertp.h",
204 "base/fakevideocapturer.h",
205 "base/fakevideorenderer.h",
hbosb24b1ce2016-08-16 01:19:43 -0700206 "base/test/mock_mediachannel.h",
kjellander82a94492016-06-12 22:12:01 -0700207 "base/testutils.cc",
208 "base/testutils.h",
209 "engine/fakewebrtccall.cc",
210 "engine/fakewebrtccall.h",
kjellander82a94492016-06-12 22:12:01 -0700211 "engine/fakewebrtcdeviceinfo.h",
212 "engine/fakewebrtcvcmfactory.h",
213 "engine/fakewebrtcvideocapturemodule.h",
214 "engine/fakewebrtcvideoengine.h",
215 "engine/fakewebrtcvoiceengine.h",
216 ]
217
ehmaldonado7a2ce0b2016-09-05 01:35:44 -0700218 configs += [ ":rtc_unittest_main_config" ]
kjellander82a94492016-06-12 22:12:01 -0700219
220 if (rtc_build_libyuv) {
221 deps += [ "$rtc_libyuv_dir" ]
kjellanderec5c9062016-08-19 01:07:30 -0700222 public_deps += [ "$rtc_libyuv_dir" ]
kjellander82a94492016-06-12 22:12:01 -0700223 } else {
224 # Need to add a directory normally exported by libyuv.
225 include_dirs += [ "$rtc_libyuv_dir/include" ]
226 }
227
kjellandere40a7ee2016-10-16 23:56:12 -0700228 if (!build_with_chromium && is_clang) {
229 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
ehmaldonado38a21322016-09-02 04:10:34 -0700230 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellander82a94492016-06-12 22:12:01 -0700231 }
232
233 deps += [
234 "../base:rtc_base_tests_utils",
235 "//testing/gtest",
236 ]
237 public_deps += [ "//testing/gmock" ]
238 }
239
240 config("rtc_media_unittests_config") {
241 # GN orders flags on a target before flags from configs. The default config
242 # adds -Wall, and this flag have to be after -Wall -- so they need to
243 # come from a config and can"t be on the target directly.
244 # TODO(kjellander): Make the code compile without disabling these flags.
245 # See https://bugs.webrtc.org/3307.
246 if (is_clang && is_win) {
ehmaldonadod02fe4b2016-08-26 13:31:24 -0700247 cflags = [
248 # See https://bugs.chromium.org/p/webrtc/issues/detail?id=6266
249 # for -Wno-sign-compare
250 "-Wno-sign-compare",
251 "-Wno-unused-function",
252 ]
kjellander82a94492016-06-12 22:12:01 -0700253 }
254 if (!is_win) {
255 cflags = [ "-Wno-sign-compare" ]
kjellander82a94492016-06-12 22:12:01 -0700256 }
257 }
258
ehmaldonado3a7f35b2016-09-14 05:10:01 -0700259 rtc_media_unittests_resources = [
260 "//resources/media/captured-320x240-2s-48.frames",
261 "//resources/media/faces.1280x720_P420.yuv",
262 "//resources/media/faces_I420.jpg",
263 "//resources/media/faces_I422.jpg",
264 "//resources/media/faces_I444.jpg",
265 "//resources/media/faces_I411.jpg",
266 "//resources/media/faces_I400.jpg",
267 ]
kjellander32c4a202016-08-30 02:53:49 -0700268
269 if (is_ios) {
270 bundle_data("rtc_media_unittests_bundle_data") {
271 testonly = true
272 sources = rtc_media_unittests_resources
273 outputs = [
274 "{{bundle_resources_dir}}/{{source_file_part}}",
275 ]
276 }
277 }
278
ehmaldonado38a21322016-09-02 04:10:34 -0700279 rtc_test("rtc_media_unittests") {
kjellander82a94492016-06-12 22:12:01 -0700280 testonly = true
281
johan073ece42016-08-26 02:59:47 -0700282 defines = []
kjellander82a94492016-06-12 22:12:01 -0700283 deps = []
284 sources = [
285 "base/codec_unittest.cc",
286 "base/rtpdataengine_unittest.cc",
287 "base/rtpdump_unittest.cc",
288 "base/rtputils_unittest.cc",
289 "base/streamparams_unittest.cc",
290 "base/turnutils_unittest.cc",
291 "base/videoadapter_unittest.cc",
292 "base/videobroadcaster_unittest.cc",
293 "base/videocapturer_unittest.cc",
294 "base/videocommon_unittest.cc",
295 "base/videoengine_unittest.h",
kjellander82a94492016-06-12 22:12:01 -0700296 "engine/nullwebrtcvideoengine_unittest.cc",
ossuc54071d2016-08-17 02:45:41 -0700297 "engine/payload_type_mapper_unittest.cc",
kjellander82a94492016-06-12 22:12:01 -0700298 "engine/simulcast_unittest.cc",
magjedf6acc2a2016-11-22 01:43:03 -0800299 "engine/videodecodersoftwarefallbackwrapper_unittest.cc",
magjed614d5b72016-11-15 06:30:54 -0800300 "engine/videoencodersoftwarefallbackwrapper_unittest.cc",
kjellander82a94492016-06-12 22:12:01 -0700301 "engine/webrtcmediaengine_unittest.cc",
302 "engine/webrtcvideocapturer_unittest.cc",
303 "engine/webrtcvideoengine2_unittest.cc",
kjellander82a94492016-06-12 22:12:01 -0700304 "engine/webrtcvoiceengine_unittest.cc",
305 "sctp/sctpdataengine_unittest.cc",
306 ]
307
ehmaldonado7a2ce0b2016-09-05 01:35:44 -0700308 configs += [ ":rtc_media_unittests_config" ]
kjellander82a94492016-06-12 22:12:01 -0700309
johan073ece42016-08-26 02:59:47 -0700310 if (rtc_use_h264) {
311 defines += [ "WEBRTC_USE_H264" ]
312 }
kjellander82a94492016-06-12 22:12:01 -0700313 if (is_win) {
314 cflags = [
315 "/wd4245", # conversion from int to size_t, signed/unsigned mismatch.
316 "/wd4373", # virtual function override.
317 "/wd4389", # signed/unsigned mismatch.
318 ]
319 }
320
kjellandere40a7ee2016-10-16 23:56:12 -0700321 if (!build_with_chromium && is_clang) {
ehmaldonado38a21322016-09-02 04:10:34 -0700322 suppressed_configs += [
kjellander82a94492016-06-12 22:12:01 -0700323 "//build/config/clang:extra_warnings",
kjellandere40a7ee2016-10-16 23:56:12 -0700324
325 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
kjellander82a94492016-06-12 22:12:01 -0700326 "//build/config/clang:find_bad_constructs",
327 ]
328 }
329
ehmaldonado3a7f35b2016-09-14 05:10:01 -0700330 data = rtc_media_unittests_resources
331
kjellander82a94492016-06-12 22:12:01 -0700332 if (is_android) {
333 deps += [ "//testing/android/native_test:native_test_support" ]
kjellander28a0ffd2016-08-24 07:48:42 -0700334 shard_timeout = 900
335 }
kjellander32c4a202016-08-30 02:53:49 -0700336
337 if (is_ios) {
338 deps += [ ":rtc_media_unittests_bundle_data" ]
kjellander82a94492016-06-12 22:12:01 -0700339 }
340
341 deps += [
342 # TODO(kjellander): Move as part of work in bugs.webrtc.org/4243.
343 ":rtc_media",
344 ":rtc_unittest_main",
345 "../audio",
346 "../base:rtc_base_tests_utils",
aleloi5de52fd2016-11-10 01:05:34 -0800347 "../modules/audio_device:mock_audio_device",
kjellander82a94492016-06-12 22:12:01 -0700348 "../system_wrappers:metrics_default",
349 ]
350 }
351}