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 | |
kjellander@webrtc.org | c4870bb | 2014-09-01 04:24:11 +0000 | [diff] [blame] | 11 | config("audio_device_config") { |
| 12 | include_dirs = [ |
Henrik Kjellander | ff761fb | 2015-11-04 08:31:52 +0100 | [diff] [blame] | 13 | "../include", |
kjellander@webrtc.org | c4870bb | 2014-09-01 04:24:11 +0000 | [diff] [blame] | 14 | "include", |
| 15 | "dummy", # Contains dummy audio device implementations. |
| 16 | ] |
kjellander | 95177d1 | 2016-04-07 00:13:58 -0700 | [diff] [blame] | 17 | if (is_ios) { |
| 18 | # GN orders flags on a target before flags from configs. In order to be able |
| 19 | # suppress the -Wthread-safety-analysis warning, it has come from a config |
| 20 | # and can't be on the target directly. |
| 21 | # TODO(tkchin): Remove after fixing |
| 22 | # https://bugs.chromium.org/p/webrtc/issues/detail?id=5748 |
| 23 | cflags = [ "-Wno-thread-safety-analysis" ] |
| 24 | } |
kjellander@webrtc.org | 1227ab8 | 2014-06-23 19:21:07 +0000 | [diff] [blame] | 25 | } |
kjellander@webrtc.org | c4870bb | 2014-09-01 04:24:11 +0000 | [diff] [blame] | 26 | |
| 27 | source_set("audio_device") { |
Zeke Chin | b3fb71c | 2016-02-18 15:44:07 -0800 | [diff] [blame] | 28 | deps = [ |
| 29 | "../..:webrtc_common", |
Max Morin | 84cab20 | 2016-07-01 13:35:19 +0200 | [diff] [blame] | 30 | "../../base:rtc_base", |
Zeke Chin | b3fb71c | 2016-02-18 15:44:07 -0800 | [diff] [blame] | 31 | "../../base:rtc_base_approved", |
maxmorin | 6910537 | 2016-08-16 02:17:44 -0700 | [diff] [blame] | 32 | "../../base:rtc_task_queue", |
Zeke Chin | b3fb71c | 2016-02-18 15:44:07 -0800 | [diff] [blame] | 33 | "../../common_audio", |
| 34 | "../../system_wrappers", |
| 35 | "../utility", |
| 36 | ] |
| 37 | |
kjellander@webrtc.org | c4870bb | 2014-09-01 04:24:11 +0000 | [diff] [blame] | 38 | sources = [ |
kjellander@webrtc.org | c4870bb | 2014-09-01 04:24:11 +0000 | [diff] [blame] | 39 | "audio_device_buffer.cc", |
| 40 | "audio_device_buffer.h", |
Henrik Kjellander | 57e5fd2 | 2015-05-25 12:55:39 +0200 | [diff] [blame] | 41 | "audio_device_config.h", |
kjellander@webrtc.org | c4870bb | 2014-09-01 04:24:11 +0000 | [diff] [blame] | 42 | "audio_device_generic.cc", |
| 43 | "audio_device_generic.h", |
kjellander@webrtc.org | c4870bb | 2014-09-01 04:24:11 +0000 | [diff] [blame] | 44 | "dummy/audio_device_dummy.cc", |
| 45 | "dummy/audio_device_dummy.h", |
kjellander@webrtc.org | c4870bb | 2014-09-01 04:24:11 +0000 | [diff] [blame] | 46 | "dummy/file_audio_device.cc", |
| 47 | "dummy/file_audio_device.h", |
henrika | 86d907c | 2015-09-07 16:09:50 +0200 | [diff] [blame] | 48 | "fine_audio_buffer.cc", |
| 49 | "fine_audio_buffer.h", |
Henrik Kjellander | 57e5fd2 | 2015-05-25 12:55:39 +0200 | [diff] [blame] | 50 | "include/audio_device.h", |
| 51 | "include/audio_device_defines.h", |
kjellander@webrtc.org | c4870bb | 2014-09-01 04:24:11 +0000 | [diff] [blame] | 52 | ] |
| 53 | |
kjellander@webrtc.org | c4870bb | 2014-09-01 04:24:11 +0000 | [diff] [blame] | 54 | include_dirs = [] |
| 55 | if (is_linux) { |
| 56 | include_dirs += [ "linux" ] |
| 57 | } |
| 58 | if (is_ios) { |
| 59 | include_dirs += [ "ios" ] |
| 60 | } |
| 61 | if (is_mac) { |
| 62 | include_dirs += [ "mac" ] |
| 63 | } |
| 64 | if (is_win) { |
| 65 | include_dirs += [ "win" ] |
| 66 | } |
| 67 | if (is_android) { |
| 68 | include_dirs += [ "android" ] |
| 69 | } |
Henrik Kjellander | b79472a | 2015-10-14 08:13:58 +0200 | [diff] [blame] | 70 | defines = [] |
kjellander | 70bed7d | 2015-11-23 17:23:44 -0800 | [diff] [blame] | 71 | cflags = [] |
kjellander@webrtc.org | 6d08ca6 | 2014-09-07 17:36:10 +0000 | [diff] [blame] | 72 | if (rtc_include_internal_audio_device) { |
kjellander@webrtc.org | c4870bb | 2014-09-01 04:24:11 +0000 | [diff] [blame] | 73 | sources += [ |
Tommi | 931e658 | 2015-05-20 09:44:38 +0200 | [diff] [blame] | 74 | "audio_device_impl.cc", |
| 75 | "audio_device_impl.h", |
kjellander@webrtc.org | c4870bb | 2014-09-01 04:24:11 +0000 | [diff] [blame] | 76 | ] |
kjellander | a46a4c9 | 2016-01-07 02:54:22 -0800 | [diff] [blame] | 77 | if (is_android) { |
| 78 | sources += [ |
| 79 | "android/audio_device_template.h", |
| 80 | "android/audio_manager.cc", |
| 81 | "android/audio_manager.h", |
| 82 | "android/audio_record_jni.cc", |
| 83 | "android/audio_record_jni.h", |
| 84 | "android/audio_track_jni.cc", |
| 85 | "android/audio_track_jni.h", |
| 86 | "android/build_info.cc", |
| 87 | "android/build_info.h", |
| 88 | "android/opensles_common.cc", |
| 89 | "android/opensles_common.h", |
| 90 | "android/opensles_player.cc", |
| 91 | "android/opensles_player.h", |
| 92 | ] |
| 93 | libs = [ |
| 94 | "log", |
| 95 | "OpenSLES", |
| 96 | ] |
| 97 | } |
noahric | c594aa61 | 2016-08-16 18:21:18 -0700 | [diff] [blame] | 98 | if (rtc_use_dummy_audio_file_devices) { |
| 99 | defines += [ "WEBRTC_DUMMY_FILE_DEVICES" ] |
| 100 | } else { |
| 101 | if (is_linux) { |
kjellander@webrtc.org | c4870bb | 2014-09-01 04:24:11 +0000 | [diff] [blame] | 102 | sources += [ |
noahric | c594aa61 | 2016-08-16 18:21:18 -0700 | [diff] [blame] | 103 | "linux/alsasymboltable_linux.cc", |
| 104 | "linux/alsasymboltable_linux.h", |
| 105 | "linux/audio_device_alsa_linux.cc", |
| 106 | "linux/audio_device_alsa_linux.h", |
| 107 | "linux/audio_mixer_manager_alsa_linux.cc", |
| 108 | "linux/audio_mixer_manager_alsa_linux.h", |
| 109 | "linux/latebindingsymboltable_linux.cc", |
| 110 | "linux/latebindingsymboltable_linux.h", |
kjellander@webrtc.org | c4870bb | 2014-09-01 04:24:11 +0000 | [diff] [blame] | 111 | ] |
noahric | c594aa61 | 2016-08-16 18:21:18 -0700 | [diff] [blame] | 112 | defines += [ "LINUX_ALSA" ] |
| 113 | libs = [ |
| 114 | "dl", |
| 115 | "X11", |
| 116 | ] |
| 117 | if (rtc_include_pulse_audio) { |
| 118 | sources += [ |
| 119 | "linux/audio_device_pulse_linux.cc", |
| 120 | "linux/audio_device_pulse_linux.h", |
| 121 | "linux/audio_mixer_manager_pulse_linux.cc", |
| 122 | "linux/audio_mixer_manager_pulse_linux.h", |
| 123 | "linux/pulseaudiosymboltable_linux.cc", |
| 124 | "linux/pulseaudiosymboltable_linux.h", |
| 125 | ] |
| 126 | defines += [ "LINUX_PULSE" ] |
| 127 | } |
kjellander@webrtc.org | c4870bb | 2014-09-01 04:24:11 +0000 | [diff] [blame] | 128 | } |
noahric | c594aa61 | 2016-08-16 18:21:18 -0700 | [diff] [blame] | 129 | if (is_mac) { |
| 130 | sources += [ |
| 131 | "mac/audio_device_mac.cc", |
| 132 | "mac/audio_device_mac.h", |
| 133 | "mac/audio_mixer_manager_mac.cc", |
| 134 | "mac/audio_mixer_manager_mac.h", |
| 135 | "mac/portaudio/pa_memorybarrier.h", |
| 136 | "mac/portaudio/pa_ringbuffer.c", |
| 137 | "mac/portaudio/pa_ringbuffer.h", |
| 138 | ] |
| 139 | libs = [ |
maxmorin | 2ec45b9 | 2016-08-24 06:51:09 -0700 | [diff] [blame] | 140 | # Needed for CoreGraphics: |
| 141 | "ApplicationServices.framework", |
| 142 | |
noahric | c594aa61 | 2016-08-16 18:21:18 -0700 | [diff] [blame] | 143 | "AudioToolbox.framework", |
| 144 | "CoreAudio.framework", |
kjellander | bac0412 | 2016-06-02 02:18:48 -0700 | [diff] [blame] | 145 | |
noahric | c594aa61 | 2016-08-16 18:21:18 -0700 | [diff] [blame] | 146 | # Needed for CGEventSourceKeyState in audio_device_mac.cc: |
| 147 | "CoreGraphics.framework", |
| 148 | ] |
| 149 | } |
| 150 | if (is_ios) { |
| 151 | public_deps = [ |
| 152 | "../../sdk:rtc_sdk_common_objc", |
| 153 | ] |
| 154 | sources += [ |
| 155 | "ios/audio_device_ios.h", |
| 156 | "ios/audio_device_ios.mm", |
| 157 | "ios/audio_device_not_implemented_ios.mm", |
| 158 | "ios/audio_session_observer.h", |
| 159 | "ios/objc/RTCAudioSession+Configuration.mm", |
| 160 | "ios/objc/RTCAudioSession+Private.h", |
| 161 | "ios/objc/RTCAudioSession.h", |
| 162 | "ios/objc/RTCAudioSession.mm", |
| 163 | "ios/objc/RTCAudioSessionConfiguration.h", |
| 164 | "ios/objc/RTCAudioSessionConfiguration.m", |
| 165 | "ios/objc/RTCAudioSessionDelegateAdapter.h", |
| 166 | "ios/objc/RTCAudioSessionDelegateAdapter.mm", |
| 167 | "ios/voice_processing_audio_unit.h", |
| 168 | "ios/voice_processing_audio_unit.mm", |
| 169 | ] |
| 170 | configs += [ "//build/config/compiler:enable_arc" ] |
kjellander | 95177d1 | 2016-04-07 00:13:58 -0700 | [diff] [blame] | 171 | |
noahric | c594aa61 | 2016-08-16 18:21:18 -0700 | [diff] [blame] | 172 | libs = [ |
| 173 | "AudioToolbox.framework", |
| 174 | "AVFoundation.framework", |
| 175 | "Foundation.framework", |
| 176 | "UIKit.framework", |
| 177 | ] |
| 178 | } |
| 179 | if (is_win) { |
| 180 | sources += [ |
| 181 | "win/audio_device_core_win.cc", |
| 182 | "win/audio_device_core_win.h", |
| 183 | "win/audio_device_wave_win.cc", |
| 184 | "win/audio_device_wave_win.h", |
| 185 | "win/audio_mixer_manager_win.cc", |
| 186 | "win/audio_mixer_manager_win.h", |
| 187 | ] |
| 188 | libs = [ |
| 189 | # Required for the built-in WASAPI AEC. |
| 190 | "dmoguids.lib", |
| 191 | "wmcodecdspuuid.lib", |
| 192 | "amstrmid.lib", |
| 193 | "msdmo.lib", |
| 194 | ] |
| 195 | } |
ehmaldonado | 4bc4d27 | 2016-08-25 04:15:40 -0700 | [diff] [blame^] | 196 | if (is_win && is_clang) { |
| 197 | cflags += [ |
| 198 | # Disable warnings failing when compiling with Clang on Windows. |
| 199 | # https://bugs.chromium.org/p/webrtc/issues/detail?id=5366 |
| 200 | "-Wno-bool-conversion", |
| 201 | "-Wno-delete-non-virtual-dtor", |
| 202 | "-Wno-logical-op-parentheses", |
| 203 | "-Wno-microsoft-extra-qualification", |
| 204 | "-Wno-microsoft-goto", |
| 205 | "-Wno-missing-braces", |
| 206 | "-Wno-parentheses-equality", |
| 207 | "-Wno-reorder", |
| 208 | "-Wno-shift-overflow", |
| 209 | "-Wno-tautological-compare", |
| 210 | "-Wno-unused-private-field", |
| 211 | ] |
| 212 | } |
kjellander@webrtc.org | c4870bb | 2014-09-01 04:24:11 +0000 | [diff] [blame] | 213 | } |
| 214 | } else { |
| 215 | defines = [ "WEBRTC_DUMMY_AUDIO_BUILD" ] |
| 216 | } |
| 217 | |
| 218 | if (!build_with_chromium) { |
| 219 | sources += [ |
| 220 | # Do not link these into Chrome since they contain static data. |
| 221 | "dummy/file_audio_device_factory.cc", |
| 222 | "dummy/file_audio_device_factory.h", |
| 223 | ] |
| 224 | } |
| 225 | |
kjellander@webrtc.org | f21ea91 | 2014-09-28 17:37:22 +0000 | [diff] [blame] | 226 | configs += [ "../..:common_config" ] |
| 227 | public_configs = [ |
| 228 | "../..:common_inherited_config", |
Henrik Kjellander | 57e5fd2 | 2015-05-25 12:55:39 +0200 | [diff] [blame] | 229 | ":audio_device_config", |
kjellander@webrtc.org | f21ea91 | 2014-09-28 17:37:22 +0000 | [diff] [blame] | 230 | ] |
| 231 | |
kjellander@webrtc.org | c4870bb | 2014-09-01 04:24:11 +0000 | [diff] [blame] | 232 | if (is_clang) { |
| 233 | # Suppress warnings from Chrome's Clang plugins. |
| 234 | # See http://code.google.com/p/webrtc/issues/detail?id=163 for details. |
| 235 | configs -= [ "//build/config/clang:find_bad_constructs" ] |
| 236 | } |
kjellander@webrtc.org | c4870bb | 2014-09-01 04:24:11 +0000 | [diff] [blame] | 237 | } |
maxmorin | 6910537 | 2016-08-16 02:17:44 -0700 | [diff] [blame] | 238 | |
| 239 | # These tests do not work on ios, see |
| 240 | # https://bugs.chromium.org/p/webrtc/issues/detail?id=4755 |
| 241 | if (rtc_include_tests && !is_ios) { |
| 242 | executable("audio_device_tests") { |
| 243 | testonly = true |
| 244 | sources = [ |
| 245 | "test/audio_device_test_api.cc", |
| 246 | "test/audio_device_test_defines.h", |
| 247 | ] |
| 248 | deps = [ |
| 249 | ":audio_device", |
| 250 | "../..:webrtc_common", |
| 251 | "../../system_wrappers", |
| 252 | "../../test:test_support", |
| 253 | "../../test:test_support_main", |
| 254 | "../rtp_rtcp", |
| 255 | "../utility", |
ehmaldonado | bcba64a | 2016-08-19 02:11:07 -0700 | [diff] [blame] | 256 | "//build/config/sanitizers:deps", |
maxmorin | 6910537 | 2016-08-16 02:17:44 -0700 | [diff] [blame] | 257 | "//testing/gtest", |
| 258 | ] |
| 259 | configs += [ "../..:common_config" ] |
| 260 | public_configs = [ |
| 261 | "../..:common_inherited_config", |
| 262 | ":audio_device_config", |
| 263 | ] |
| 264 | } |
| 265 | } |