blob: 7a0bce0736848319b14941cf60d05eaa678e3ab5 [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",
solenberg5de9b6a2016-11-25 00:47:04 -0800187 "ios/helpers_ios.h",
188 "ios/helpers_ios.mm",
noahricc594aa612016-08-16 18:21:18 -0700189 "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
kjellandere40a7ee2016-10-16 23:56:12 -0700240 if (!build_with_chromium && is_clang) {
241 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
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
aleloi44c7ecf2016-11-10 08:16:25 -0800246config("mock_audio_device_config") {
247 if (is_win) {
248 cflags = [
249 # TODO(phoglund): get rid of 4373 supression when
250 # http://code.google.com/p/webrtc/issues/detail?id=261 is solved.
251 # legacy warning for ignoring const / volatile in signatures.
252 "/wd4373",
253 ]
254 }
255}
256
aleloi5de52fd2016-11-10 01:05:34 -0800257if (rtc_include_tests) {
258 rtc_source_set("mock_audio_device") {
259 testonly = true
260 sources = [
261 "include/mock_audio_device.h",
262 "include/mock_audio_transport.h",
263 ]
264 deps = [
265 ":audio_device",
266 "../../test:test_support",
267 ]
aleloi44c7ecf2016-11-10 08:16:25 -0800268 all_dependent_configs = [ ":mock_audio_device_config" ]
aleloi5de52fd2016-11-10 01:05:34 -0800269 }
270}
271
maxmorin69105372016-08-16 02:17:44 -0700272# These tests do not work on ios, see
273# https://bugs.chromium.org/p/webrtc/issues/detail?id=4755
274if (rtc_include_tests && !is_ios) {
ehmaldonado38a21322016-09-02 04:10:34 -0700275 rtc_executable("audio_device_tests") {
maxmorin69105372016-08-16 02:17:44 -0700276 testonly = true
277 sources = [
278 "test/audio_device_test_api.cc",
279 "test/audio_device_test_defines.h",
280 ]
281 deps = [
282 ":audio_device",
283 "../..:webrtc_common",
284 "../../system_wrappers",
285 "../../test:test_support",
286 "../../test:test_support_main",
287 "../rtp_rtcp",
288 "../utility",
289 "//testing/gtest",
290 ]
ehmaldonadoe9cc6862016-09-05 06:10:18 -0700291 public_configs = [ ":audio_device_config" ]
maxmorin69105372016-08-16 02:17:44 -0700292 }
293}