kjellander | c76dc95 | 2016-06-03 10:09:32 | [diff] [blame] | 1 | # 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 | |
| 9 | import("//build/config/linux/pkg_config.gni") |
| 10 | import("../build/webrtc.gni") |
kjellander | 82a9449 | 2016-06-13 05:12:01 | [diff] [blame] | 11 | import("//testing/test.gni") |
kjellander | c76dc95 | 2016-06-03 10:09:32 | [diff] [blame] | 12 | |
| 13 | group("media") { |
| 14 | deps = [ |
| 15 | ":rtc_media", |
| 16 | ] |
| 17 | } |
| 18 | |
| 19 | config("rtc_media_defines_config") { |
| 20 | defines = [ |
| 21 | "HAVE_WEBRTC_VIDEO", |
| 22 | "HAVE_WEBRTC_VOICE", |
| 23 | ] |
| 24 | } |
| 25 | |
| 26 | config("rtc_media_warnings_config") { |
| 27 | # GN orders flags on a target before flags from configs. The default config |
| 28 | # adds these flags so to cancel them out they need to come from a config and |
| 29 | # cannot be on the target directly. |
| 30 | if (!is_win) { |
| 31 | cflags = [ "-Wno-deprecated-declarations" ] |
| 32 | cflags_cc = [ "-Wno-overloaded-virtual" ] |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | if (is_linux && rtc_use_gtk) { |
| 37 | pkg_config("gtk-lib") { |
| 38 | packages = [ |
| 39 | "gobject-2.0", |
| 40 | "gthread-2.0", |
| 41 | "gtk+-2.0", |
| 42 | ] |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | source_set("rtc_media") { |
| 47 | defines = [] |
| 48 | libs = [] |
| 49 | deps = [] |
| 50 | sources = [ |
| 51 | "base/audiosource.h", |
| 52 | "base/codec.cc", |
| 53 | "base/codec.h", |
| 54 | "base/cpuid.cc", |
| 55 | "base/cpuid.h", |
| 56 | "base/cryptoparams.h", |
| 57 | "base/device.h", |
| 58 | "base/fakescreencapturerfactory.h", |
| 59 | "base/hybriddataengine.h", |
| 60 | "base/mediachannel.h", |
| 61 | "base/mediacommon.h", |
| 62 | "base/mediaconstants.cc", |
| 63 | "base/mediaconstants.h", |
| 64 | "base/mediaengine.cc", |
| 65 | "base/mediaengine.h", |
| 66 | "base/rtpdataengine.cc", |
| 67 | "base/rtpdataengine.h", |
| 68 | "base/rtpdump.cc", |
| 69 | "base/rtpdump.h", |
| 70 | "base/rtputils.cc", |
| 71 | "base/rtputils.h", |
| 72 | "base/screencastid.h", |
| 73 | "base/streamparams.cc", |
| 74 | "base/streamparams.h", |
| 75 | "base/turnutils.cc", |
| 76 | "base/turnutils.h", |
| 77 | "base/videoadapter.cc", |
| 78 | "base/videoadapter.h", |
| 79 | "base/videobroadcaster.cc", |
| 80 | "base/videobroadcaster.h", |
| 81 | "base/videocapturer.cc", |
| 82 | "base/videocapturer.h", |
| 83 | "base/videocapturerfactory.h", |
| 84 | "base/videocommon.cc", |
| 85 | "base/videocommon.h", |
| 86 | "base/videoframe.cc", |
| 87 | "base/videoframe.h", |
| 88 | "base/videoframefactory.cc", |
| 89 | "base/videoframefactory.h", |
| 90 | "base/videorenderer.h", |
| 91 | "base/videosourcebase.cc", |
| 92 | "base/videosourcebase.h", |
kjellander | c76dc95 | 2016-06-03 10:09:32 | [diff] [blame] | 93 | "devices/videorendererfactory.h", |
| 94 | "engine/nullwebrtcvideoengine.h", |
ossu | 6f06cca | 2016-07-13 17:06:22 | [diff] [blame] | 95 | "engine/payload_type_mapper.cc", |
| 96 | "engine/payload_type_mapper.h", |
kjellander | c76dc95 | 2016-06-03 10:09:32 | [diff] [blame] | 97 | "engine/simulcast.cc", |
| 98 | "engine/simulcast.h", |
| 99 | "engine/webrtccommon.h", |
| 100 | "engine/webrtcmediaengine.cc", |
| 101 | "engine/webrtcmediaengine.h", |
| 102 | "engine/webrtcvideocapturer.cc", |
| 103 | "engine/webrtcvideocapturer.h", |
| 104 | "engine/webrtcvideocapturerfactory.cc", |
| 105 | "engine/webrtcvideocapturerfactory.h", |
| 106 | "engine/webrtcvideodecoderfactory.h", |
| 107 | "engine/webrtcvideoencoderfactory.h", |
| 108 | "engine/webrtcvideoengine2.cc", |
| 109 | "engine/webrtcvideoengine2.h", |
| 110 | "engine/webrtcvideoframe.cc", |
| 111 | "engine/webrtcvideoframe.h", |
| 112 | "engine/webrtcvideoframefactory.cc", |
| 113 | "engine/webrtcvideoframefactory.h", |
| 114 | "engine/webrtcvoe.h", |
| 115 | "engine/webrtcvoiceengine.cc", |
| 116 | "engine/webrtcvoiceengine.h", |
| 117 | "sctp/sctpdataengine.cc", |
| 118 | "sctp/sctpdataengine.h", |
| 119 | ] |
| 120 | |
| 121 | configs += [ |
| 122 | "..:common_config", |
| 123 | ":rtc_media_warnings_config", |
| 124 | ] |
| 125 | |
| 126 | public_configs = [ "..:common_inherited_config" ] |
| 127 | |
| 128 | if (is_clang) { |
kjellander | 82a9449 | 2016-06-13 05:12:01 | [diff] [blame] | 129 | # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163). |
| 130 | configs -= [ |
| 131 | "//build/config/clang:extra_warnings", |
| 132 | "//build/config/clang:find_bad_constructs", |
| 133 | ] |
kjellander | c76dc95 | 2016-06-03 10:09:32 | [diff] [blame] | 134 | } |
| 135 | |
| 136 | if (is_win) { |
| 137 | cflags = [ |
| 138 | "/wd4245", # conversion from "int" to "size_t", signed/unsigned mismatch. |
| 139 | "/wd4267", # conversion from "size_t" to "int", possible loss of data. |
| 140 | "/wd4389", # signed/unsigned mismatch. |
| 141 | ] |
| 142 | } |
| 143 | |
peah | 1bcfce5 | 2016-08-26 14:16:04 | [diff] [blame^] | 144 | if (rtc_enable_intelligibility_enhancer) { |
| 145 | defines += [ "WEBRTC_INTELLIGIBILITY_ENHANCER=1" ] |
| 146 | } else { |
| 147 | defines += [ "WEBRTC_INTELLIGIBILITY_ENHANCER=0" ] |
| 148 | } |
| 149 | |
kjellander | ec5c906 | 2016-08-19 08:07:30 | [diff] [blame] | 150 | include_dirs = [] |
kjellander | c76dc95 | 2016-06-03 10:09:32 | [diff] [blame] | 151 | if (rtc_build_libyuv) { |
| 152 | deps += [ "$rtc_libyuv_dir" ] |
| 153 | public_deps = [ |
| 154 | "$rtc_libyuv_dir", |
| 155 | ] |
| 156 | } else { |
| 157 | # Need to add a directory normally exported by libyuv. |
| 158 | include_dirs += [ "$rtc_libyuv_dir/include" ] |
| 159 | } |
| 160 | |
| 161 | if (rtc_build_usrsctp) { |
kjellander | ec5c906 | 2016-08-19 08:07:30 | [diff] [blame] | 162 | include_dirs += [ |
kjellander | c76dc95 | 2016-06-03 10:09:32 | [diff] [blame] | 163 | # TODO(jiayl): move this into the public_configs of |
| 164 | # //third_party/usrsctp/BUILD.gn. |
| 165 | "//third_party/usrsctp/usrsctplib", |
| 166 | ] |
| 167 | deps += [ "//third_party/usrsctp" ] |
| 168 | } |
| 169 | |
| 170 | if (build_with_chromium) { |
| 171 | deps += [ "../modules/video_capture:video_capture" ] |
| 172 | } else { |
kjellander | c76dc95 | 2016-06-03 10:09:32 | [diff] [blame] | 173 | public_configs += [ ":rtc_media_defines_config" ] |
| 174 | deps += [ "../modules/video_capture:video_capture_internal_impl" ] |
| 175 | } |
| 176 | if (is_linux && rtc_use_gtk) { |
| 177 | sources += [ |
| 178 | "devices/gtkvideorenderer.cc", |
| 179 | "devices/gtkvideorenderer.h", |
| 180 | ] |
| 181 | public_configs += [ ":gtk-lib" ] |
| 182 | } |
| 183 | if (is_win) { |
| 184 | sources += [ |
| 185 | "devices/gdivideorenderer.cc", |
| 186 | "devices/gdivideorenderer.h", |
| 187 | ] |
| 188 | libs += [ |
| 189 | "d3d9.lib", |
| 190 | "gdi32.lib", |
| 191 | "strmiids.lib", |
| 192 | ] |
| 193 | } |
| 194 | if (is_mac && current_cpu == "x86") { |
| 195 | sources += [ |
| 196 | "devices/carbonvideorenderer.cc", |
| 197 | "devices/carbonvideorenderer.h", |
| 198 | ] |
| 199 | libs += [ "Carbon.framework" ] |
| 200 | } |
| 201 | if (is_ios || (is_mac && current_cpu != "x86")) { |
| 202 | defines += [ "CARBON_DEPRECATED=YES" ] |
| 203 | } |
| 204 | |
| 205 | deps += [ |
| 206 | "..:webrtc_common", |
| 207 | "../base:rtc_base_approved", |
kjellander | 82a9449 | 2016-06-13 05:12:01 | [diff] [blame] | 208 | "../call", |
kjellander | c76dc95 | 2016-06-03 10:09:32 | [diff] [blame] | 209 | "../libjingle/xmllite", |
| 210 | "../libjingle/xmpp", |
kjellander | 82a9449 | 2016-06-13 05:12:01 | [diff] [blame] | 211 | "../modules/video_coding", |
kjellander | c76dc95 | 2016-06-03 10:09:32 | [diff] [blame] | 212 | "../p2p", |
| 213 | "../system_wrappers", |
kjellander | 82a9449 | 2016-06-13 05:12:01 | [diff] [blame] | 214 | "../video", |
kjellander | c76dc95 | 2016-06-03 10:09:32 | [diff] [blame] | 215 | "../voice_engine", |
| 216 | ] |
| 217 | } |
kjellander | 82a9449 | 2016-06-13 05:12:01 | [diff] [blame] | 218 | |
| 219 | if (rtc_include_tests) { |
| 220 | config("rtc_unittest_main_config") { |
| 221 | # GN orders flags on a target before flags from configs. The default config |
| 222 | # adds -Wall, and this flag have to be after -Wall -- so they need to |
| 223 | # come from a config and can"t be on the target directly. |
| 224 | if (is_clang && is_ios) { |
| 225 | cflags = [ "-Wno-unused-variable" ] |
| 226 | } |
| 227 | } |
| 228 | |
| 229 | source_set("rtc_unittest_main") { |
| 230 | testonly = true |
| 231 | |
kjellander | ec5c906 | 2016-08-19 08:07:30 | [diff] [blame] | 232 | include_dirs = [] |
| 233 | public_deps = [] |
kjellander | 82a9449 | 2016-06-13 05:12:01 | [diff] [blame] | 234 | deps = [] |
| 235 | sources = [ |
| 236 | "base/fakemediaengine.h", |
| 237 | "base/fakenetworkinterface.h", |
| 238 | "base/fakertp.h", |
| 239 | "base/fakevideocapturer.h", |
| 240 | "base/fakevideorenderer.h", |
hbos | b24b1ce | 2016-08-16 08:19:43 | [diff] [blame] | 241 | "base/test/mock_mediachannel.h", |
kjellander | 82a9449 | 2016-06-13 05:12:01 | [diff] [blame] | 242 | "base/testutils.cc", |
| 243 | "base/testutils.h", |
| 244 | "engine/fakewebrtccall.cc", |
| 245 | "engine/fakewebrtccall.h", |
| 246 | "engine/fakewebrtccommon.h", |
| 247 | "engine/fakewebrtcdeviceinfo.h", |
| 248 | "engine/fakewebrtcvcmfactory.h", |
| 249 | "engine/fakewebrtcvideocapturemodule.h", |
| 250 | "engine/fakewebrtcvideoengine.h", |
| 251 | "engine/fakewebrtcvoiceengine.h", |
| 252 | ] |
| 253 | |
| 254 | configs += [ |
| 255 | "..:common_config", |
| 256 | ":rtc_unittest_main_config", |
| 257 | ] |
| 258 | public_configs = [ "..:common_inherited_config" ] |
| 259 | |
| 260 | if (rtc_build_libyuv) { |
| 261 | deps += [ "$rtc_libyuv_dir" ] |
kjellander | ec5c906 | 2016-08-19 08:07:30 | [diff] [blame] | 262 | public_deps += [ "$rtc_libyuv_dir" ] |
kjellander | 82a9449 | 2016-06-13 05:12:01 | [diff] [blame] | 263 | } else { |
| 264 | # Need to add a directory normally exported by libyuv. |
| 265 | include_dirs += [ "$rtc_libyuv_dir/include" ] |
| 266 | } |
| 267 | |
| 268 | if (is_clang) { |
| 269 | # Suppress warnings from the Chromium Clang plugin. |
| 270 | # See http://code.google.com/p/webrtc/issues/detail?id=163 for details. |
| 271 | configs -= [ "//build/config/clang:find_bad_constructs" ] |
| 272 | } |
| 273 | |
| 274 | deps += [ |
| 275 | "../base:rtc_base_tests_utils", |
| 276 | "//testing/gtest", |
| 277 | ] |
| 278 | public_deps += [ "//testing/gmock" ] |
| 279 | } |
| 280 | |
| 281 | config("rtc_media_unittests_config") { |
| 282 | # GN orders flags on a target before flags from configs. The default config |
| 283 | # adds -Wall, and this flag have to be after -Wall -- so they need to |
| 284 | # come from a config and can"t be on the target directly. |
| 285 | # TODO(kjellander): Make the code compile without disabling these flags. |
| 286 | # See https://bugs.webrtc.org/3307. |
| 287 | if (is_clang && is_win) { |
ehmaldonado | 4bc4d27 | 2016-08-25 11:15:40 | [diff] [blame] | 288 | cflags = [ "-Wno-unused-function" ] |
kjellander | 82a9449 | 2016-06-13 05:12:01 | [diff] [blame] | 289 | } |
| 290 | if (!is_win) { |
| 291 | cflags = [ "-Wno-sign-compare" ] |
| 292 | cflags_cc = [ "-Wno-overloaded-virtual" ] |
| 293 | } |
| 294 | } |
| 295 | |
| 296 | test("rtc_media_unittests") { |
| 297 | testonly = true |
| 298 | |
johan | 073ece4 | 2016-08-26 09:59:47 | [diff] [blame] | 299 | defines = [] |
kjellander | 82a9449 | 2016-06-13 05:12:01 | [diff] [blame] | 300 | deps = [] |
| 301 | sources = [ |
| 302 | "base/codec_unittest.cc", |
| 303 | "base/rtpdataengine_unittest.cc", |
| 304 | "base/rtpdump_unittest.cc", |
| 305 | "base/rtputils_unittest.cc", |
| 306 | "base/streamparams_unittest.cc", |
| 307 | "base/turnutils_unittest.cc", |
| 308 | "base/videoadapter_unittest.cc", |
| 309 | "base/videobroadcaster_unittest.cc", |
| 310 | "base/videocapturer_unittest.cc", |
| 311 | "base/videocommon_unittest.cc", |
| 312 | "base/videoengine_unittest.h", |
| 313 | "base/videoframe_unittest.h", |
| 314 | "engine/nullwebrtcvideoengine_unittest.cc", |
ossu | c54071d | 2016-08-17 09:45:41 | [diff] [blame] | 315 | "engine/payload_type_mapper_unittest.cc", |
kjellander | 82a9449 | 2016-06-13 05:12:01 | [diff] [blame] | 316 | "engine/simulcast_unittest.cc", |
| 317 | "engine/webrtcmediaengine_unittest.cc", |
| 318 | "engine/webrtcvideocapturer_unittest.cc", |
| 319 | "engine/webrtcvideoengine2_unittest.cc", |
| 320 | "engine/webrtcvideoframe_unittest.cc", |
| 321 | "engine/webrtcvideoframefactory_unittest.cc", |
| 322 | "engine/webrtcvoiceengine_unittest.cc", |
| 323 | "sctp/sctpdataengine_unittest.cc", |
| 324 | ] |
| 325 | |
| 326 | configs += [ |
| 327 | "..:common_config", |
| 328 | ":rtc_media_unittests_config", |
| 329 | ] |
| 330 | public_configs = [ "..:common_inherited_config" ] |
| 331 | |
johan | 073ece4 | 2016-08-26 09:59:47 | [diff] [blame] | 332 | if (rtc_use_h264) { |
| 333 | defines += [ "WEBRTC_USE_H264" ] |
| 334 | } |
kjellander | 82a9449 | 2016-06-13 05:12:01 | [diff] [blame] | 335 | if (is_win) { |
| 336 | cflags = [ |
| 337 | "/wd4245", # conversion from int to size_t, signed/unsigned mismatch. |
| 338 | "/wd4373", # virtual function override. |
| 339 | "/wd4389", # signed/unsigned mismatch. |
| 340 | ] |
| 341 | } |
| 342 | |
| 343 | if (is_clang) { |
| 344 | # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163). |
| 345 | configs -= [ |
| 346 | "//build/config/clang:extra_warnings", |
| 347 | "//build/config/clang:find_bad_constructs", |
| 348 | ] |
| 349 | } |
| 350 | |
| 351 | if (is_android) { |
| 352 | deps += [ "//testing/android/native_test:native_test_support" ] |
kjellander | 28a0ffd | 2016-08-24 14:48:42 | [diff] [blame] | 353 | shard_timeout = 900 |
| 354 | } |
| 355 | if (is_android || is_ios) { |
kjellander | 82a9449 | 2016-06-13 05:12:01 | [diff] [blame] | 356 | data = [ |
| 357 | "//resources/media/captured-320x240-2s-48.frames", |
| 358 | "//resources/media/faces.1280x720_P420.yuv", |
| 359 | "//resources/media/faces_I420.jpg", |
| 360 | "//resources/media/faces_I422.jpg", |
| 361 | "//resources/media/faces_I444.jpg", |
| 362 | "//resources/media/faces_I411.jpg", |
| 363 | "//resources/media/faces_I400.jpg", |
| 364 | ] |
| 365 | } |
| 366 | |
| 367 | deps += [ |
| 368 | # TODO(kjellander): Move as part of work in bugs.webrtc.org/4243. |
| 369 | ":rtc_media", |
| 370 | ":rtc_unittest_main", |
| 371 | "../audio", |
| 372 | "../base:rtc_base_tests_utils", |
| 373 | "../system_wrappers:metrics_default", |
| 374 | ] |
| 375 | } |
| 376 | } |