blob: fcd4ffd45d414765e4afff907d29f528be250a43 [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") {
ehmaldonadoe9cc6862016-09-05 06:10:18 -070052 public_configs = [ ":audio_device_config" ]
ehmaldonadod02fe4b2016-08-26 13:31:24 -070053
Zeke Chinb3fb71c2016-02-18 15:44:07 -080054 deps = [
55 "../..:webrtc_common",
Max Morin84cab202016-07-01 13:35:19 +020056 "../../base:rtc_base",
Zeke Chinb3fb71c2016-02-18 15:44:07 -080057 "../../base:rtc_base_approved",
maxmorin69105372016-08-16 02:17:44 -070058 "../../base:rtc_task_queue",
Zeke Chinb3fb71c2016-02-18 15:44:07 -080059 "../../common_audio",
60 "../../system_wrappers",
61 "../utility",
62 ]
63
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +000064 sources = [
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +000065 "audio_device_buffer.cc",
66 "audio_device_buffer.h",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +020067 "audio_device_config.h",
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +000068 "audio_device_generic.cc",
69 "audio_device_generic.h",
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +000070 "dummy/audio_device_dummy.cc",
71 "dummy/audio_device_dummy.h",
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +000072 "dummy/file_audio_device.cc",
73 "dummy/file_audio_device.h",
henrika86d907c2015-09-07 16:09:50 +020074 "fine_audio_buffer.cc",
75 "fine_audio_buffer.h",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +020076 "include/audio_device.h",
77 "include/audio_device_defines.h",
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +000078 ]
79
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +000080 include_dirs = []
81 if (is_linux) {
82 include_dirs += [ "linux" ]
83 }
84 if (is_ios) {
85 include_dirs += [ "ios" ]
86 }
87 if (is_mac) {
88 include_dirs += [ "mac" ]
89 }
90 if (is_win) {
91 include_dirs += [ "win" ]
92 }
93 if (is_android) {
94 include_dirs += [ "android" ]
95 }
Henrik Kjellanderb79472a2015-10-14 08:13:58 +020096 defines = []
kjellander70bed7d2015-11-23 17:23:44 -080097 cflags = []
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +000098 if (rtc_include_internal_audio_device) {
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +000099 sources += [
Tommi931e6582015-05-20 09:44:38 +0200100 "audio_device_impl.cc",
101 "audio_device_impl.h",
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +0000102 ]
kjellandera46a4c92016-01-07 02:54:22 -0800103 if (is_android) {
104 sources += [
105 "android/audio_device_template.h",
106 "android/audio_manager.cc",
107 "android/audio_manager.h",
108 "android/audio_record_jni.cc",
109 "android/audio_record_jni.h",
110 "android/audio_track_jni.cc",
111 "android/audio_track_jni.h",
112 "android/build_info.cc",
113 "android/build_info.h",
114 "android/opensles_common.cc",
115 "android/opensles_common.h",
116 "android/opensles_player.cc",
117 "android/opensles_player.h",
118 ]
119 libs = [
120 "log",
121 "OpenSLES",
122 ]
123 }
noahricc594aa612016-08-16 18:21:18 -0700124 if (rtc_use_dummy_audio_file_devices) {
125 defines += [ "WEBRTC_DUMMY_FILE_DEVICES" ]
126 } else {
127 if (is_linux) {
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +0000128 sources += [
noahricc594aa612016-08-16 18:21:18 -0700129 "linux/alsasymboltable_linux.cc",
130 "linux/alsasymboltable_linux.h",
131 "linux/audio_device_alsa_linux.cc",
132 "linux/audio_device_alsa_linux.h",
133 "linux/audio_mixer_manager_alsa_linux.cc",
134 "linux/audio_mixer_manager_alsa_linux.h",
135 "linux/latebindingsymboltable_linux.cc",
136 "linux/latebindingsymboltable_linux.h",
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +0000137 ]
noahricc594aa612016-08-16 18:21:18 -0700138 defines += [ "LINUX_ALSA" ]
139 libs = [
140 "dl",
141 "X11",
142 ]
143 if (rtc_include_pulse_audio) {
144 sources += [
145 "linux/audio_device_pulse_linux.cc",
146 "linux/audio_device_pulse_linux.h",
147 "linux/audio_mixer_manager_pulse_linux.cc",
148 "linux/audio_mixer_manager_pulse_linux.h",
149 "linux/pulseaudiosymboltable_linux.cc",
150 "linux/pulseaudiosymboltable_linux.h",
151 ]
152 defines += [ "LINUX_PULSE" ]
153 }
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +0000154 }
noahricc594aa612016-08-16 18:21:18 -0700155 if (is_mac) {
156 sources += [
157 "mac/audio_device_mac.cc",
158 "mac/audio_device_mac.h",
159 "mac/audio_mixer_manager_mac.cc",
160 "mac/audio_mixer_manager_mac.h",
161 "mac/portaudio/pa_memorybarrier.h",
162 "mac/portaudio/pa_ringbuffer.c",
163 "mac/portaudio/pa_ringbuffer.h",
164 ]
165 libs = [
maxmorin2ec45b92016-08-24 06:51:09 -0700166 # Needed for CoreGraphics:
167 "ApplicationServices.framework",
168
noahricc594aa612016-08-16 18:21:18 -0700169 "AudioToolbox.framework",
170 "CoreAudio.framework",
kjellanderbac04122016-06-02 02:18:48 -0700171
noahricc594aa612016-08-16 18:21:18 -0700172 # Needed for CGEventSourceKeyState in audio_device_mac.cc:
173 "CoreGraphics.framework",
174 ]
175 }
176 if (is_ios) {
177 public_deps = [
178 "../../sdk:rtc_sdk_common_objc",
179 ]
180 sources += [
181 "ios/audio_device_ios.h",
182 "ios/audio_device_ios.mm",
183 "ios/audio_device_not_implemented_ios.mm",
184 "ios/audio_session_observer.h",
185 "ios/objc/RTCAudioSession+Configuration.mm",
186 "ios/objc/RTCAudioSession+Private.h",
187 "ios/objc/RTCAudioSession.h",
188 "ios/objc/RTCAudioSession.mm",
189 "ios/objc/RTCAudioSessionConfiguration.h",
190 "ios/objc/RTCAudioSessionConfiguration.m",
191 "ios/objc/RTCAudioSessionDelegateAdapter.h",
192 "ios/objc/RTCAudioSessionDelegateAdapter.mm",
193 "ios/voice_processing_audio_unit.h",
194 "ios/voice_processing_audio_unit.mm",
195 ]
196 configs += [ "//build/config/compiler:enable_arc" ]
kjellander95177d12016-04-07 00:13:58 -0700197
noahricc594aa612016-08-16 18:21:18 -0700198 libs = [
199 "AudioToolbox.framework",
200 "AVFoundation.framework",
201 "Foundation.framework",
202 "UIKit.framework",
203 ]
204 }
205 if (is_win) {
206 sources += [
207 "win/audio_device_core_win.cc",
208 "win/audio_device_core_win.h",
209 "win/audio_device_wave_win.cc",
210 "win/audio_device_wave_win.h",
211 "win/audio_mixer_manager_win.cc",
212 "win/audio_mixer_manager_win.h",
213 ]
214 libs = [
215 # Required for the built-in WASAPI AEC.
216 "dmoguids.lib",
217 "wmcodecdspuuid.lib",
218 "amstrmid.lib",
219 "msdmo.lib",
220 ]
221 }
ehmaldonadod02fe4b2016-08-26 13:31:24 -0700222 configs += [ ":audio_device_warnings_config" ]
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +0000223 }
224 } else {
225 defines = [ "WEBRTC_DUMMY_AUDIO_BUILD" ]
226 }
227
228 if (!build_with_chromium) {
229 sources += [
230 # Do not link these into Chrome since they contain static data.
231 "dummy/file_audio_device_factory.cc",
232 "dummy/file_audio_device_factory.h",
233 ]
234 }
235
236 if (is_clang) {
237 # Suppress warnings from Chrome's Clang plugins.
238 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
ehmaldonado38a21322016-09-02 04:10:34 -0700239 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +0000240 }
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +0000241}
maxmorin69105372016-08-16 02:17:44 -0700242
243# These tests do not work on ios, see
244# https://bugs.chromium.org/p/webrtc/issues/detail?id=4755
245if (rtc_include_tests && !is_ios) {
ehmaldonado38a21322016-09-02 04:10:34 -0700246 rtc_executable("audio_device_tests") {
maxmorin69105372016-08-16 02:17:44 -0700247 testonly = true
248 sources = [
249 "test/audio_device_test_api.cc",
250 "test/audio_device_test_defines.h",
251 ]
252 deps = [
253 ":audio_device",
254 "../..:webrtc_common",
255 "../../system_wrappers",
256 "../../test:test_support",
257 "../../test:test_support_main",
258 "../rtp_rtcp",
259 "../utility",
260 "//testing/gtest",
261 ]
ehmaldonadoe9cc6862016-09-05 06:10:18 -0700262 public_configs = [ ":audio_device_config" ]
maxmorin69105372016-08-16 02:17:44 -0700263 }
264}