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