blob: d1d3159dac9c05d7f6c07bdbad1bca3bb0fdd3b3 [file] [log] [blame]
# Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. All contributing project authors may
# be found in the AUTHORS file in the root of the source tree.
import("../../webrtc.gni")
if (is_android) {
import("//build/config/android/config.gni")
import("//build/config/android/rules.gni")
}
config("audio_device_config") {
include_dirs = [
"../include",
"include",
"dummy", # Contains dummy audio device implementations.
]
}
config("audio_device_warnings_config") {
if (is_win && is_clang) {
cflags = [
# Disable warnings failing when compiling with Clang on Windows.
# https://bugs.chromium.org/p/webrtc/issues/detail?id=5366
"-Wno-bool-conversion",
"-Wno-delete-non-virtual-dtor",
"-Wno-logical-op-parentheses",
"-Wno-microsoft-extra-qualification",
"-Wno-microsoft-goto",
"-Wno-missing-braces",
"-Wno-parentheses-equality",
"-Wno-reorder",
"-Wno-shift-overflow",
"-Wno-tautological-compare",
# See https://bugs.chromium.org/p/webrtc/issues/detail?id=6265
# for -Wno-thread-safety-analysis
"-Wno-thread-safety-analysis",
"-Wno-unused-private-field",
]
}
}
rtc_source_set("audio_device") {
visibility = [ "*" ]
public_deps = [
":audio_device_api",
# Deprecated.
# TODO(webrtc:7452): Remove this public dep. audio_device_impl should
# be depended on directly if needed.
":audio_device_impl",
]
}
if (rtc_include_internal_audio_device && is_ios) {
rtc_source_set("audio_device_ios_objc") {
visibility = [
":audio_device_impl",
":audio_device_ios_objc_unittests",
]
sources = [
"ios/audio_device_ios.h",
"ios/audio_device_ios.mm",
"ios/audio_device_not_implemented_ios.mm",
"ios/audio_session_observer.h",
"ios/objc/RTCAudioSession.h",
"ios/objc/RTCAudioSessionConfiguration.h",
"ios/objc/RTCAudioSessionDelegateAdapter.h",
"ios/objc/RTCAudioSessionDelegateAdapter.mm",
"ios/voice_processing_audio_unit.h",
"ios/voice_processing_audio_unit.mm",
]
libs = [
"AudioToolbox.framework",
"AVFoundation.framework",
"Foundation.framework",
"UIKit.framework",
]
deps = [
":audio_device_api",
":audio_device_buffer",
":audio_device_generic",
"../../api:array_view",
"../../rtc_base:checks",
"../../rtc_base:gtest_prod",
"../../rtc_base:rtc_base",
"../../rtc_base/system:fallthrough",
"../../sdk:audio_objc",
"../../sdk:common_objc",
"../../system_wrappers:metrics_api",
]
if (!build_with_chromium && is_clang) {
# Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
}
}
}
rtc_source_set("audio_device_api") {
visibility = [
":audio_device",
":audio_device_buffer",
":audio_device_impl",
":audio_device_ios_objc",
":audio_device_generic",
]
sources = [
"include/audio_device.h",
"include/audio_device_defines.h",
]
deps = [
"../../:typedefs",
"../../rtc_base:checks",
"../../rtc_base:deprecation",
"../../rtc_base:rtc_base_approved",
"../../rtc_base:stringutils",
]
if (!build_with_chromium && is_clang) {
# Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
}
}
rtc_source_set("audio_device_buffer") {
sources = [
"audio_device_buffer.cc",
"audio_device_buffer.h",
"audio_device_config.h",
"fine_audio_buffer.cc",
"fine_audio_buffer.h",
]
deps = [
":audio_device_api",
"../../:typedefs",
"../../api:array_view",
"../../common_audio:common_audio_c",
"../../rtc_base:checks",
"../../rtc_base:rtc_base_approved",
"../../rtc_base:rtc_task_queue",
"../../system_wrappers",
"../../system_wrappers:metrics_api",
]
if (!build_with_chromium && is_clang) {
# Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
}
}
rtc_source_set("audio_device_generic") {
sources = [
"audio_device_generic.cc",
"audio_device_generic.h",
]
deps = [
":audio_device_api",
":audio_device_buffer",
"../../rtc_base:rtc_base_approved",
]
if (!build_with_chromium && is_clang) {
# Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
}
}
# Contains default implementations of webrtc::AudioDeviceModule for Windows,
# Linux, Mac, iOS and Android.
rtc_source_set("audio_device_impl") {
visibility = [ "*" ]
public_configs = [ ":audio_device_config" ]
deps = [
":audio_device_api",
":audio_device_buffer",
":audio_device_generic",
"../..:webrtc_common",
"../../:typedefs",
"../../api:array_view",
"../../common_audio",
"../../common_audio:common_audio_c",
"../../rtc_base:checks",
"../../rtc_base:deprecation",
"../../rtc_base:rtc_base_approved",
"../../rtc_base:rtc_task_queue",
"../../rtc_base/system:file_wrapper",
"../../system_wrappers",
"../../system_wrappers:metrics_api",
"../utility",
]
if (rtc_include_internal_audio_device && is_ios) {
deps += [ ":audio_device_ios_objc" ]
}
sources = [
"dummy/audio_device_dummy.cc",
"dummy/audio_device_dummy.h",
"dummy/file_audio_device.cc",
"dummy/file_audio_device.h",
"include/fake_audio_device.h",
"include/test_audio_device.cc",
"include/test_audio_device.h",
]
if (build_with_mozilla) {
sources += [
"opensl/single_rw_fifo.cc",
"opensl/single_rw_fifo.h",
]
}
include_dirs = []
if (is_linux) {
include_dirs += [ "linux" ]
}
if (is_ios) {
include_dirs += [ "ios" ]
}
if (is_mac) {
include_dirs += [ "mac" ]
}
if (is_win) {
include_dirs += [ "win" ]
}
if (is_android) {
include_dirs += [ "android" ]
}
defines = []
cflags = []
if (rtc_audio_device_plays_sinus_tone) {
defines += [ "AUDIO_DEVICE_PLAYS_SINUS_TONE" ]
}
if (rtc_enable_android_aaudio) {
defines += [ "AUDIO_DEVICE_INCLUDE_ANDROID_AAUDIO" ]
}
if (rtc_include_internal_audio_device) {
# TODO(bugs.webrtc.org/8850): remove this when the circular dependency will be fixed.
check_includes = false
sources += [
"audio_device_data_observer.cc",
"audio_device_impl.cc",
"audio_device_impl.h",
"include/audio_device_data_observer.h",
]
if (is_android) {
sources += [
"android/audio_common.h",
"android/audio_device_template.h",
"android/audio_manager.cc",
"android/audio_manager.h",
"android/audio_record_jni.cc",
"android/audio_record_jni.h",
"android/audio_track_jni.cc",
"android/audio_track_jni.h",
"android/build_info.cc",
"android/build_info.h",
"android/opensles_common.cc",
"android/opensles_common.h",
"android/opensles_player.cc",
"android/opensles_player.h",
"android/opensles_recorder.cc",
"android/opensles_recorder.h",
]
libs = [
"log",
"OpenSLES",
]
if (rtc_enable_android_aaudio) {
sources += [
"android/aaudio_player.cc",
"android/aaudio_player.h",
"android/aaudio_recorder.cc",
"android/aaudio_recorder.h",
"android/aaudio_wrapper.cc",
"android/aaudio_wrapper.h",
]
libs += [ "aaudio" ]
}
if (build_with_mozilla) {
include_dirs += [
"/config/external/nspr",
"/nsprpub/lib/ds",
"/nsprpub/pr/include",
]
}
}
if (rtc_use_dummy_audio_file_devices) {
defines += [ "WEBRTC_DUMMY_FILE_DEVICES" ]
} else {
if (is_linux) {
sources += [
"linux/alsasymboltable_linux.cc",
"linux/alsasymboltable_linux.h",
"linux/audio_device_alsa_linux.cc",
"linux/audio_device_alsa_linux.h",
"linux/audio_mixer_manager_alsa_linux.cc",
"linux/audio_mixer_manager_alsa_linux.h",
"linux/latebindingsymboltable_linux.cc",
"linux/latebindingsymboltable_linux.h",
]
defines += [ "LINUX_ALSA" ]
libs = [ "dl" ]
if (rtc_use_x11) {
libs += [ "X11" ]
defines += [ "WEBRTC_USE_X11" ]
}
if (rtc_include_pulse_audio) {
sources += [
"linux/audio_device_pulse_linux.cc",
"linux/audio_device_pulse_linux.h",
"linux/audio_mixer_manager_pulse_linux.cc",
"linux/audio_mixer_manager_pulse_linux.h",
"linux/pulseaudiosymboltable_linux.cc",
"linux/pulseaudiosymboltable_linux.h",
]
defines += [ "LINUX_PULSE" ]
}
}
if (is_mac) {
sources += [
"mac/audio_device_mac.cc",
"mac/audio_device_mac.h",
"mac/audio_mixer_manager_mac.cc",
"mac/audio_mixer_manager_mac.h",
]
deps += [ ":mac_portaudio" ]
libs = [
# Needed for CoreGraphics:
"ApplicationServices.framework",
"AudioToolbox.framework",
"CoreAudio.framework",
# Needed for CGEventSourceKeyState in audio_device_mac.cc:
"CoreGraphics.framework",
]
}
if (is_win) {
sources += [
"win/audio_device_core_win.cc",
"win/audio_device_core_win.h",
]
libs = [
# Required for the built-in WASAPI AEC.
"dmoguids.lib",
"wmcodecdspuuid.lib",
"amstrmid.lib",
"msdmo.lib",
]
}
configs += [ ":audio_device_warnings_config" ]
}
} else {
defines = [ "WEBRTC_DUMMY_AUDIO_BUILD" ]
}
if (!build_with_chromium) {
sources += [
# Do not link these into Chrome since they contain static data.
"dummy/file_audio_device_factory.cc",
"dummy/file_audio_device_factory.h",
]
}
if (!build_with_chromium && is_clang) {
# Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
}
}
rtc_source_set("mac_portaudio") {
visibility = [ ":*" ] # Only targets in this file can depend on this.
sources = [
"mac/portaudio/pa_memorybarrier.h",
"mac/portaudio/pa_ringbuffer.c",
"mac/portaudio/pa_ringbuffer.h",
]
}
rtc_source_set("mock_audio_device") {
testonly = true
sources = [
"include/mock_audio_device.h",
"include/mock_audio_transport.h",
"mock_audio_device_buffer.h",
]
deps = [
":audio_device",
":audio_device_buffer",
":audio_device_impl",
"../../test:test_support",
]
}
if (rtc_include_tests) {
# TODO(kthelgason): Reenable these tests on simulator.
# See bugs.webrtc.org/7812
if (is_ios && !use_ios_simulator) {
rtc_source_set("audio_device_ios_objc_unittests") {
testonly = true
visibility = [ ":*" ]
sources = [
"ios/audio_device_unittest_ios.mm",
]
deps = [
":audio_device",
":audio_device_buffer",
":audio_device_impl",
":audio_device_ios_objc",
":mock_audio_device",
"../../rtc_base:rtc_base_approved",
"../../sdk:audio_objc",
"../../system_wrappers",
"../../test:fileutils",
"../../test:test_support",
"//third_party/ocmock",
]
if (!build_with_chromium && is_clang) {
# Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
}
}
}
rtc_source_set("audio_device_unittests") {
testonly = true
sources = [
"fine_audio_buffer_unittest.cc",
"include/test_audio_device_unittest.cc",
]
deps = [
":audio_device",
":audio_device_buffer",
":audio_device_impl",
":mock_audio_device",
"../../api:array_view",
"../../api:optional",
"../../common_audio",
"../../rtc_base:checks",
"../../rtc_base:rtc_base_approved",
"../../system_wrappers",
"../../test:fileutils",
"../../test:test_support",
"../utility:utility",
]
if (is_linux || is_mac || is_win) {
sources += [ "audio_device_unittest.cc" ]
}
if (is_android) {
# Need to disable error due to the line in
# base/android/jni_android.h triggering it:
# const BASE_EXPORT jobject GetApplicationContext()
# error: type qualifiers ignored on function return type
cflags = [ "-Wno-ignored-qualifiers" ]
sources += [
"android/audio_device_unittest.cc",
"android/audio_manager_unittest.cc",
"android/ensure_initialized.cc",
"android/ensure_initialized.h",
]
deps += [
"../../../base",
"../../sdk/android:libjingle_peerconnection_java",
]
}
if (!build_with_chromium && is_clang) {
# Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
}
if (!rtc_include_internal_audio_device) {
defines = [ "WEBRTC_DUMMY_AUDIO_BUILD" ]
}
}
}
if (!build_with_chromium && is_android) {
rtc_android_library("audio_device_java") {
java_files = [
"android/java/src/org/webrtc/voiceengine/BuildInfo.java",
"android/java/src/org/webrtc/voiceengine/WebRtcAudioEffects.java",
"android/java/src/org/webrtc/voiceengine/WebRtcAudioManager.java",
"android/java/src/org/webrtc/voiceengine/WebRtcAudioRecord.java",
"android/java/src/org/webrtc/voiceengine/WebRtcAudioTrack.java",
"android/java/src/org/webrtc/voiceengine/WebRtcAudioUtils.java",
]
deps = [
"../../rtc_base:base_java",
]
}
}