kjellander@webrtc.org | 1227ab8 | 2014-06-23 19:21:07 +0000 | [diff] [blame] | 1 | # Copyright (c) 2014 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/webrtc.gni") |
| 10 | |
mbonadei | 438062b | 2017-01-09 02:37:21 -0800 | [diff] [blame] | 11 | if (is_android) { |
| 12 | import("//build/config/android/config.gni") |
| 13 | import("//build/config/android/rules.gni") |
| 14 | } |
| 15 | |
kjellander@webrtc.org | c4870bb | 2014-09-01 04:24:11 +0000 | [diff] [blame] | 16 | config("audio_device_config") { |
| 17 | include_dirs = [ |
Henrik Kjellander | ff761fb | 2015-11-04 08:31:52 +0100 | [diff] [blame] | 18 | "../include", |
kjellander@webrtc.org | c4870bb | 2014-09-01 04:24:11 +0000 | [diff] [blame] | 19 | "include", |
| 20 | "dummy", # Contains dummy audio device implementations. |
| 21 | ] |
kjellander | 95177d1 | 2016-04-07 00:13:58 -0700 | [diff] [blame] | 22 | if (is_ios) { |
| 23 | # GN orders flags on a target before flags from configs. In order to be able |
| 24 | # suppress the -Wthread-safety-analysis warning, it has come from a config |
| 25 | # and can't be on the target directly. |
| 26 | # TODO(tkchin): Remove after fixing |
| 27 | # https://bugs.chromium.org/p/webrtc/issues/detail?id=5748 |
| 28 | cflags = [ "-Wno-thread-safety-analysis" ] |
| 29 | } |
kjellander@webrtc.org | 1227ab8 | 2014-06-23 19:21:07 +0000 | [diff] [blame] | 30 | } |
kjellander@webrtc.org | c4870bb | 2014-09-01 04:24:11 +0000 | [diff] [blame] | 31 | |
ehmaldonado | d02fe4b | 2016-08-26 13:31:24 -0700 | [diff] [blame] | 32 | config("audio_device_warnings_config") { |
| 33 | if (is_win && is_clang) { |
| 34 | cflags = [ |
| 35 | # Disable warnings failing when compiling with Clang on Windows. |
| 36 | # https://bugs.chromium.org/p/webrtc/issues/detail?id=5366 |
| 37 | "-Wno-bool-conversion", |
| 38 | "-Wno-delete-non-virtual-dtor", |
| 39 | "-Wno-logical-op-parentheses", |
| 40 | "-Wno-microsoft-extra-qualification", |
| 41 | "-Wno-microsoft-goto", |
| 42 | "-Wno-missing-braces", |
| 43 | "-Wno-parentheses-equality", |
| 44 | "-Wno-reorder", |
| 45 | "-Wno-shift-overflow", |
| 46 | "-Wno-tautological-compare", |
| 47 | |
| 48 | # See https://bugs.chromium.org/p/webrtc/issues/detail?id=6265 |
| 49 | # for -Wno-thread-safety-analysis |
| 50 | "-Wno-thread-safety-analysis", |
| 51 | "-Wno-unused-private-field", |
| 52 | ] |
| 53 | } |
| 54 | } |
| 55 | |
kjellander | b62dbbe | 2016-09-23 00:38:52 -0700 | [diff] [blame] | 56 | rtc_static_library("audio_device") { |
ehmaldonado | e9cc686 | 2016-09-05 06:10:18 -0700 | [diff] [blame] | 57 | public_configs = [ ":audio_device_config" ] |
ehmaldonado | d02fe4b | 2016-08-26 13:31:24 -0700 | [diff] [blame] | 58 | |
Zeke Chin | b3fb71c | 2016-02-18 15:44:07 -0800 | [diff] [blame] | 59 | deps = [ |
| 60 | "../..:webrtc_common", |
| 61 | "../../base:rtc_base_approved", |
maxmorin | 6910537 | 2016-08-16 02:17:44 -0700 | [diff] [blame] | 62 | "../../base:rtc_task_queue", |
Zeke Chin | b3fb71c | 2016-02-18 15:44:07 -0800 | [diff] [blame] | 63 | "../../common_audio", |
| 64 | "../../system_wrappers", |
| 65 | "../utility", |
| 66 | ] |
| 67 | |
kjellander@webrtc.org | c4870bb | 2014-09-01 04:24:11 +0000 | [diff] [blame] | 68 | sources = [ |
kjellander@webrtc.org | c4870bb | 2014-09-01 04:24:11 +0000 | [diff] [blame] | 69 | "audio_device_buffer.cc", |
| 70 | "audio_device_buffer.h", |
Henrik Kjellander | 57e5fd2 | 2015-05-25 12:55:39 +0200 | [diff] [blame] | 71 | "audio_device_config.h", |
kjellander@webrtc.org | c4870bb | 2014-09-01 04:24:11 +0000 | [diff] [blame] | 72 | "audio_device_generic.cc", |
| 73 | "audio_device_generic.h", |
kjellander@webrtc.org | c4870bb | 2014-09-01 04:24:11 +0000 | [diff] [blame] | 74 | "dummy/audio_device_dummy.cc", |
| 75 | "dummy/audio_device_dummy.h", |
kjellander@webrtc.org | c4870bb | 2014-09-01 04:24:11 +0000 | [diff] [blame] | 76 | "dummy/file_audio_device.cc", |
| 77 | "dummy/file_audio_device.h", |
henrika | 86d907c | 2015-09-07 16:09:50 +0200 | [diff] [blame] | 78 | "fine_audio_buffer.cc", |
| 79 | "fine_audio_buffer.h", |
Henrik Kjellander | 57e5fd2 | 2015-05-25 12:55:39 +0200 | [diff] [blame] | 80 | "include/audio_device.h", |
| 81 | "include/audio_device_defines.h", |
kjellander@webrtc.org | c4870bb | 2014-09-01 04:24:11 +0000 | [diff] [blame] | 82 | ] |
| 83 | |
kjellander@webrtc.org | c4870bb | 2014-09-01 04:24:11 +0000 | [diff] [blame] | 84 | include_dirs = [] |
| 85 | if (is_linux) { |
| 86 | include_dirs += [ "linux" ] |
| 87 | } |
| 88 | if (is_ios) { |
| 89 | include_dirs += [ "ios" ] |
| 90 | } |
| 91 | if (is_mac) { |
| 92 | include_dirs += [ "mac" ] |
| 93 | } |
| 94 | if (is_win) { |
| 95 | include_dirs += [ "win" ] |
| 96 | } |
| 97 | if (is_android) { |
| 98 | include_dirs += [ "android" ] |
| 99 | } |
Henrik Kjellander | b79472a | 2015-10-14 08:13:58 +0200 | [diff] [blame] | 100 | defines = [] |
kjellander | 70bed7d | 2015-11-23 17:23:44 -0800 | [diff] [blame] | 101 | cflags = [] |
kjellander@webrtc.org | 6d08ca6 | 2014-09-07 17:36:10 +0000 | [diff] [blame] | 102 | if (rtc_include_internal_audio_device) { |
kjellander@webrtc.org | c4870bb | 2014-09-01 04:24:11 +0000 | [diff] [blame] | 103 | sources += [ |
Tommi | 931e658 | 2015-05-20 09:44:38 +0200 | [diff] [blame] | 104 | "audio_device_impl.cc", |
| 105 | "audio_device_impl.h", |
kjellander@webrtc.org | c4870bb | 2014-09-01 04:24:11 +0000 | [diff] [blame] | 106 | ] |
kjellander | a46a4c9 | 2016-01-07 02:54:22 -0800 | [diff] [blame] | 107 | if (is_android) { |
| 108 | sources += [ |
| 109 | "android/audio_device_template.h", |
| 110 | "android/audio_manager.cc", |
| 111 | "android/audio_manager.h", |
| 112 | "android/audio_record_jni.cc", |
| 113 | "android/audio_record_jni.h", |
| 114 | "android/audio_track_jni.cc", |
| 115 | "android/audio_track_jni.h", |
| 116 | "android/build_info.cc", |
| 117 | "android/build_info.h", |
| 118 | "android/opensles_common.cc", |
| 119 | "android/opensles_common.h", |
| 120 | "android/opensles_player.cc", |
| 121 | "android/opensles_player.h", |
henrika | 918b554 | 2016-09-19 15:44:09 +0200 | [diff] [blame] | 122 | "android/opensles_recorder.cc", |
| 123 | "android/opensles_recorder.h", |
kjellander | a46a4c9 | 2016-01-07 02:54:22 -0800 | [diff] [blame] | 124 | ] |
| 125 | libs = [ |
| 126 | "log", |
| 127 | "OpenSLES", |
| 128 | ] |
| 129 | } |
noahric | c594aa61 | 2016-08-16 18:21:18 -0700 | [diff] [blame] | 130 | if (rtc_use_dummy_audio_file_devices) { |
| 131 | defines += [ "WEBRTC_DUMMY_FILE_DEVICES" ] |
| 132 | } else { |
| 133 | if (is_linux) { |
kjellander@webrtc.org | c4870bb | 2014-09-01 04:24:11 +0000 | [diff] [blame] | 134 | sources += [ |
noahric | c594aa61 | 2016-08-16 18:21:18 -0700 | [diff] [blame] | 135 | "linux/alsasymboltable_linux.cc", |
| 136 | "linux/alsasymboltable_linux.h", |
| 137 | "linux/audio_device_alsa_linux.cc", |
| 138 | "linux/audio_device_alsa_linux.h", |
| 139 | "linux/audio_mixer_manager_alsa_linux.cc", |
| 140 | "linux/audio_mixer_manager_alsa_linux.h", |
| 141 | "linux/latebindingsymboltable_linux.cc", |
| 142 | "linux/latebindingsymboltable_linux.h", |
kjellander@webrtc.org | c4870bb | 2014-09-01 04:24:11 +0000 | [diff] [blame] | 143 | ] |
noahric | c594aa61 | 2016-08-16 18:21:18 -0700 | [diff] [blame] | 144 | defines += [ "LINUX_ALSA" ] |
| 145 | libs = [ |
| 146 | "dl", |
| 147 | "X11", |
| 148 | ] |
| 149 | if (rtc_include_pulse_audio) { |
| 150 | sources += [ |
| 151 | "linux/audio_device_pulse_linux.cc", |
| 152 | "linux/audio_device_pulse_linux.h", |
| 153 | "linux/audio_mixer_manager_pulse_linux.cc", |
| 154 | "linux/audio_mixer_manager_pulse_linux.h", |
| 155 | "linux/pulseaudiosymboltable_linux.cc", |
| 156 | "linux/pulseaudiosymboltable_linux.h", |
| 157 | ] |
| 158 | defines += [ "LINUX_PULSE" ] |
| 159 | } |
kjellander@webrtc.org | c4870bb | 2014-09-01 04:24:11 +0000 | [diff] [blame] | 160 | } |
noahric | c594aa61 | 2016-08-16 18:21:18 -0700 | [diff] [blame] | 161 | if (is_mac) { |
| 162 | sources += [ |
| 163 | "mac/audio_device_mac.cc", |
| 164 | "mac/audio_device_mac.h", |
| 165 | "mac/audio_mixer_manager_mac.cc", |
| 166 | "mac/audio_mixer_manager_mac.h", |
noahric | c594aa61 | 2016-08-16 18:21:18 -0700 | [diff] [blame] | 167 | ] |
kjellander | 7439f97 | 2016-12-05 22:47:46 -0800 | [diff] [blame] | 168 | deps += [ ":mac_portaudio" ] |
noahric | c594aa61 | 2016-08-16 18:21:18 -0700 | [diff] [blame] | 169 | libs = [ |
maxmorin | 2ec45b9 | 2016-08-24 06:51:09 -0700 | [diff] [blame] | 170 | # Needed for CoreGraphics: |
| 171 | "ApplicationServices.framework", |
| 172 | |
noahric | c594aa61 | 2016-08-16 18:21:18 -0700 | [diff] [blame] | 173 | "AudioToolbox.framework", |
| 174 | "CoreAudio.framework", |
kjellander | bac0412 | 2016-06-02 02:18:48 -0700 | [diff] [blame] | 175 | |
noahric | c594aa61 | 2016-08-16 18:21:18 -0700 | [diff] [blame] | 176 | # Needed for CGEventSourceKeyState in audio_device_mac.cc: |
| 177 | "CoreGraphics.framework", |
| 178 | ] |
| 179 | } |
| 180 | if (is_ios) { |
| 181 | public_deps = [ |
maxmorin | ec62374 | 2016-09-15 05:11:55 -0700 | [diff] [blame] | 182 | "../../base:rtc_base", |
noahric | c594aa61 | 2016-08-16 18:21:18 -0700 | [diff] [blame] | 183 | "../../sdk:rtc_sdk_common_objc", |
| 184 | ] |
| 185 | sources += [ |
| 186 | "ios/audio_device_ios.h", |
| 187 | "ios/audio_device_ios.mm", |
| 188 | "ios/audio_device_not_implemented_ios.mm", |
| 189 | "ios/audio_session_observer.h", |
| 190 | "ios/objc/RTCAudioSession+Configuration.mm", |
| 191 | "ios/objc/RTCAudioSession+Private.h", |
| 192 | "ios/objc/RTCAudioSession.h", |
| 193 | "ios/objc/RTCAudioSession.mm", |
| 194 | "ios/objc/RTCAudioSessionConfiguration.h", |
| 195 | "ios/objc/RTCAudioSessionConfiguration.m", |
| 196 | "ios/objc/RTCAudioSessionDelegateAdapter.h", |
| 197 | "ios/objc/RTCAudioSessionDelegateAdapter.mm", |
| 198 | "ios/voice_processing_audio_unit.h", |
| 199 | "ios/voice_processing_audio_unit.mm", |
| 200 | ] |
| 201 | configs += [ "//build/config/compiler:enable_arc" ] |
kjellander | 95177d1 | 2016-04-07 00:13:58 -0700 | [diff] [blame] | 202 | |
noahric | c594aa61 | 2016-08-16 18:21:18 -0700 | [diff] [blame] | 203 | libs = [ |
| 204 | "AudioToolbox.framework", |
| 205 | "AVFoundation.framework", |
| 206 | "Foundation.framework", |
| 207 | "UIKit.framework", |
| 208 | ] |
| 209 | } |
| 210 | if (is_win) { |
| 211 | sources += [ |
| 212 | "win/audio_device_core_win.cc", |
| 213 | "win/audio_device_core_win.h", |
| 214 | "win/audio_device_wave_win.cc", |
| 215 | "win/audio_device_wave_win.h", |
| 216 | "win/audio_mixer_manager_win.cc", |
| 217 | "win/audio_mixer_manager_win.h", |
| 218 | ] |
| 219 | libs = [ |
| 220 | # Required for the built-in WASAPI AEC. |
| 221 | "dmoguids.lib", |
| 222 | "wmcodecdspuuid.lib", |
| 223 | "amstrmid.lib", |
| 224 | "msdmo.lib", |
| 225 | ] |
| 226 | } |
ehmaldonado | d02fe4b | 2016-08-26 13:31:24 -0700 | [diff] [blame] | 227 | configs += [ ":audio_device_warnings_config" ] |
kjellander@webrtc.org | c4870bb | 2014-09-01 04:24:11 +0000 | [diff] [blame] | 228 | } |
| 229 | } else { |
| 230 | defines = [ "WEBRTC_DUMMY_AUDIO_BUILD" ] |
| 231 | } |
| 232 | |
| 233 | if (!build_with_chromium) { |
| 234 | sources += [ |
| 235 | # Do not link these into Chrome since they contain static data. |
| 236 | "dummy/file_audio_device_factory.cc", |
| 237 | "dummy/file_audio_device_factory.h", |
| 238 | ] |
| 239 | } |
| 240 | |
kjellander | e40a7ee | 2016-10-16 23:56:12 -0700 | [diff] [blame] | 241 | if (!build_with_chromium && is_clang) { |
| 242 | # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163). |
ehmaldonado | 38a2132 | 2016-09-02 04:10:34 -0700 | [diff] [blame] | 243 | suppressed_configs += [ "//build/config/clang:find_bad_constructs" ] |
kjellander@webrtc.org | c4870bb | 2014-09-01 04:24:11 +0000 | [diff] [blame] | 244 | } |
kjellander@webrtc.org | c4870bb | 2014-09-01 04:24:11 +0000 | [diff] [blame] | 245 | } |
maxmorin | 6910537 | 2016-08-16 02:17:44 -0700 | [diff] [blame] | 246 | |
kjellander | 7439f97 | 2016-12-05 22:47:46 -0800 | [diff] [blame] | 247 | rtc_source_set("mac_portaudio") { |
| 248 | visibility = [ ":*" ] # Only targets in this file can depend on this. |
| 249 | sources = [ |
| 250 | "mac/portaudio/pa_memorybarrier.h", |
| 251 | "mac/portaudio/pa_ringbuffer.c", |
| 252 | "mac/portaudio/pa_ringbuffer.h", |
| 253 | ] |
| 254 | } |
| 255 | |
aleloi | 44c7ecf | 2016-11-10 08:16:25 -0800 | [diff] [blame] | 256 | config("mock_audio_device_config") { |
| 257 | if (is_win) { |
| 258 | cflags = [ |
| 259 | # TODO(phoglund): get rid of 4373 supression when |
| 260 | # http://code.google.com/p/webrtc/issues/detail?id=261 is solved. |
| 261 | # legacy warning for ignoring const / volatile in signatures. |
| 262 | "/wd4373", |
| 263 | ] |
| 264 | } |
| 265 | } |
| 266 | |
aleloi | 5de52fd | 2016-11-10 01:05:34 -0800 | [diff] [blame] | 267 | if (rtc_include_tests) { |
ehmaldonado | 3626865 | 2017-01-19 08:27:11 -0800 | [diff] [blame] | 268 | rtc_source_set("audio_device_unittests") { |
| 269 | testonly = true |
| 270 | sources = [ |
| 271 | "fine_audio_buffer_unittest.cc", |
| 272 | ] |
| 273 | deps = [ |
| 274 | ":audio_device", |
| 275 | ":mock_audio_device", |
| 276 | "../../base:rtc_base_approved", |
| 277 | "../../system_wrappers:system_wrappers", |
| 278 | "../../test:test_support", |
| 279 | "../utility:utility", |
| 280 | "//testing/gmock", |
| 281 | ] |
| 282 | if (is_android) { |
| 283 | # Need to disable error due to the line in |
| 284 | # base/android/jni_android.h triggering it: |
| 285 | # const BASE_EXPORT jobject GetApplicationContext() |
| 286 | # error: type qualifiers ignored on function return type |
| 287 | cflags = [ "-Wno-ignored-qualifiers" ] |
| 288 | sources += [ |
| 289 | "android/audio_device_unittest.cc", |
| 290 | "android/audio_manager_unittest.cc", |
| 291 | "android/ensure_initialized.cc", |
| 292 | "android/ensure_initialized.h", |
| 293 | ] |
| 294 | deps += [ |
| 295 | "../../../base", |
| 296 | "//webrtc/sdk/android:libjingle_peerconnection_java", |
| 297 | ] |
| 298 | } |
| 299 | if (is_ios) { |
| 300 | sources += [ "ios/objc/RTCAudioSessionTest.mm" ] |
| 301 | configs += [ "//build/config/compiler:enable_arc" ] |
| 302 | if (target_cpu != "x64") { |
| 303 | sources += [ "ios/audio_device_unittest_ios.cc" ] |
| 304 | } |
| 305 | } |
| 306 | if (!build_with_chromium && is_clang) { |
| 307 | # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163). |
| 308 | suppressed_configs += [ "//build/config/clang:find_bad_constructs" ] |
| 309 | } |
| 310 | } |
| 311 | |
aleloi | 5de52fd | 2016-11-10 01:05:34 -0800 | [diff] [blame] | 312 | rtc_source_set("mock_audio_device") { |
| 313 | testonly = true |
| 314 | sources = [ |
| 315 | "include/mock_audio_device.h", |
| 316 | "include/mock_audio_transport.h", |
| 317 | ] |
| 318 | deps = [ |
| 319 | ":audio_device", |
| 320 | "../../test:test_support", |
| 321 | ] |
aleloi | 44c7ecf | 2016-11-10 08:16:25 -0800 | [diff] [blame] | 322 | all_dependent_configs = [ ":mock_audio_device_config" ] |
aleloi | 5de52fd | 2016-11-10 01:05:34 -0800 | [diff] [blame] | 323 | } |
aleloi | 5de52fd | 2016-11-10 01:05:34 -0800 | [diff] [blame] | 324 | |
ehmaldonado | 3626865 | 2017-01-19 08:27:11 -0800 | [diff] [blame] | 325 | if (!is_ios) { |
| 326 | # These tests do not work on ios, see |
| 327 | # https://bugs.chromium.org/p/webrtc/issues/detail?id=4755 |
| 328 | rtc_executable("audio_device_tests") { |
| 329 | testonly = true |
| 330 | sources = [ |
| 331 | "test/audio_device_test_api.cc", |
| 332 | "test/audio_device_test_defines.h", |
| 333 | ] |
| 334 | deps = [ |
| 335 | ":audio_device", |
| 336 | "../..:webrtc_common", |
| 337 | "../../system_wrappers", |
| 338 | "../../test:test_main", |
| 339 | "../../test:test_support", |
| 340 | "../rtp_rtcp", |
| 341 | "../utility", |
| 342 | "//testing/gtest", |
| 343 | ] |
| 344 | public_configs = [ ":audio_device_config" ] |
| 345 | } |
maxmorin | 6910537 | 2016-08-16 02:17:44 -0700 | [diff] [blame] | 346 | } |
| 347 | } |
mbonadei | 438062b | 2017-01-09 02:37:21 -0800 | [diff] [blame] | 348 | |
| 349 | if (!build_with_chromium && is_android) { |
mbonadei | 3c9151b | 2017-01-20 06:48:03 -0800 | [diff] [blame] | 350 | android_shared_srcjar("audio_device_java") { |
| 351 | sources = [ |
mbonadei | 438062b | 2017-01-09 02:37:21 -0800 | [diff] [blame] | 352 | "android/java/src/org/webrtc/voiceengine/BuildInfo.java", |
| 353 | "android/java/src/org/webrtc/voiceengine/WebRtcAudioEffects.java", |
| 354 | "android/java/src/org/webrtc/voiceengine/WebRtcAudioManager.java", |
| 355 | "android/java/src/org/webrtc/voiceengine/WebRtcAudioRecord.java", |
| 356 | "android/java/src/org/webrtc/voiceengine/WebRtcAudioTrack.java", |
| 357 | "android/java/src/org/webrtc/voiceengine/WebRtcAudioUtils.java", |
| 358 | ] |
| 359 | } |
| 360 | } |