blob: 590450bd296f0ab0ff97ab4e63e86b9a08ea423d [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",
magjed614d5b72016-11-15 06:30:54 -080091 "engine/videoencodersoftwarefallbackwrapper.cc",
92 "engine/videoencodersoftwarefallbackwrapper.h",
kjellanderc76dc952016-06-03 03:09:32 -070093 "engine/webrtccommon.h",
94 "engine/webrtcmediaengine.cc",
95 "engine/webrtcmediaengine.h",
96 "engine/webrtcvideocapturer.cc",
97 "engine/webrtcvideocapturer.h",
98 "engine/webrtcvideocapturerfactory.cc",
99 "engine/webrtcvideocapturerfactory.h",
100 "engine/webrtcvideodecoderfactory.h",
magjed1e45cc62016-10-28 07:43:45 -0700101 "engine/webrtcvideoencoderfactory.cc",
kjellanderc76dc952016-06-03 03:09:32 -0700102 "engine/webrtcvideoencoderfactory.h",
103 "engine/webrtcvideoengine2.cc",
104 "engine/webrtcvideoengine2.h",
kjellanderc76dc952016-06-03 03:09:32 -0700105 "engine/webrtcvideoframe.h",
kjellanderc76dc952016-06-03 03:09:32 -0700106 "engine/webrtcvoe.h",
107 "engine/webrtcvoiceengine.cc",
108 "engine/webrtcvoiceengine.h",
109 "sctp/sctpdataengine.cc",
110 "sctp/sctpdataengine.h",
111 ]
112
ehmaldonado7a2ce0b2016-09-05 01:35:44 -0700113 configs += [ ":rtc_media_warnings_config" ]
kjellanderc76dc952016-06-03 03:09:32 -0700114
kjellandere40a7ee2016-10-16 23:56:12 -0700115 if (!build_with_chromium && is_clang) {
kjellander82a94492016-06-12 22:12:01 -0700116 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
kjellander660312b2016-09-26 06:11:53 -0700117 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellanderc76dc952016-06-03 03:09:32 -0700118 }
119
120 if (is_win) {
121 cflags = [
122 "/wd4245", # conversion from "int" to "size_t", signed/unsigned mismatch.
123 "/wd4267", # conversion from "size_t" to "int", possible loss of data.
124 "/wd4389", # signed/unsigned mismatch.
125 ]
126 }
127
peah1bcfce52016-08-26 07:16:04 -0700128 if (rtc_enable_intelligibility_enhancer) {
129 defines += [ "WEBRTC_INTELLIGIBILITY_ENHANCER=1" ]
130 } else {
131 defines += [ "WEBRTC_INTELLIGIBILITY_ENHANCER=0" ]
132 }
133
kjellanderec5c9062016-08-19 01:07:30 -0700134 include_dirs = []
kjellanderc76dc952016-06-03 03:09:32 -0700135 if (rtc_build_libyuv) {
136 deps += [ "$rtc_libyuv_dir" ]
137 public_deps = [
138 "$rtc_libyuv_dir",
139 ]
140 } else {
141 # Need to add a directory normally exported by libyuv.
142 include_dirs += [ "$rtc_libyuv_dir/include" ]
143 }
144
145 if (rtc_build_usrsctp) {
kjellanderec5c9062016-08-19 01:07:30 -0700146 include_dirs += [
kjellanderc76dc952016-06-03 03:09:32 -0700147 # TODO(jiayl): move this into the public_configs of
148 # //third_party/usrsctp/BUILD.gn.
149 "//third_party/usrsctp/usrsctplib",
150 ]
151 deps += [ "//third_party/usrsctp" ]
152 }
153
ehmaldonadoe9cc6862016-09-05 06:10:18 -0700154 public_configs = []
kjellanderc76dc952016-06-03 03:09:32 -0700155 if (build_with_chromium) {
156 deps += [ "../modules/video_capture:video_capture" ]
157 } else {
kjellanderc76dc952016-06-03 03:09:32 -0700158 public_configs += [ ":rtc_media_defines_config" ]
159 deps += [ "../modules/video_capture:video_capture_internal_impl" ]
160 }
161 if (is_linux && rtc_use_gtk) {
162 sources += [
163 "devices/gtkvideorenderer.cc",
164 "devices/gtkvideorenderer.h",
165 ]
166 public_configs += [ ":gtk-lib" ]
167 }
kjellanderc76dc952016-06-03 03:09:32 -0700168 deps += [
169 "..:webrtc_common",
kjellandera69d9732016-08-31 07:33:05 -0700170 "../api:call_api",
kjellanderc76dc952016-06-03 03:09:32 -0700171 "../base:rtc_base_approved",
kjellander82a94492016-06-12 22:12:01 -0700172 "../call",
aleloi10111bc2016-11-17 06:48:48 -0800173 "../modules/audio_mixer:audio_mixer_impl",
kjellander82a94492016-06-12 22:12:01 -0700174 "../modules/video_coding",
magjed0d0d7532016-11-17 07:51:30 -0800175 "../p2p",
kjellanderc76dc952016-06-03 03:09:32 -0700176 "../system_wrappers",
magjed0d0d7532016-11-17 07:51:30 -0800177 "../video",
kjellanderc76dc952016-06-03 03:09:32 -0700178 "../voice_engine",
179 ]
180}
kjellander82a94492016-06-12 22:12:01 -0700181
182if (rtc_include_tests) {
183 config("rtc_unittest_main_config") {
184 # GN orders flags on a target before flags from configs. The default config
185 # adds -Wall, and this flag have to be after -Wall -- so they need to
186 # come from a config and can"t be on the target directly.
187 if (is_clang && is_ios) {
188 cflags = [ "-Wno-unused-variable" ]
189 }
190 }
191
ehmaldonado38a21322016-09-02 04:10:34 -0700192 rtc_source_set("rtc_unittest_main") {
kjellander82a94492016-06-12 22:12:01 -0700193 testonly = true
194
kjellanderec5c9062016-08-19 01:07:30 -0700195 include_dirs = []
196 public_deps = []
kjellander82a94492016-06-12 22:12:01 -0700197 deps = []
198 sources = [
199 "base/fakemediaengine.h",
200 "base/fakenetworkinterface.h",
201 "base/fakertp.h",
202 "base/fakevideocapturer.h",
203 "base/fakevideorenderer.h",
hbosb24b1ce2016-08-16 01:19:43 -0700204 "base/test/mock_mediachannel.h",
kjellander82a94492016-06-12 22:12:01 -0700205 "base/testutils.cc",
206 "base/testutils.h",
207 "engine/fakewebrtccall.cc",
208 "engine/fakewebrtccall.h",
kjellander82a94492016-06-12 22:12:01 -0700209 "engine/fakewebrtcdeviceinfo.h",
210 "engine/fakewebrtcvcmfactory.h",
211 "engine/fakewebrtcvideocapturemodule.h",
212 "engine/fakewebrtcvideoengine.h",
213 "engine/fakewebrtcvoiceengine.h",
214 ]
215
ehmaldonado7a2ce0b2016-09-05 01:35:44 -0700216 configs += [ ":rtc_unittest_main_config" ]
kjellander82a94492016-06-12 22:12:01 -0700217
218 if (rtc_build_libyuv) {
219 deps += [ "$rtc_libyuv_dir" ]
kjellanderec5c9062016-08-19 01:07:30 -0700220 public_deps += [ "$rtc_libyuv_dir" ]
kjellander82a94492016-06-12 22:12:01 -0700221 } else {
222 # Need to add a directory normally exported by libyuv.
223 include_dirs += [ "$rtc_libyuv_dir/include" ]
224 }
225
kjellandere40a7ee2016-10-16 23:56:12 -0700226 if (!build_with_chromium && is_clang) {
227 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
ehmaldonado38a21322016-09-02 04:10:34 -0700228 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellander82a94492016-06-12 22:12:01 -0700229 }
230
231 deps += [
232 "../base:rtc_base_tests_utils",
233 "//testing/gtest",
234 ]
235 public_deps += [ "//testing/gmock" ]
236 }
237
238 config("rtc_media_unittests_config") {
239 # GN orders flags on a target before flags from configs. The default config
240 # adds -Wall, and this flag have to be after -Wall -- so they need to
241 # come from a config and can"t be on the target directly.
242 # TODO(kjellander): Make the code compile without disabling these flags.
243 # See https://bugs.webrtc.org/3307.
244 if (is_clang && is_win) {
ehmaldonadod02fe4b2016-08-26 13:31:24 -0700245 cflags = [
246 # See https://bugs.chromium.org/p/webrtc/issues/detail?id=6266
247 # for -Wno-sign-compare
248 "-Wno-sign-compare",
249 "-Wno-unused-function",
250 ]
kjellander82a94492016-06-12 22:12:01 -0700251 }
252 if (!is_win) {
253 cflags = [ "-Wno-sign-compare" ]
kjellander82a94492016-06-12 22:12:01 -0700254 }
255 }
256
ehmaldonado3a7f35b2016-09-14 05:10:01 -0700257 rtc_media_unittests_resources = [
258 "//resources/media/captured-320x240-2s-48.frames",
259 "//resources/media/faces.1280x720_P420.yuv",
260 "//resources/media/faces_I420.jpg",
261 "//resources/media/faces_I422.jpg",
262 "//resources/media/faces_I444.jpg",
263 "//resources/media/faces_I411.jpg",
264 "//resources/media/faces_I400.jpg",
265 ]
kjellander32c4a202016-08-30 02:53:49 -0700266
267 if (is_ios) {
268 bundle_data("rtc_media_unittests_bundle_data") {
269 testonly = true
270 sources = rtc_media_unittests_resources
271 outputs = [
272 "{{bundle_resources_dir}}/{{source_file_part}}",
273 ]
274 }
275 }
276
ehmaldonado38a21322016-09-02 04:10:34 -0700277 rtc_test("rtc_media_unittests") {
kjellander82a94492016-06-12 22:12:01 -0700278 testonly = true
279
johan073ece42016-08-26 02:59:47 -0700280 defines = []
kjellander82a94492016-06-12 22:12:01 -0700281 deps = []
282 sources = [
283 "base/codec_unittest.cc",
284 "base/rtpdataengine_unittest.cc",
285 "base/rtpdump_unittest.cc",
286 "base/rtputils_unittest.cc",
287 "base/streamparams_unittest.cc",
288 "base/turnutils_unittest.cc",
289 "base/videoadapter_unittest.cc",
290 "base/videobroadcaster_unittest.cc",
291 "base/videocapturer_unittest.cc",
292 "base/videocommon_unittest.cc",
293 "base/videoengine_unittest.h",
kjellander82a94492016-06-12 22:12:01 -0700294 "engine/nullwebrtcvideoengine_unittest.cc",
ossuc54071d2016-08-17 02:45:41 -0700295 "engine/payload_type_mapper_unittest.cc",
kjellander82a94492016-06-12 22:12:01 -0700296 "engine/simulcast_unittest.cc",
magjed614d5b72016-11-15 06:30:54 -0800297 "engine/videoencodersoftwarefallbackwrapper_unittest.cc",
kjellander82a94492016-06-12 22:12:01 -0700298 "engine/webrtcmediaengine_unittest.cc",
299 "engine/webrtcvideocapturer_unittest.cc",
300 "engine/webrtcvideoengine2_unittest.cc",
kjellander82a94492016-06-12 22:12:01 -0700301 "engine/webrtcvoiceengine_unittest.cc",
302 "sctp/sctpdataengine_unittest.cc",
303 ]
304
ehmaldonado7a2ce0b2016-09-05 01:35:44 -0700305 configs += [ ":rtc_media_unittests_config" ]
kjellander82a94492016-06-12 22:12:01 -0700306
johan073ece42016-08-26 02:59:47 -0700307 if (rtc_use_h264) {
308 defines += [ "WEBRTC_USE_H264" ]
309 }
kjellander82a94492016-06-12 22:12:01 -0700310 if (is_win) {
311 cflags = [
312 "/wd4245", # conversion from int to size_t, signed/unsigned mismatch.
313 "/wd4373", # virtual function override.
314 "/wd4389", # signed/unsigned mismatch.
315 ]
316 }
317
kjellandere40a7ee2016-10-16 23:56:12 -0700318 if (!build_with_chromium && is_clang) {
ehmaldonado38a21322016-09-02 04:10:34 -0700319 suppressed_configs += [
kjellander82a94492016-06-12 22:12:01 -0700320 "//build/config/clang:extra_warnings",
kjellandere40a7ee2016-10-16 23:56:12 -0700321
322 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
kjellander82a94492016-06-12 22:12:01 -0700323 "//build/config/clang:find_bad_constructs",
324 ]
325 }
326
ehmaldonado3a7f35b2016-09-14 05:10:01 -0700327 data = rtc_media_unittests_resources
328
kjellander82a94492016-06-12 22:12:01 -0700329 if (is_android) {
330 deps += [ "//testing/android/native_test:native_test_support" ]
kjellander28a0ffd2016-08-24 07:48:42 -0700331 shard_timeout = 900
332 }
kjellander32c4a202016-08-30 02:53:49 -0700333
334 if (is_ios) {
335 deps += [ ":rtc_media_unittests_bundle_data" ]
kjellander82a94492016-06-12 22:12:01 -0700336 }
337
338 deps += [
339 # TODO(kjellander): Move as part of work in bugs.webrtc.org/4243.
340 ":rtc_media",
341 ":rtc_unittest_main",
342 "../audio",
343 "../base:rtc_base_tests_utils",
aleloi5de52fd2016-11-10 01:05:34 -0800344 "../modules/audio_device:mock_audio_device",
kjellander82a94492016-06-12 22:12:01 -0700345 "../system_wrappers:metrics_default",
346 ]
347 }
348}