blob: 4151e37730b876f36b7c21dbaa29083af2ed72af [file] [log] [blame]
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +00001# 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
9import("../../build/webrtc.gni")
10
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +000011config("audio_device_config") {
12 include_dirs = [
Henrik Kjellanderff761fb2015-11-04 08:31:52 +010013 "../include",
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +000014 "include",
15 "dummy", # Contains dummy audio device implementations.
16 ]
kjellander95177d12016-04-07 00:13:58 -070017 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.org1227ab82014-06-23 19:21:07 +000025}
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +000026
ehmaldonadod02fe4b2016-08-26 13:31:24 -070027config("audio_device_warnings_config") {
28 if (is_win && is_clang) {
29 cflags = [
30 # Disable warnings failing when compiling with Clang on Windows.
31 # https://bugs.chromium.org/p/webrtc/issues/detail?id=5366
32 "-Wno-bool-conversion",
33 "-Wno-delete-non-virtual-dtor",
34 "-Wno-logical-op-parentheses",
35 "-Wno-microsoft-extra-qualification",
36 "-Wno-microsoft-goto",
37 "-Wno-missing-braces",
38 "-Wno-parentheses-equality",
39 "-Wno-reorder",
40 "-Wno-shift-overflow",
41 "-Wno-tautological-compare",
42
43 # See https://bugs.chromium.org/p/webrtc/issues/detail?id=6265
44 # for -Wno-thread-safety-analysis
45 "-Wno-thread-safety-analysis",
46 "-Wno-unused-private-field",
47 ]
48 }
49}
50
ehmaldonado38a21322016-09-02 04:10:34 -070051rtc_source_set("audio_device") {
ehmaldonadod02fe4b2016-08-26 13:31:24 -070052 public_configs = [
53 "../..:common_inherited_config",
54 ":audio_device_config",
55 ]
56
Zeke Chinb3fb71c2016-02-18 15:44:07 -080057 deps = [
58 "../..:webrtc_common",
Max Morin84cab202016-07-01 13:35:19 +020059 "../../base:rtc_base",
Zeke Chinb3fb71c2016-02-18 15:44:07 -080060 "../../base:rtc_base_approved",
maxmorin69105372016-08-16 02:17:44 -070061 "../../base:rtc_task_queue",
Zeke Chinb3fb71c2016-02-18 15:44:07 -080062 "../../common_audio",
63 "../../system_wrappers",
64 "../utility",
65 ]
66
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +000067 sources = [
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +000068 "audio_device_buffer.cc",
69 "audio_device_buffer.h",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +020070 "audio_device_config.h",
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +000071 "audio_device_generic.cc",
72 "audio_device_generic.h",
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +000073 "dummy/audio_device_dummy.cc",
74 "dummy/audio_device_dummy.h",
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +000075 "dummy/file_audio_device.cc",
76 "dummy/file_audio_device.h",
henrika86d907c2015-09-07 16:09:50 +020077 "fine_audio_buffer.cc",
78 "fine_audio_buffer.h",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +020079 "include/audio_device.h",
80 "include/audio_device_defines.h",
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +000081 ]
82
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +000083 include_dirs = []
84 if (is_linux) {
85 include_dirs += [ "linux" ]
86 }
87 if (is_ios) {
88 include_dirs += [ "ios" ]
89 }
90 if (is_mac) {
91 include_dirs += [ "mac" ]
92 }
93 if (is_win) {
94 include_dirs += [ "win" ]
95 }
96 if (is_android) {
97 include_dirs += [ "android" ]
98 }
Henrik Kjellanderb79472a2015-10-14 08:13:58 +020099 defines = []
kjellander70bed7d2015-11-23 17:23:44 -0800100 cflags = []
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +0000101 if (rtc_include_internal_audio_device) {
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +0000102 sources += [
Tommi931e6582015-05-20 09:44:38 +0200103 "audio_device_impl.cc",
104 "audio_device_impl.h",
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +0000105 ]
kjellandera46a4c92016-01-07 02:54:22 -0800106 if (is_android) {
107 sources += [
108 "android/audio_device_template.h",
109 "android/audio_manager.cc",
110 "android/audio_manager.h",
111 "android/audio_record_jni.cc",
112 "android/audio_record_jni.h",
113 "android/audio_track_jni.cc",
114 "android/audio_track_jni.h",
115 "android/build_info.cc",
116 "android/build_info.h",
117 "android/opensles_common.cc",
118 "android/opensles_common.h",
119 "android/opensles_player.cc",
120 "android/opensles_player.h",
121 ]
122 libs = [
123 "log",
124 "OpenSLES",
125 ]
126 }
noahricc594aa612016-08-16 18:21:18 -0700127 if (rtc_use_dummy_audio_file_devices) {
128 defines += [ "WEBRTC_DUMMY_FILE_DEVICES" ]
129 } else {
130 if (is_linux) {
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +0000131 sources += [
noahricc594aa612016-08-16 18:21:18 -0700132 "linux/alsasymboltable_linux.cc",
133 "linux/alsasymboltable_linux.h",
134 "linux/audio_device_alsa_linux.cc",
135 "linux/audio_device_alsa_linux.h",
136 "linux/audio_mixer_manager_alsa_linux.cc",
137 "linux/audio_mixer_manager_alsa_linux.h",
138 "linux/latebindingsymboltable_linux.cc",
139 "linux/latebindingsymboltable_linux.h",
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +0000140 ]
noahricc594aa612016-08-16 18:21:18 -0700141 defines += [ "LINUX_ALSA" ]
142 libs = [
143 "dl",
144 "X11",
145 ]
146 if (rtc_include_pulse_audio) {
147 sources += [
148 "linux/audio_device_pulse_linux.cc",
149 "linux/audio_device_pulse_linux.h",
150 "linux/audio_mixer_manager_pulse_linux.cc",
151 "linux/audio_mixer_manager_pulse_linux.h",
152 "linux/pulseaudiosymboltable_linux.cc",
153 "linux/pulseaudiosymboltable_linux.h",
154 ]
155 defines += [ "LINUX_PULSE" ]
156 }
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +0000157 }
noahricc594aa612016-08-16 18:21:18 -0700158 if (is_mac) {
159 sources += [
160 "mac/audio_device_mac.cc",
161 "mac/audio_device_mac.h",
162 "mac/audio_mixer_manager_mac.cc",
163 "mac/audio_mixer_manager_mac.h",
164 "mac/portaudio/pa_memorybarrier.h",
165 "mac/portaudio/pa_ringbuffer.c",
166 "mac/portaudio/pa_ringbuffer.h",
167 ]
168 libs = [
maxmorin2ec45b92016-08-24 06:51:09 -0700169 # Needed for CoreGraphics:
170 "ApplicationServices.framework",
171
noahricc594aa612016-08-16 18:21:18 -0700172 "AudioToolbox.framework",
173 "CoreAudio.framework",
kjellanderbac04122016-06-02 02:18:48 -0700174
noahricc594aa612016-08-16 18:21:18 -0700175 # Needed for CGEventSourceKeyState in audio_device_mac.cc:
176 "CoreGraphics.framework",
177 ]
178 }
179 if (is_ios) {
180 public_deps = [
181 "../../sdk:rtc_sdk_common_objc",
182 ]
183 sources += [
184 "ios/audio_device_ios.h",
185 "ios/audio_device_ios.mm",
186 "ios/audio_device_not_implemented_ios.mm",
187 "ios/audio_session_observer.h",
188 "ios/objc/RTCAudioSession+Configuration.mm",
189 "ios/objc/RTCAudioSession+Private.h",
190 "ios/objc/RTCAudioSession.h",
191 "ios/objc/RTCAudioSession.mm",
192 "ios/objc/RTCAudioSessionConfiguration.h",
193 "ios/objc/RTCAudioSessionConfiguration.m",
194 "ios/objc/RTCAudioSessionDelegateAdapter.h",
195 "ios/objc/RTCAudioSessionDelegateAdapter.mm",
196 "ios/voice_processing_audio_unit.h",
197 "ios/voice_processing_audio_unit.mm",
198 ]
199 configs += [ "//build/config/compiler:enable_arc" ]
kjellander95177d12016-04-07 00:13:58 -0700200
noahricc594aa612016-08-16 18:21:18 -0700201 libs = [
202 "AudioToolbox.framework",
203 "AVFoundation.framework",
204 "Foundation.framework",
205 "UIKit.framework",
206 ]
207 }
208 if (is_win) {
209 sources += [
210 "win/audio_device_core_win.cc",
211 "win/audio_device_core_win.h",
212 "win/audio_device_wave_win.cc",
213 "win/audio_device_wave_win.h",
214 "win/audio_mixer_manager_win.cc",
215 "win/audio_mixer_manager_win.h",
216 ]
217 libs = [
218 # Required for the built-in WASAPI AEC.
219 "dmoguids.lib",
220 "wmcodecdspuuid.lib",
221 "amstrmid.lib",
222 "msdmo.lib",
223 ]
224 }
ehmaldonadod02fe4b2016-08-26 13:31:24 -0700225 configs += [ ":audio_device_warnings_config" ]
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +0000226 }
227 } else {
228 defines = [ "WEBRTC_DUMMY_AUDIO_BUILD" ]
229 }
230
231 if (!build_with_chromium) {
232 sources += [
233 # Do not link these into Chrome since they contain static data.
234 "dummy/file_audio_device_factory.cc",
235 "dummy/file_audio_device_factory.h",
236 ]
237 }
238
239 if (is_clang) {
240 # Suppress warnings from Chrome's Clang plugins.
241 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
ehmaldonado38a21322016-09-02 04:10:34 -0700242 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +0000243 }
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +0000244}
maxmorin69105372016-08-16 02:17:44 -0700245
246# These tests do not work on ios, see
247# https://bugs.chromium.org/p/webrtc/issues/detail?id=4755
248if (rtc_include_tests && !is_ios) {
ehmaldonado38a21322016-09-02 04:10:34 -0700249 rtc_executable("audio_device_tests") {
maxmorin69105372016-08-16 02:17:44 -0700250 testonly = true
251 sources = [
252 "test/audio_device_test_api.cc",
253 "test/audio_device_test_defines.h",
254 ]
255 deps = [
256 ":audio_device",
257 "../..:webrtc_common",
258 "../../system_wrappers",
259 "../../test:test_support",
260 "../../test:test_support_main",
261 "../rtp_rtcp",
262 "../utility",
263 "//testing/gtest",
264 ]
maxmorin69105372016-08-16 02:17:44 -0700265 public_configs = [
266 "../..:common_inherited_config",
267 ":audio_device_config",
268 ]
269 }
270}