blob: efa81d499ef7a5e4619bad2ea6072889969eb530 [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
kjellanderb62dbbe2016-09-23 00:38:52 -070044rtc_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",
kjellanderc76dc952016-06-03 03:09:32 -070084 "engine/nullwebrtcvideoengine.h",
ossu6f06cca2016-07-13 10:06:22 -070085 "engine/payload_type_mapper.cc",
86 "engine/payload_type_mapper.h",
kjellanderc76dc952016-06-03 03:09:32 -070087 "engine/simulcast.cc",
88 "engine/simulcast.h",
89 "engine/webrtccommon.h",
90 "engine/webrtcmediaengine.cc",
91 "engine/webrtcmediaengine.h",
92 "engine/webrtcvideocapturer.cc",
93 "engine/webrtcvideocapturer.h",
94 "engine/webrtcvideocapturerfactory.cc",
95 "engine/webrtcvideocapturerfactory.h",
96 "engine/webrtcvideodecoderfactory.h",
magjed1e45cc62016-10-28 07:43:45 -070097 "engine/webrtcvideoencoderfactory.cc",
kjellanderc76dc952016-06-03 03:09:32 -070098 "engine/webrtcvideoencoderfactory.h",
99 "engine/webrtcvideoengine2.cc",
100 "engine/webrtcvideoengine2.h",
kjellanderc76dc952016-06-03 03:09:32 -0700101 "engine/webrtcvideoframe.h",
kjellanderc76dc952016-06-03 03:09:32 -0700102 "engine/webrtcvoe.h",
103 "engine/webrtcvoiceengine.cc",
104 "engine/webrtcvoiceengine.h",
105 "sctp/sctpdataengine.cc",
106 "sctp/sctpdataengine.h",
107 ]
108
ehmaldonado7a2ce0b2016-09-05 01:35:44 -0700109 configs += [ ":rtc_media_warnings_config" ]
kjellanderc76dc952016-06-03 03:09:32 -0700110
kjellandere40a7ee2016-10-16 23:56:12 -0700111 if (!build_with_chromium && is_clang) {
kjellander82a94492016-06-12 22:12:01 -0700112 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
kjellander660312b2016-09-26 06:11:53 -0700113 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellanderc76dc952016-06-03 03:09:32 -0700114 }
115
116 if (is_win) {
117 cflags = [
118 "/wd4245", # conversion from "int" to "size_t", signed/unsigned mismatch.
119 "/wd4267", # conversion from "size_t" to "int", possible loss of data.
120 "/wd4389", # signed/unsigned mismatch.
121 ]
122 }
123
peah1bcfce52016-08-26 07:16:04 -0700124 if (rtc_enable_intelligibility_enhancer) {
125 defines += [ "WEBRTC_INTELLIGIBILITY_ENHANCER=1" ]
126 } else {
127 defines += [ "WEBRTC_INTELLIGIBILITY_ENHANCER=0" ]
128 }
129
kjellanderec5c9062016-08-19 01:07:30 -0700130 include_dirs = []
kjellanderc76dc952016-06-03 03:09:32 -0700131 if (rtc_build_libyuv) {
132 deps += [ "$rtc_libyuv_dir" ]
133 public_deps = [
134 "$rtc_libyuv_dir",
135 ]
136 } else {
137 # Need to add a directory normally exported by libyuv.
138 include_dirs += [ "$rtc_libyuv_dir/include" ]
139 }
140
141 if (rtc_build_usrsctp) {
kjellanderec5c9062016-08-19 01:07:30 -0700142 include_dirs += [
kjellanderc76dc952016-06-03 03:09:32 -0700143 # TODO(jiayl): move this into the public_configs of
144 # //third_party/usrsctp/BUILD.gn.
145 "//third_party/usrsctp/usrsctplib",
146 ]
147 deps += [ "//third_party/usrsctp" ]
148 }
149
ehmaldonadoe9cc6862016-09-05 06:10:18 -0700150 public_configs = []
kjellanderc76dc952016-06-03 03:09:32 -0700151 if (build_with_chromium) {
152 deps += [ "../modules/video_capture:video_capture" ]
153 } else {
kjellanderc76dc952016-06-03 03:09:32 -0700154 public_configs += [ ":rtc_media_defines_config" ]
155 deps += [ "../modules/video_capture:video_capture_internal_impl" ]
156 }
157 if (is_linux && rtc_use_gtk) {
158 sources += [
159 "devices/gtkvideorenderer.cc",
160 "devices/gtkvideorenderer.h",
161 ]
162 public_configs += [ ":gtk-lib" ]
163 }
kjellanderc76dc952016-06-03 03:09:32 -0700164 deps += [
165 "..:webrtc_common",
kjellandera69d9732016-08-31 07:33:05 -0700166 "../api:call_api",
kjellanderc76dc952016-06-03 03:09:32 -0700167 "../base:rtc_base_approved",
kjellander82a94492016-06-12 22:12:01 -0700168 "../call",
kjellander82a94492016-06-12 22:12:01 -0700169 "../modules/video_coding",
kjellanderc76dc952016-06-03 03:09:32 -0700170 "../p2p",
171 "../system_wrappers",
kjellander82a94492016-06-12 22:12:01 -0700172 "../video",
kjellanderc76dc952016-06-03 03:09:32 -0700173 "../voice_engine",
174 ]
175}
kjellander82a94492016-06-12 22:12:01 -0700176
177if (rtc_include_tests) {
178 config("rtc_unittest_main_config") {
179 # GN orders flags on a target before flags from configs. The default config
180 # adds -Wall, and this flag have to be after -Wall -- so they need to
181 # come from a config and can"t be on the target directly.
182 if (is_clang && is_ios) {
183 cflags = [ "-Wno-unused-variable" ]
184 }
185 }
186
ehmaldonado38a21322016-09-02 04:10:34 -0700187 rtc_source_set("rtc_unittest_main") {
kjellander82a94492016-06-12 22:12:01 -0700188 testonly = true
189
kjellanderec5c9062016-08-19 01:07:30 -0700190 include_dirs = []
191 public_deps = []
kjellander82a94492016-06-12 22:12:01 -0700192 deps = []
193 sources = [
194 "base/fakemediaengine.h",
195 "base/fakenetworkinterface.h",
196 "base/fakertp.h",
197 "base/fakevideocapturer.h",
198 "base/fakevideorenderer.h",
hbosb24b1ce2016-08-16 01:19:43 -0700199 "base/test/mock_mediachannel.h",
kjellander82a94492016-06-12 22:12:01 -0700200 "base/testutils.cc",
201 "base/testutils.h",
202 "engine/fakewebrtccall.cc",
203 "engine/fakewebrtccall.h",
kjellander82a94492016-06-12 22:12:01 -0700204 "engine/fakewebrtcdeviceinfo.h",
205 "engine/fakewebrtcvcmfactory.h",
206 "engine/fakewebrtcvideocapturemodule.h",
207 "engine/fakewebrtcvideoengine.h",
208 "engine/fakewebrtcvoiceengine.h",
209 ]
210
ehmaldonado7a2ce0b2016-09-05 01:35:44 -0700211 configs += [ ":rtc_unittest_main_config" ]
kjellander82a94492016-06-12 22:12:01 -0700212
213 if (rtc_build_libyuv) {
214 deps += [ "$rtc_libyuv_dir" ]
kjellanderec5c9062016-08-19 01:07:30 -0700215 public_deps += [ "$rtc_libyuv_dir" ]
kjellander82a94492016-06-12 22:12:01 -0700216 } else {
217 # Need to add a directory normally exported by libyuv.
218 include_dirs += [ "$rtc_libyuv_dir/include" ]
219 }
220
kjellandere40a7ee2016-10-16 23:56:12 -0700221 if (!build_with_chromium && is_clang) {
222 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
ehmaldonado38a21322016-09-02 04:10:34 -0700223 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellander82a94492016-06-12 22:12:01 -0700224 }
225
226 deps += [
227 "../base:rtc_base_tests_utils",
228 "//testing/gtest",
229 ]
230 public_deps += [ "//testing/gmock" ]
231 }
232
233 config("rtc_media_unittests_config") {
234 # GN orders flags on a target before flags from configs. The default config
235 # adds -Wall, and this flag have to be after -Wall -- so they need to
236 # come from a config and can"t be on the target directly.
237 # TODO(kjellander): Make the code compile without disabling these flags.
238 # See https://bugs.webrtc.org/3307.
239 if (is_clang && is_win) {
ehmaldonadod02fe4b2016-08-26 13:31:24 -0700240 cflags = [
241 # See https://bugs.chromium.org/p/webrtc/issues/detail?id=6266
242 # for -Wno-sign-compare
243 "-Wno-sign-compare",
244 "-Wno-unused-function",
245 ]
kjellander82a94492016-06-12 22:12:01 -0700246 }
247 if (!is_win) {
248 cflags = [ "-Wno-sign-compare" ]
kjellander82a94492016-06-12 22:12:01 -0700249 }
250 }
251
ehmaldonado3a7f35b2016-09-14 05:10:01 -0700252 rtc_media_unittests_resources = [
253 "//resources/media/captured-320x240-2s-48.frames",
254 "//resources/media/faces.1280x720_P420.yuv",
255 "//resources/media/faces_I420.jpg",
256 "//resources/media/faces_I422.jpg",
257 "//resources/media/faces_I444.jpg",
258 "//resources/media/faces_I411.jpg",
259 "//resources/media/faces_I400.jpg",
260 ]
kjellander32c4a202016-08-30 02:53:49 -0700261
262 if (is_ios) {
263 bundle_data("rtc_media_unittests_bundle_data") {
264 testonly = true
265 sources = rtc_media_unittests_resources
266 outputs = [
267 "{{bundle_resources_dir}}/{{source_file_part}}",
268 ]
269 }
270 }
271
ehmaldonado38a21322016-09-02 04:10:34 -0700272 rtc_test("rtc_media_unittests") {
kjellander82a94492016-06-12 22:12:01 -0700273 testonly = true
274
johan073ece42016-08-26 02:59:47 -0700275 defines = []
kjellander82a94492016-06-12 22:12:01 -0700276 deps = []
277 sources = [
278 "base/codec_unittest.cc",
279 "base/rtpdataengine_unittest.cc",
280 "base/rtpdump_unittest.cc",
281 "base/rtputils_unittest.cc",
282 "base/streamparams_unittest.cc",
283 "base/turnutils_unittest.cc",
284 "base/videoadapter_unittest.cc",
285 "base/videobroadcaster_unittest.cc",
286 "base/videocapturer_unittest.cc",
287 "base/videocommon_unittest.cc",
288 "base/videoengine_unittest.h",
kjellander82a94492016-06-12 22:12:01 -0700289 "engine/nullwebrtcvideoengine_unittest.cc",
ossuc54071d2016-08-17 02:45:41 -0700290 "engine/payload_type_mapper_unittest.cc",
kjellander82a94492016-06-12 22:12:01 -0700291 "engine/simulcast_unittest.cc",
292 "engine/webrtcmediaengine_unittest.cc",
293 "engine/webrtcvideocapturer_unittest.cc",
294 "engine/webrtcvideoengine2_unittest.cc",
kjellander82a94492016-06-12 22:12:01 -0700295 "engine/webrtcvoiceengine_unittest.cc",
296 "sctp/sctpdataengine_unittest.cc",
297 ]
298
ehmaldonado7a2ce0b2016-09-05 01:35:44 -0700299 configs += [ ":rtc_media_unittests_config" ]
kjellander82a94492016-06-12 22:12:01 -0700300
johan073ece42016-08-26 02:59:47 -0700301 if (rtc_use_h264) {
302 defines += [ "WEBRTC_USE_H264" ]
303 }
kjellander82a94492016-06-12 22:12:01 -0700304 if (is_win) {
305 cflags = [
306 "/wd4245", # conversion from int to size_t, signed/unsigned mismatch.
307 "/wd4373", # virtual function override.
308 "/wd4389", # signed/unsigned mismatch.
309 ]
310 }
311
kjellandere40a7ee2016-10-16 23:56:12 -0700312 if (!build_with_chromium && is_clang) {
ehmaldonado38a21322016-09-02 04:10:34 -0700313 suppressed_configs += [
kjellander82a94492016-06-12 22:12:01 -0700314 "//build/config/clang:extra_warnings",
kjellandere40a7ee2016-10-16 23:56:12 -0700315
316 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
kjellander82a94492016-06-12 22:12:01 -0700317 "//build/config/clang:find_bad_constructs",
318 ]
319 }
320
ehmaldonado3a7f35b2016-09-14 05:10:01 -0700321 data = rtc_media_unittests_resources
322
kjellander82a94492016-06-12 22:12:01 -0700323 if (is_android) {
324 deps += [ "//testing/android/native_test:native_test_support" ]
kjellander28a0ffd2016-08-24 07:48:42 -0700325 shard_timeout = 900
326 }
kjellander32c4a202016-08-30 02:53:49 -0700327
328 if (is_ios) {
329 deps += [ ":rtc_media_unittests_bundle_data" ]
kjellander82a94492016-06-12 22:12:01 -0700330 }
331
332 deps += [
333 # TODO(kjellander): Move as part of work in bugs.webrtc.org/4243.
334 ":rtc_media",
335 ":rtc_unittest_main",
336 "../audio",
337 "../base:rtc_base_tests_utils",
aleloi5de52fd2016-11-10 01:05:34 -0800338 "../modules/audio_device:mock_audio_device",
kjellander82a94492016-06-12 22:12:01 -0700339 "../system_wrappers:metrics_default",
340 ]
341 }
342}