blob: c9c524a82dbc59b0bc7da0eb8dfd66c2e245a803 [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
kjellanderb62dbbe2016-09-23 00:38:52 -070051rtc_static_library("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",
56 "../../base:rtc_base_approved",
maxmorin69105372016-08-16 02:17:44 -070057 "../../base:rtc_task_queue",
Zeke Chinb3fb71c2016-02-18 15:44:07 -080058 "../../common_audio",
59 "../../system_wrappers",
60 "../utility",
61 ]
62
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +000063 sources = [
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +000064 "audio_device_buffer.cc",
65 "audio_device_buffer.h",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +020066 "audio_device_config.h",
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +000067 "audio_device_generic.cc",
68 "audio_device_generic.h",
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +000069 "dummy/audio_device_dummy.cc",
70 "dummy/audio_device_dummy.h",
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +000071 "dummy/file_audio_device.cc",
72 "dummy/file_audio_device.h",
henrika86d907c2015-09-07 16:09:50 +020073 "fine_audio_buffer.cc",
74 "fine_audio_buffer.h",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +020075 "include/audio_device.h",
76 "include/audio_device_defines.h",
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +000077 ]
78
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +000079 include_dirs = []
80 if (is_linux) {
81 include_dirs += [ "linux" ]
82 }
83 if (is_ios) {
84 include_dirs += [ "ios" ]
85 }
86 if (is_mac) {
87 include_dirs += [ "mac" ]
88 }
89 if (is_win) {
90 include_dirs += [ "win" ]
91 }
92 if (is_android) {
93 include_dirs += [ "android" ]
94 }
Henrik Kjellanderb79472a2015-10-14 08:13:58 +020095 defines = []
kjellander70bed7d2015-11-23 17:23:44 -080096 cflags = []
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +000097 if (rtc_include_internal_audio_device) {
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +000098 sources += [
Tommi931e6582015-05-20 09:44:38 +020099 "audio_device_impl.cc",
100 "audio_device_impl.h",
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +0000101 ]
kjellandera46a4c92016-01-07 02:54:22 -0800102 if (is_android) {
103 sources += [
104 "android/audio_device_template.h",
105 "android/audio_manager.cc",
106 "android/audio_manager.h",
107 "android/audio_record_jni.cc",
108 "android/audio_record_jni.h",
109 "android/audio_track_jni.cc",
110 "android/audio_track_jni.h",
111 "android/build_info.cc",
112 "android/build_info.h",
113 "android/opensles_common.cc",
114 "android/opensles_common.h",
115 "android/opensles_player.cc",
116 "android/opensles_player.h",
henrika918b5542016-09-19 15:44:09 +0200117 "android/opensles_recorder.cc",
118 "android/opensles_recorder.h",
kjellandera46a4c92016-01-07 02:54:22 -0800119 ]
120 libs = [
121 "log",
122 "OpenSLES",
123 ]
124 }
noahricc594aa612016-08-16 18:21:18 -0700125 if (rtc_use_dummy_audio_file_devices) {
126 defines += [ "WEBRTC_DUMMY_FILE_DEVICES" ]
127 } else {
128 if (is_linux) {
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +0000129 sources += [
noahricc594aa612016-08-16 18:21:18 -0700130 "linux/alsasymboltable_linux.cc",
131 "linux/alsasymboltable_linux.h",
132 "linux/audio_device_alsa_linux.cc",
133 "linux/audio_device_alsa_linux.h",
134 "linux/audio_mixer_manager_alsa_linux.cc",
135 "linux/audio_mixer_manager_alsa_linux.h",
136 "linux/latebindingsymboltable_linux.cc",
137 "linux/latebindingsymboltable_linux.h",
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +0000138 ]
noahricc594aa612016-08-16 18:21:18 -0700139 defines += [ "LINUX_ALSA" ]
140 libs = [
141 "dl",
142 "X11",
143 ]
144 if (rtc_include_pulse_audio) {
145 sources += [
146 "linux/audio_device_pulse_linux.cc",
147 "linux/audio_device_pulse_linux.h",
148 "linux/audio_mixer_manager_pulse_linux.cc",
149 "linux/audio_mixer_manager_pulse_linux.h",
150 "linux/pulseaudiosymboltable_linux.cc",
151 "linux/pulseaudiosymboltable_linux.h",
152 ]
153 defines += [ "LINUX_PULSE" ]
154 }
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +0000155 }
noahricc594aa612016-08-16 18:21:18 -0700156 if (is_mac) {
157 sources += [
158 "mac/audio_device_mac.cc",
159 "mac/audio_device_mac.h",
160 "mac/audio_mixer_manager_mac.cc",
161 "mac/audio_mixer_manager_mac.h",
162 "mac/portaudio/pa_memorybarrier.h",
163 "mac/portaudio/pa_ringbuffer.c",
164 "mac/portaudio/pa_ringbuffer.h",
165 ]
166 libs = [
maxmorin2ec45b92016-08-24 06:51:09 -0700167 # Needed for CoreGraphics:
168 "ApplicationServices.framework",
169
noahricc594aa612016-08-16 18:21:18 -0700170 "AudioToolbox.framework",
171 "CoreAudio.framework",
kjellanderbac04122016-06-02 02:18:48 -0700172
noahricc594aa612016-08-16 18:21:18 -0700173 # Needed for CGEventSourceKeyState in audio_device_mac.cc:
174 "CoreGraphics.framework",
175 ]
176 }
177 if (is_ios) {
178 public_deps = [
maxmorinec623742016-09-15 05:11:55 -0700179 "../../base:rtc_base",
noahricc594aa612016-08-16 18:21:18 -0700180 "../../sdk:rtc_sdk_common_objc",
181 ]
182 sources += [
183 "ios/audio_device_ios.h",
184 "ios/audio_device_ios.mm",
185 "ios/audio_device_not_implemented_ios.mm",
186 "ios/audio_session_observer.h",
187 "ios/objc/RTCAudioSession+Configuration.mm",
188 "ios/objc/RTCAudioSession+Private.h",
189 "ios/objc/RTCAudioSession.h",
190 "ios/objc/RTCAudioSession.mm",
191 "ios/objc/RTCAudioSessionConfiguration.h",
192 "ios/objc/RTCAudioSessionConfiguration.m",
193 "ios/objc/RTCAudioSessionDelegateAdapter.h",
194 "ios/objc/RTCAudioSessionDelegateAdapter.mm",
195 "ios/voice_processing_audio_unit.h",
196 "ios/voice_processing_audio_unit.mm",
197 ]
198 configs += [ "//build/config/compiler:enable_arc" ]
kjellander95177d12016-04-07 00:13:58 -0700199
noahricc594aa612016-08-16 18:21:18 -0700200 libs = [
201 "AudioToolbox.framework",
202 "AVFoundation.framework",
203 "Foundation.framework",
204 "UIKit.framework",
205 ]
206 }
207 if (is_win) {
208 sources += [
209 "win/audio_device_core_win.cc",
210 "win/audio_device_core_win.h",
211 "win/audio_device_wave_win.cc",
212 "win/audio_device_wave_win.h",
213 "win/audio_mixer_manager_win.cc",
214 "win/audio_mixer_manager_win.h",
215 ]
216 libs = [
217 # Required for the built-in WASAPI AEC.
218 "dmoguids.lib",
219 "wmcodecdspuuid.lib",
220 "amstrmid.lib",
221 "msdmo.lib",
222 ]
223 }
ehmaldonadod02fe4b2016-08-26 13:31:24 -0700224 configs += [ ":audio_device_warnings_config" ]
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +0000225 }
226 } else {
227 defines = [ "WEBRTC_DUMMY_AUDIO_BUILD" ]
228 }
229
230 if (!build_with_chromium) {
231 sources += [
232 # Do not link these into Chrome since they contain static data.
233 "dummy/file_audio_device_factory.cc",
234 "dummy/file_audio_device_factory.h",
235 ]
236 }
237
kjellandere40a7ee2016-10-16 23:56:12 -0700238 if (!build_with_chromium && is_clang) {
239 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
ehmaldonado38a21322016-09-02 04:10:34 -0700240 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +0000241 }
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +0000242}
maxmorin69105372016-08-16 02:17:44 -0700243
aleloi5de52fd2016-11-10 01:05:34 -0800244if (rtc_include_tests) {
245 rtc_source_set("mock_audio_device") {
246 testonly = true
247 sources = [
248 "include/mock_audio_device.h",
249 "include/mock_audio_transport.h",
250 ]
251 deps = [
252 ":audio_device",
253 "../../test:test_support",
254 ]
255 if (is_win) {
256 cflags = [
257 # TODO(phoglund): get rid of 4373 supression when
258 # http://code.google.com/p/webrtc/issues/detail?id=261 is solved.
259 # legacy warning for ignoring const / volatile in signatures.
260 "/wd4373",
261 ]
262 }
263 }
264}
265
maxmorin69105372016-08-16 02:17:44 -0700266# These tests do not work on ios, see
267# https://bugs.chromium.org/p/webrtc/issues/detail?id=4755
268if (rtc_include_tests && !is_ios) {
ehmaldonado38a21322016-09-02 04:10:34 -0700269 rtc_executable("audio_device_tests") {
maxmorin69105372016-08-16 02:17:44 -0700270 testonly = true
271 sources = [
272 "test/audio_device_test_api.cc",
273 "test/audio_device_test_defines.h",
274 ]
275 deps = [
276 ":audio_device",
277 "../..:webrtc_common",
278 "../../system_wrappers",
279 "../../test:test_support",
280 "../../test:test_support_main",
281 "../rtp_rtcp",
282 "../utility",
283 "//testing/gtest",
284 ]
ehmaldonadoe9cc6862016-09-05 06:10:18 -0700285 public_configs = [ ":audio_device_config" ]
maxmorin69105372016-08-16 02:17:44 -0700286 }
287}