blob: 92061a2416360b9cd907d3e76addb530359d9107 [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
27source_set("audio_device") {
Zeke Chinb3fb71c2016-02-18 15:44:07 -080028 deps = [
29 "../..:webrtc_common",
30 "../../base:rtc_base_approved",
31 "../../common_audio",
32 "../../system_wrappers",
33 "../utility",
34 ]
35
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +000036 sources = [
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +000037 "audio_device_buffer.cc",
38 "audio_device_buffer.h",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +020039 "audio_device_config.h",
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +000040 "audio_device_generic.cc",
41 "audio_device_generic.h",
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +000042 "dummy/audio_device_dummy.cc",
43 "dummy/audio_device_dummy.h",
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +000044 "dummy/file_audio_device.cc",
45 "dummy/file_audio_device.h",
henrika86d907c2015-09-07 16:09:50 +020046 "fine_audio_buffer.cc",
47 "fine_audio_buffer.h",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +020048 "include/audio_device.h",
49 "include/audio_device_defines.h",
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +000050 ]
51
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +000052 include_dirs = []
53 if (is_linux) {
54 include_dirs += [ "linux" ]
55 }
56 if (is_ios) {
57 include_dirs += [ "ios" ]
58 }
59 if (is_mac) {
60 include_dirs += [ "mac" ]
61 }
62 if (is_win) {
63 include_dirs += [ "win" ]
64 }
65 if (is_android) {
66 include_dirs += [ "android" ]
67 }
Henrik Kjellanderb79472a2015-10-14 08:13:58 +020068 defines = []
kjellander70bed7d2015-11-23 17:23:44 -080069 cflags = []
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +000070 if (rtc_include_internal_audio_device) {
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +000071 sources += [
Tommi931e6582015-05-20 09:44:38 +020072 "audio_device_impl.cc",
73 "audio_device_impl.h",
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +000074 ]
kjellandera46a4c92016-01-07 02:54:22 -080075 if (is_android) {
76 sources += [
77 "android/audio_device_template.h",
78 "android/audio_manager.cc",
79 "android/audio_manager.h",
80 "android/audio_record_jni.cc",
81 "android/audio_record_jni.h",
82 "android/audio_track_jni.cc",
83 "android/audio_track_jni.h",
84 "android/build_info.cc",
85 "android/build_info.h",
86 "android/opensles_common.cc",
87 "android/opensles_common.h",
88 "android/opensles_player.cc",
89 "android/opensles_player.h",
90 ]
91 libs = [
92 "log",
93 "OpenSLES",
94 ]
95 }
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +000096 if (is_linux) {
kjellandera46a4c92016-01-07 02:54:22 -080097 sources += [
98 "linux/alsasymboltable_linux.cc",
99 "linux/alsasymboltable_linux.h",
100 "linux/audio_device_alsa_linux.cc",
101 "linux/audio_device_alsa_linux.h",
102 "linux/audio_mixer_manager_alsa_linux.cc",
103 "linux/audio_mixer_manager_alsa_linux.h",
104 "linux/latebindingsymboltable_linux.cc",
105 "linux/latebindingsymboltable_linux.h",
106 ]
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +0000107 defines += [ "LINUX_ALSA" ]
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +0000108 libs = [
109 "dl",
110 "X11",
111 ]
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +0000112 if (rtc_include_pulse_audio) {
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +0000113 sources += [
114 "linux/audio_device_pulse_linux.cc",
115 "linux/audio_device_pulse_linux.h",
116 "linux/audio_mixer_manager_pulse_linux.cc",
117 "linux/audio_mixer_manager_pulse_linux.h",
118 "linux/pulseaudiosymboltable_linux.cc",
119 "linux/pulseaudiosymboltable_linux.h",
120 ]
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +0000121 defines += [ "LINUX_PULSE" ]
122 }
123 }
124 if (is_mac) {
kjellandera46a4c92016-01-07 02:54:22 -0800125 sources += [
126 "mac/audio_device_mac.cc",
127 "mac/audio_device_mac.h",
128 "mac/audio_mixer_manager_mac.cc",
129 "mac/audio_mixer_manager_mac.h",
130 "mac/portaudio/pa_memorybarrier.h",
131 "mac/portaudio/pa_ringbuffer.c",
132 "mac/portaudio/pa_ringbuffer.h",
133 ]
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +0000134 libs = [
135 "AudioToolbox.framework",
136 "CoreAudio.framework",
kjellanderbac04122016-06-02 02:18:48 -0700137
138 # Needed for CGEventSourceKeyState in audio_device_mac.cc:
139 "CoreGraphics.framework",
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +0000140 ]
141 }
142 if (is_ios) {
kjellanderfb114242016-06-13 00:19:48 -0700143 public_deps = [
144 "../../sdk:rtc_sdk_common_objc",
145 ]
kjellandera46a4c92016-01-07 02:54:22 -0800146 sources += [
147 "ios/audio_device_ios.h",
148 "ios/audio_device_ios.mm",
149 "ios/audio_device_not_implemented_ios.mm",
tkchine54467f2016-03-15 16:54:03 -0700150 "ios/audio_session_observer.h",
tkchin9f987d32016-03-12 20:06:28 -0800151 "ios/objc/RTCAudioSession+Configuration.mm",
Zeke Chinb3fb71c2016-02-18 15:44:07 -0800152 "ios/objc/RTCAudioSession+Private.h",
153 "ios/objc/RTCAudioSession.h",
154 "ios/objc/RTCAudioSession.mm",
tkchin9f987d32016-03-12 20:06:28 -0800155 "ios/objc/RTCAudioSessionConfiguration.h",
156 "ios/objc/RTCAudioSessionConfiguration.m",
tkchine54467f2016-03-15 16:54:03 -0700157 "ios/objc/RTCAudioSessionDelegateAdapter.h",
158 "ios/objc/RTCAudioSessionDelegateAdapter.mm",
Zeke Chin1300caa2016-03-18 14:39:11 -0700159 "ios/voice_processing_audio_unit.h",
160 "ios/voice_processing_audio_unit.mm",
kjellandera46a4c92016-01-07 02:54:22 -0800161 ]
kjellanderfb114242016-06-13 00:19:48 -0700162 configs += [ "//build/config/compiler:enable_arc" ]
kjellander95177d12016-04-07 00:13:58 -0700163
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +0000164 libs = [
165 "AudioToolbox.framework",
166 "AVFoundation.framework",
kjellander@webrtc.orgd7e34e12015-01-26 19:17:26 +0000167 "Foundation.framework",
kjellandera46a4c92016-01-07 02:54:22 -0800168 "UIKit.framework",
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +0000169 ]
170 }
171 if (is_win) {
kjellandera46a4c92016-01-07 02:54:22 -0800172 sources += [
173 "win/audio_device_core_win.cc",
174 "win/audio_device_core_win.h",
175 "win/audio_device_wave_win.cc",
176 "win/audio_device_wave_win.h",
177 "win/audio_mixer_manager_win.cc",
178 "win/audio_mixer_manager_win.h",
179 ]
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +0000180 libs = [
181 # Required for the built-in WASAPI AEC.
182 "dmoguids.lib",
183 "wmcodecdspuuid.lib",
184 "amstrmid.lib",
185 "msdmo.lib",
186 ]
187 }
188 } else {
189 defines = [ "WEBRTC_DUMMY_AUDIO_BUILD" ]
190 }
191
192 if (!build_with_chromium) {
193 sources += [
194 # Do not link these into Chrome since they contain static data.
195 "dummy/file_audio_device_factory.cc",
196 "dummy/file_audio_device_factory.h",
197 ]
198 }
199
kjellander@webrtc.orgf21ea912014-09-28 17:37:22 +0000200 configs += [ "../..:common_config" ]
201 public_configs = [
202 "../..:common_inherited_config",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200203 ":audio_device_config",
kjellander@webrtc.orgf21ea912014-09-28 17:37:22 +0000204 ]
205
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +0000206 if (is_clang) {
207 # Suppress warnings from Chrome's Clang plugins.
208 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
209 configs -= [ "//build/config/clang:find_bad_constructs" ]
210 }
kjellander@webrtc.orgc4870bb2014-09-01 04:24:11 +0000211}