Source code
Revision control
Copy as Markdown
Other Tools
# 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("//chromium/build/config/android/config.gni")
import("//chromium/build/config/android/rules.gni")
}
config("audio_device_warnings_config") {
if (is_win && is_clang) {
cflags = [
# Disable warnings failing when compiling with Clang on Windows.
"-Wno-microsoft-goto",
]
}
}
rtc_source_set("audio_device_default") {
visibility = [ "*" ]
sources = [ "include/audio_device_default.h" ]
deps = [ "../../api/audio:audio_device" ]
}
rtc_source_set("audio_device") {
visibility = [ "*" ]
public_deps += [ # no-presubmit-check TODO(webrtc:8603)
":audio_device_api",
# Deprecated.
# TODO(webrtc:7452): Remove this public dep. audio_device_impl should
# be depended on directly if needed.
":audio_device_impl",
]
}
}
rtc_source_set("audio_device_api") {
visibility = [ "*" ]
sources = [
"include/audio_device.h",
"include/audio_device_defines.h",
]
deps = [ "../../api/audio:audio_device" ]
}
rtc_library("audio_device_config") {
sources = [ "audio_device_config.h" ]
}
rtc_library("audio_device_buffer") {
sources = [
"audio_device_buffer.cc",
"audio_device_buffer.h",
"fine_audio_buffer.cc",
"fine_audio_buffer.h",
]
deps = [
"../../api:array_view",
"../../api:sequence_checker",
"../../api/audio:audio_device",
"../../api/task_queue",
"../../common_audio:common_audio_c",
"../../rtc_base:buffer",
"../../rtc_base:checks",
"../../rtc_base:event_tracer",
"../../rtc_base:logging",
"../../rtc_base:macromagic",
"../../rtc_base:safe_conversions",
"../../rtc_base:timestamp_aligner",
"../../rtc_base:timeutils",
"../../rtc_base/synchronization:mutex",
"../../system_wrappers",
"../../system_wrappers:metrics",
]
}
}
rtc_library("audio_device_generic") {
sources = [
"audio_device_generic.cc",
"audio_device_generic.h",
]
deps = [
":audio_device_buffer",
"../../api/audio:audio_device",
"../../rtc_base:logging",
]
}
rtc_library("audio_device_name") {
sources = [
"audio_device_name.cc",
"audio_device_name.h",
]
deps = [ "//third_party/abseil-cpp/absl/strings:string_view" ]
}
rtc_source_set("windows_core_audio_utility") {
if (is_win && !build_with_chromium) {
sources = [
"win/core_audio_utility_win.cc",
"win/core_audio_utility_win.h",
]
deps = [
":audio_device_name",
"../../api/audio:audio_device",
"../../api/units:time_delta",
"../../rtc_base:checks",
"../../rtc_base:logging",
"../../rtc_base:macromagic",
"../../rtc_base:platform_thread_types",
"../../rtc_base:stringutils",
"../../rtc_base/win:windows_version",
"//third_party/abseil-cpp/absl/strings:strings",
]
libs = [ "oleaut32.lib" ]
}
}
# An ADM with a dedicated factory method which does not depend on the
# audio_device_impl target. The goal is to use this new structure and
# gradually phase out the old design.
# TODO(henrika): currently only supported on Windows.
rtc_source_set("audio_device_module_from_input_and_output") {
visibility = [ "*" ]
if (is_win && !build_with_chromium) {
sources = [
"include/audio_device_factory.cc",
"include/audio_device_factory.h",
]
sources += [
"win/audio_device_module_win.cc",
"win/audio_device_module_win.h",
"win/core_audio_base_win.cc",
"win/core_audio_base_win.h",
"win/core_audio_input_win.cc",
"win/core_audio_input_win.h",
"win/core_audio_output_win.cc",
"win/core_audio_output_win.h",
]
deps = [
":audio_device_buffer",
":windows_core_audio_utility",
"../../api:make_ref_counted",
"../../api:scoped_refptr",
"../../api:sequence_checker",
"../../api/audio:audio_device",
"../../api/task_queue",
"../../rtc_base:checks",
"../../rtc_base:logging",
"../../rtc_base:macromagic",
"../../rtc_base:platform_thread",
"../../rtc_base:safe_conversions",
"../../rtc_base:stringutils",
"../../rtc_base:timeutils",
"../../rtc_base/win:scoped_com_initializer",
"../../rtc_base/win:windows_version",
"//third_party/abseil-cpp/absl/strings:strings",
]
}
}
if (!build_with_chromium) {
rtc_library("test_audio_device_module") {
visibility = [ "*" ]
sources = [
"include/test_audio_device.cc",
"include/test_audio_device.h",
"test_audio_device_impl.cc",
"test_audio_device_impl.h",
]
deps = [
":audio_device_buffer",
":audio_device_default",
":audio_device_generic",
":audio_device_impl",
"../../api:array_view",
"../../api:make_ref_counted",
"../../api:scoped_refptr",
"../../api/audio:audio_device",
"../../api/task_queue",
"../../api/units:time_delta",
"../../common_audio",
"../../rtc_base:buffer",
"../../rtc_base:checks",
"../../rtc_base:logging",
"../../rtc_base:macromagic",
"../../rtc_base:platform_thread",
"../../rtc_base:random",
"../../rtc_base:rtc_event",
"../../rtc_base:safe_conversions",
"../../rtc_base:timeutils",
"../../rtc_base/synchronization:mutex",
"../../rtc_base/task_utils:repeating_task",
"//third_party/abseil-cpp/absl/strings:string_view",
]
}
}
rtc_library("audio_device_dummy") {
visibility = [ "*" ]
sources = [
"dummy/audio_device_dummy.cc",
"dummy/audio_device_dummy.h",
]
deps = [
":audio_device_buffer",
":audio_device_generic",
"../../api/audio:audio_device",
]
}
if (!build_with_chromium) {
rtc_library("file_audio_device") {
visibility = [ "*" ]
sources = [
"dummy/file_audio_device.cc",
"dummy/file_audio_device.h",
"dummy/file_audio_device_factory.cc",
"dummy/file_audio_device_factory.h",
]
defines = []
if (rtc_use_dummy_audio_file_devices) {
defines += [ "WEBRTC_DUMMY_FILE_DEVICES" ]
}
deps = [
":audio_device_generic",
"../../rtc_base:checks",
"../../rtc_base:logging",
"../../rtc_base:platform_thread",
"../../rtc_base:stringutils",
"../../rtc_base:timeutils",
"../../rtc_base/synchronization:mutex",
"../../rtc_base/system:file_wrapper",
"../../system_wrappers",
"//third_party/abseil-cpp/absl/strings:string_view",
]
}
}
# Contains default implementations of webrtc::AudioDeviceModule for Windows,
# Linux, Mac, iOS and Android.
rtc_library("audio_device_impl") {
visibility = [ "*" ]
deps = [
":audio_device_buffer",
":audio_device_config",
":audio_device_default",
":audio_device_dummy",
":audio_device_generic",
"../../api:array_view",
"../../api:make_ref_counted",
"../../api:refcountedbase",
"../../api:scoped_refptr",
"../../api:sequence_checker",
"../../api/audio:audio_device",
"../../api/task_queue",
"../../api/units:time_delta",
"../../common_audio",
"../../common_audio:common_audio_c",
"../../rtc_base:buffer",
"../../rtc_base:checks",
"../../rtc_base:logging",
"../../rtc_base:macromagic",
"../../rtc_base:platform_thread",
"../../rtc_base:random",
"../../rtc_base:rtc_event",
"../../rtc_base:safe_conversions",
"../../rtc_base:stringutils",
"../../rtc_base:timeutils",
"../../rtc_base/synchronization:mutex",
"../../rtc_base/system:arch",
"../../rtc_base/system:file_wrapper",
"../../rtc_base/task_utils:repeating_task",
"../../system_wrappers",
"../../system_wrappers:field_trial",
"../../system_wrappers:metrics",
"../utility",
"//third_party/abseil-cpp/absl/base:core_headers",
"//third_party/abseil-cpp/absl/strings:string_view",
]
if (rtc_include_internal_audio_device && is_ios) {
deps += [ "../../sdk:audio_device" ]
}
sources = [ "include/fake_audio_device.h" ]
if (build_with_mozilla) {
sources -= [
"include/test_audio_device.cc",
"include/test_audio_device.h",
]
}
defines = []
cflags = []
if (rtc_audio_device_plays_sinus_tone) {
defines += [ "AUDIO_DEVICE_PLAYS_SINUS_TONE" ]
}
if (rtc_enable_android_aaudio) {
defines += [ "WEBRTC_AUDIO_DEVICE_INCLUDE_ANDROID_AAUDIO" ]
}
if (rtc_include_internal_audio_device) {
sources += [
"audio_device_data_observer.cc",
"audio_device_impl.cc",
"audio_device_impl.h",
"include/audio_device_data_observer.h",
]
if (is_android) {
deps += [ "../../sdk/android:native_api_audio_device_module" ]
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 || is_chromeos) {
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 += [ "WEBRTC_ENABLE_LINUX_ALSA" ]
libs = [ "dl" ]
if (rtc_use_x11) {
libs += [ "X11" ]
defines += [ "WEBRTC_USE_X11" ]
}
if (rtc_include_pulse_audio) {
defines += [ "WEBRTC_ENABLE_LINUX_PULSE" ]
}
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",
]
}
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 += [
":audio_device_impl_frameworks",
"../third_party/portaudio:mac_portaudio",
]
}
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",
"oleaut32.lib",
]
deps += [
"../../rtc_base:win32",
"../../rtc_base/win:scoped_com_initializer",
]
}
configs += [ ":audio_device_warnings_config" ]
}
} else {
defines = [ "WEBRTC_DUMMY_AUDIO_BUILD" ]
}
if (!build_with_chromium) {
deps += [ ":file_audio_device" ]
# TODO(titovartem): remove after downstream is fixed
sources += [ "dummy/file_audio_device_factory.h" ]
}
}
}
if (is_mac) {
rtc_source_set("audio_device_impl_frameworks") {
visibility = [ ":*" ]
frameworks = [
# Needed for CoreGraphics:
"ApplicationServices.framework",
"AudioToolbox.framework",
"CoreAudio.framework",
# Needed for CGEventSourceKeyState in audio_device_mac.cc:
"CoreGraphics.framework",
]
}
}
rtc_source_set("mock_audio_device") {
visibility = [ "*" ]
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",
"../../api:make_ref_counted",
"../../api/audio:audio_device",
"../../test:test_support",
]
}
}
if (rtc_include_tests && !build_with_chromium && !build_with_mozilla) {
rtc_library("audio_device_unittests") {
testonly = true
sources = [
"fine_audio_buffer_unittest.cc",
"include/test_audio_device_unittest.cc",
"test_audio_device_impl_test.cc",
]
deps = [
":audio_device",
":audio_device_buffer",
":audio_device_generic",
":audio_device_impl",
":mock_audio_device",
":test_audio_device_module",
"../../api:array_view",
"../../api:scoped_refptr",
"../../api:sequence_checker",
"../../api/audio:audio_device",
"../../api/task_queue",
"../../api/task_queue:default_task_queue_factory",
"../../api/units:time_delta",
"../../api/units:timestamp",
"../../common_audio",
"../../rtc_base:buffer",
"../../rtc_base:checks",
"../../rtc_base:logging",
"../../rtc_base:macromagic",
"../../rtc_base:race_checker",
"../../rtc_base:rtc_event",
"../../rtc_base:safe_conversions",
"../../rtc_base:timeutils",
"../../rtc_base/synchronization:mutex",
"../../system_wrappers",
"../../test:fileutils",
"../../test:test_support",
"../../test/time_controller",
]
if (is_linux || is_chromeos || is_mac || is_win) {
sources += [ "audio_device_unittest.cc" ]
}
if (is_win) {
sources += [ "win/core_audio_utility_win_unittest.cc" ]
deps += [
":audio_device_module_from_input_and_output",
":windows_core_audio_utility",
"../../rtc_base/win:scoped_com_initializer",
"../../rtc_base/win:windows_version",
]
}
if (is_android) {
deps += [
"../../sdk/android:internal_jni",
"../../sdk/android:libjingle_peerconnection_java",
"../../sdk/android:native_api_jni",
"../../sdk/android:native_test_jni_onload",
"../utility",
]
}
if (!rtc_include_internal_audio_device) {
defines = [ "WEBRTC_DUMMY_AUDIO_BUILD" ]
}
}
}