blob: a8867afe5fca65da94ced9653ea97af4db089709 [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
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +000051source_set("audio_device") {
ehmaldonadod02fe4b2016-08-26 13:31:24 -070052 configs += [ "../..:common_config" ]
53 public_configs = [
54 "../..:common_inherited_config",
55 ":audio_device_config",
56 ]
57
Zeke Chinb3fb71c2016-02-18 15:44:07 -080058 deps = [
59 "../..:webrtc_common",
Max Morin84cab202016-07-01 13:35:19 +020060 "../../base:rtc_base",
Zeke Chinb3fb71c2016-02-18 15:44:07 -080061 "../../base:rtc_base_approved",
maxmorin69105372016-08-16 02:17:44 -070062 "../../base:rtc_task_queue",
Zeke Chinb3fb71c2016-02-18 15:44:07 -080063 "../../common_audio",
64 "../../system_wrappers",
65 "../utility",
66 ]
67
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +000068 sources = [
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +000069 "audio_device_buffer.cc",
70 "audio_device_buffer.h",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +020071 "audio_device_config.h",
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +000072 "audio_device_generic.cc",
73 "audio_device_generic.h",
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +000074 "dummy/audio_device_dummy.cc",
75 "dummy/audio_device_dummy.h",
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +000076 "dummy/file_audio_device.cc",
77 "dummy/file_audio_device.h",
henrika86d907c2015-09-07 16:09:50 +020078 "fine_audio_buffer.cc",
79 "fine_audio_buffer.h",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +020080 "include/audio_device.h",
81 "include/audio_device_defines.h",
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +000082 ]
83
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +000084 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 Kjellanderb79472a2015-10-14 08:13:58 +0200100 defines = []
kjellander70bed7d2015-11-23 17:23:44 -0800101 cflags = []
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +0000102 if (rtc_include_internal_audio_device) {
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +0000103 sources += [
Tommi931e6582015-05-20 09:44:38 +0200104 "audio_device_impl.cc",
105 "audio_device_impl.h",
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +0000106 ]
kjellandera46a4c92016-01-07 02:54:22 -0800107 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",
122 ]
123 libs = [
124 "log",
125 "OpenSLES",
126 ]
127 }
noahricc594aa612016-08-16 18:21:18 -0700128 if (rtc_use_dummy_audio_file_devices) {
129 defines += [ "WEBRTC_DUMMY_FILE_DEVICES" ]
130 } else {
131 if (is_linux) {
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +0000132 sources += [
noahricc594aa612016-08-16 18:21:18 -0700133 "linux/alsasymboltable_linux.cc",
134 "linux/alsasymboltable_linux.h",
135 "linux/audio_device_alsa_linux.cc",
136 "linux/audio_device_alsa_linux.h",
137 "linux/audio_mixer_manager_alsa_linux.cc",
138 "linux/audio_mixer_manager_alsa_linux.h",
139 "linux/latebindingsymboltable_linux.cc",
140 "linux/latebindingsymboltable_linux.h",
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +0000141 ]
noahricc594aa612016-08-16 18:21:18 -0700142 defines += [ "LINUX_ALSA" ]
143 libs = [
144 "dl",
145 "X11",
146 ]
147 if (rtc_include_pulse_audio) {
148 sources += [
149 "linux/audio_device_pulse_linux.cc",
150 "linux/audio_device_pulse_linux.h",
151 "linux/audio_mixer_manager_pulse_linux.cc",
152 "linux/audio_mixer_manager_pulse_linux.h",
153 "linux/pulseaudiosymboltable_linux.cc",
154 "linux/pulseaudiosymboltable_linux.h",
155 ]
156 defines += [ "LINUX_PULSE" ]
157 }
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +0000158 }
noahricc594aa612016-08-16 18:21:18 -0700159 if (is_mac) {
160 sources += [
161 "mac/audio_device_mac.cc",
162 "mac/audio_device_mac.h",
163 "mac/audio_mixer_manager_mac.cc",
164 "mac/audio_mixer_manager_mac.h",
165 "mac/portaudio/pa_memorybarrier.h",
166 "mac/portaudio/pa_ringbuffer.c",
167 "mac/portaudio/pa_ringbuffer.h",
168 ]
169 libs = [
maxmorin2ec45b92016-08-24 06:51:09 -0700170 # Needed for CoreGraphics:
171 "ApplicationServices.framework",
172
noahricc594aa612016-08-16 18:21:18 -0700173 "AudioToolbox.framework",
174 "CoreAudio.framework",
kjellanderbac04122016-06-02 02:18:48 -0700175
noahricc594aa612016-08-16 18:21:18 -0700176 # Needed for CGEventSourceKeyState in audio_device_mac.cc:
177 "CoreGraphics.framework",
178 ]
179 }
180 if (is_ios) {
181 public_deps = [
182 "../../sdk:rtc_sdk_common_objc",
183 ]
184 sources += [
185 "ios/audio_device_ios.h",
186 "ios/audio_device_ios.mm",
187 "ios/audio_device_not_implemented_ios.mm",
188 "ios/audio_session_observer.h",
189 "ios/objc/RTCAudioSession+Configuration.mm",
190 "ios/objc/RTCAudioSession+Private.h",
191 "ios/objc/RTCAudioSession.h",
192 "ios/objc/RTCAudioSession.mm",
193 "ios/objc/RTCAudioSessionConfiguration.h",
194 "ios/objc/RTCAudioSessionConfiguration.m",
195 "ios/objc/RTCAudioSessionDelegateAdapter.h",
196 "ios/objc/RTCAudioSessionDelegateAdapter.mm",
197 "ios/voice_processing_audio_unit.h",
198 "ios/voice_processing_audio_unit.mm",
199 ]
200 configs += [ "//build/config/compiler:enable_arc" ]
kjellander95177d12016-04-07 00:13:58 -0700201
noahricc594aa612016-08-16 18:21:18 -0700202 libs = [
203 "AudioToolbox.framework",
204 "AVFoundation.framework",
205 "Foundation.framework",
206 "UIKit.framework",
207 ]
208 }
209 if (is_win) {
210 sources += [
211 "win/audio_device_core_win.cc",
212 "win/audio_device_core_win.h",
213 "win/audio_device_wave_win.cc",
214 "win/audio_device_wave_win.h",
215 "win/audio_mixer_manager_win.cc",
216 "win/audio_mixer_manager_win.h",
217 ]
218 libs = [
219 # Required for the built-in WASAPI AEC.
220 "dmoguids.lib",
221 "wmcodecdspuuid.lib",
222 "amstrmid.lib",
223 "msdmo.lib",
224 ]
225 }
ehmaldonadod02fe4b2016-08-26 13:31:24 -0700226 configs += [ ":audio_device_warnings_config" ]
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +0000227 }
228 } else {
229 defines = [ "WEBRTC_DUMMY_AUDIO_BUILD" ]
230 }
231
232 if (!build_with_chromium) {
233 sources += [
234 # Do not link these into Chrome since they contain static data.
235 "dummy/file_audio_device_factory.cc",
236 "dummy/file_audio_device_factory.h",
237 ]
238 }
239
240 if (is_clang) {
241 # Suppress warnings from Chrome's Clang plugins.
242 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
243 configs -= [ "//build/config/clang:find_bad_constructs" ]
244 }
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +0000245}
maxmorin69105372016-08-16 02:17:44 -0700246
247# These tests do not work on ios, see
248# https://bugs.chromium.org/p/webrtc/issues/detail?id=4755
249if (rtc_include_tests && !is_ios) {
250 executable("audio_device_tests") {
251 testonly = true
252 sources = [
253 "test/audio_device_test_api.cc",
254 "test/audio_device_test_defines.h",
255 ]
256 deps = [
257 ":audio_device",
258 "../..:webrtc_common",
259 "../../system_wrappers",
260 "../../test:test_support",
261 "../../test:test_support_main",
262 "../rtp_rtcp",
263 "../utility",
ehmaldonadobcba64a2016-08-19 02:11:07 -0700264 "//build/config/sanitizers:deps",
maxmorin69105372016-08-16 02:17:44 -0700265 "//testing/gtest",
266 ]
267 configs += [ "../..:common_config" ]
268 public_configs = [
269 "../..:common_inherited_config",
270 ":audio_device_config",
271 ]
272 }
273}