blob: 9c8628a08045c7793f088200b58b492b9f0581cf [file] [log] [blame]
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/config/chromeos/ui_mode.gni")
import("//build/config/linux/pkg_config.gni")
import("//media/media_options.gni")
import("//testing/libfuzzer/fuzzer_test.gni")
import("//tools/generate_stubs/rules.gni")
# When libpulse is not directly linked, use stubs to allow for dlopening of the
# binary.
if (use_pulseaudio && !link_pulseaudio) {
generate_stubs("libpulse_stubs") {
extra_header = "pulse/pulse_stub_header.fragment"
sigs = [ "pulse/pulse.sigs" ]
output_name = "pulse/pulse_stubs"
deps = [ "//base" ]
}
}
if (is_android) {
generate_stubs("aaudio_stubs") {
extra_header = "android/aaudio_stub_header.fragment"
sigs = [ "android/aaudio.sigs" ]
output_name = "android/aaudio_stubs"
deps = [ "//base" ]
}
}
config("platform_config") {
defines = []
if (use_alsa) {
defines += [ "USE_ALSA" ]
}
}
source_set("audio") {
# Do not expand the visibility here without double-checking with OWNERS, this
# is a roll-up target which is part of the //media component. Most other DEPs
# should be using //media and not directly DEP this roll-up target.
visibility = [
":wav_audio_handler_fuzzer",
"//media",
"//media/renderers",
# TODO(dalecurtis): CoreAudioUtil::IsCoreAudioSupported() should probably
# move into media/base/win.
"//media/device_monitors",
# TODO(dalecurtis): Move android audio pieces into //media/audio.
"//media/base/android",
]
sources = [
"agc_audio_stream.h",
"alive_checker.cc",
"alive_checker.h",
"audio_debug_file_writer.cc",
"audio_debug_file_writer.h",
"audio_debug_recording_helper.cc",
"audio_debug_recording_helper.h",
"audio_debug_recording_manager.cc",
"audio_debug_recording_manager.h",
"audio_debug_recording_session.h",
"audio_debug_recording_session_impl.cc",
"audio_debug_recording_session_impl.h",
"audio_device_description.cc",
"audio_device_description.h",
"audio_device_name.cc",
"audio_device_name.h",
"audio_device_thread.cc",
"audio_device_thread.h",
"audio_features.cc",
"audio_features.h",
"audio_input_delegate.cc",
"audio_input_delegate.h",
"audio_input_device.cc",
"audio_input_device.h",
"audio_input_ipc.cc",
"audio_input_ipc.h",
"audio_input_stream_data_interceptor.cc",
"audio_input_stream_data_interceptor.h",
"audio_io.h",
"audio_manager.cc",
"audio_manager.h",
"audio_manager_base.cc",
"audio_manager_base.h",
"audio_opus_encoder.cc",
"audio_opus_encoder.h",
"audio_output_delegate.cc",
"audio_output_delegate.h",
"audio_output_device.cc",
"audio_output_device.h",
"audio_output_device_thread_callback.cc",
"audio_output_device_thread_callback.h",
"audio_output_dispatcher.cc",
"audio_output_dispatcher.h",
"audio_output_dispatcher_impl.cc",
"audio_output_dispatcher_impl.h",
"audio_output_ipc.cc",
"audio_output_ipc.h",
"audio_output_proxy.cc",
"audio_output_proxy.h",
"audio_output_resampler.cc",
"audio_output_resampler.h",
"audio_output_stream_sink.cc",
"audio_output_stream_sink.h",
"audio_sink_parameters.cc",
"audio_sink_parameters.h",
"audio_source_diverter.h",
"audio_source_parameters.cc",
"audio_source_parameters.h",
"audio_system.cc",
"audio_system.h",
"audio_system_helper.cc",
"audio_system_helper.h",
"audio_system_impl.cc",
"audio_system_impl.h",
"audio_thread.h",
"audio_thread_hang_monitor.cc",
"audio_thread_hang_monitor.h",
"audio_thread_impl.cc",
"audio_thread_impl.h",
"clockless_audio_sink.cc",
"clockless_audio_sink.h",
"fake_audio_input_stream.cc",
"fake_audio_input_stream.h",
"fake_audio_log_factory.cc",
"fake_audio_log_factory.h",
"fake_audio_manager.cc",
"fake_audio_manager.h",
"fake_audio_output_stream.cc",
"fake_audio_output_stream.h",
"null_audio_sink.cc",
"null_audio_sink.h",
"power_observer_helper.cc",
"power_observer_helper.h",
"scoped_task_runner_observer.cc",
"scoped_task_runner_observer.h",
"simple_sources.cc",
"simple_sources.h",
"wav_audio_handler.cc",
"wav_audio_handler.h",
]
deps = [
"//base",
"//build:chromecast_buildflags",
"//build:chromeos_buildflags",
"//media/base",
"//third_party/opus:opus",
"//url",
]
libs = []
configs += [
":platform_config",
"//media:subcomponent_config",
]
if (is_mac) {
sources += [
"mac/audio_auhal_mac.cc",
"mac/audio_auhal_mac.h",
"mac/audio_device_listener_mac.cc",
"mac/audio_device_listener_mac.h",
"mac/audio_input_mac.cc",
"mac/audio_input_mac.h",
"mac/audio_low_latency_input_mac.cc",
"mac/audio_low_latency_input_mac.h",
"mac/audio_manager_mac.cc",
"mac/audio_manager_mac.h",
"mac/core_audio_util_mac.cc",
"mac/core_audio_util_mac.h",
"mac/coreaudio_dispatch_override.cc",
"mac/coreaudio_dispatch_override.h",
"mac/scoped_audio_unit.cc",
"mac/scoped_audio_unit.h",
]
frameworks = [
"AudioToolbox.framework",
"AudioUnit.framework",
"CoreAudio.framework",
"CoreFoundation.framework",
]
}
if (is_win) {
sources += [
"win/audio_device_listener_win.cc",
"win/audio_device_listener_win.h",
"win/audio_low_latency_input_win.cc",
"win/audio_low_latency_input_win.h",
"win/audio_low_latency_output_win.cc",
"win/audio_low_latency_output_win.h",
"win/audio_manager_win.cc",
"win/audio_manager_win.h",
"win/audio_session_event_listener_win.cc",
"win/audio_session_event_listener_win.h",
"win/avrt_wrapper_win.cc",
"win/avrt_wrapper_win.h",
"win/core_audio_util_win.cc",
"win/core_audio_util_win.h",
"win/device_enumeration_win.cc",
"win/device_enumeration_win.h",
"win/volume_range_util.cc",
"win/volume_range_util.h",
"win/waveout_output_win.cc",
"win/waveout_output_win.h",
]
libs += [
"dxguid.lib",
"setupapi.lib",
"winmm.lib",
]
}
if (is_android) {
sources += [
"android/aaudio_output.cc",
"android/aaudio_output.h",
"android/audio_manager_android.cc",
"android/audio_manager_android.h",
"android/audio_track_output_stream.cc",
"android/audio_track_output_stream.h",
"android/muteable_audio_output_stream.h",
"android/opensles_input.cc",
"android/opensles_input.h",
"android/opensles_output.cc",
"android/opensles_output.h",
"android/opensles_util.cc",
"android/opensles_util.h",
"android/opensles_wrapper.cc",
]
deps += [
":aaudio_stubs",
"//media/base/android:media_jni_headers",
]
}
if (is_linux || is_chromeos) {
sources += [ "linux/audio_manager_linux.cc" ]
}
if (use_alsa) {
libs += [ "asound" ]
sources += [
"alsa/alsa_input.cc",
"alsa/alsa_input.h",
"alsa/alsa_output.cc",
"alsa/alsa_output.h",
"alsa/alsa_util.cc",
"alsa/alsa_util.h",
"alsa/alsa_wrapper.cc",
"alsa/alsa_wrapper.h",
"alsa/audio_manager_alsa.cc",
"alsa/audio_manager_alsa.h",
]
}
if (use_cras) {
sources += [
"cras/audio_manager_cras_base.cc",
"cras/audio_manager_cras_base.h",
"cras/cras_input.cc",
"cras/cras_input.h",
"cras/cras_unified.cc",
"cras/cras_unified.h",
]
configs += [ ":libcras" ]
if (is_chromeos_ash) {
sources += [
"cras/audio_manager_chromeos.cc",
"cras/audio_manager_chromeos.h",
]
deps += [ "//ash/components/audio" ]
} else if (is_linux || is_chromeos_lacros) {
sources += [
"cras/audio_manager_cras.cc",
"cras/audio_manager_cras.h",
"cras/cras_util.cc",
"cras/cras_util.h",
]
}
}
if (use_pulseaudio) {
sources += [
"pulse/audio_manager_pulse.cc",
"pulse/audio_manager_pulse.h",
"pulse/pulse_input.cc",
"pulse/pulse_input.h",
"pulse/pulse_output.cc",
"pulse/pulse_output.h",
"pulse/pulse_util.cc",
"pulse/pulse_util.h",
]
deps += [ "//build:branding_buildflags" ]
if (link_pulseaudio) {
configs += [ ":libpulse" ]
} else {
deps += [ ":libpulse_stubs" ]
}
}
if (is_fuchsia) {
sources += [
"fuchsia/audio_manager_fuchsia.cc",
"fuchsia/audio_manager_fuchsia.h",
"fuchsia/audio_output_stream_fuchsia.cc",
"fuchsia/audio_output_stream_fuchsia.h",
]
deps += [
"//third_party/fuchsia-sdk/sdk/fidl/fuchsia.media",
"//third_party/fuchsia-sdk/sdk/pkg/sys_cpp",
]
}
}
if (use_cras) {
pkg_config("libcras") {
packages = [ "libcras" ]
}
}
if (use_pulseaudio && link_pulseaudio) {
pkg_config("libpulse") {
packages = [ "libpulse" ]
}
}
# Note: This is a roll-up only target; do not expand the visibility. DEPS should
# depend on the //media:test_support target instead.
static_library("test_support") {
visibility = [ "//media:test_support" ]
testonly = true
sources = [
"audio_debug_recording_test.cc",
"audio_debug_recording_test.h",
"audio_device_info_accessor_for_tests.cc",
"audio_device_info_accessor_for_tests.h",
"audio_system_test_util.cc",
"audio_system_test_util.h",
"audio_unittest_util.cc",
"audio_unittest_util.h",
"mock_audio_debug_recording_manager.cc",
"mock_audio_debug_recording_manager.h",
"mock_audio_manager.cc",
"mock_audio_manager.h",
"mock_audio_source_callback.cc",
"mock_audio_source_callback.h",
"test_audio_thread.cc",
"test_audio_thread.h",
]
configs += [
":platform_config",
"//media:media_config",
]
deps = [
"//base",
"//base/test:test_support",
"//build:chromeos_buildflags",
# Do not add any other //media deps except this; it will automatically pull
# a dep on //media which is required to ensure test_support targets all use
# the same //media component and not build a target's sources individually.
"//media/base:test_support",
"//testing/gmock",
"//testing/gtest",
]
if (use_alsa) {
sources += [
"alsa/mock_alsa_wrapper.cc",
"alsa/mock_alsa_wrapper.h",
]
}
}
source_set("unit_tests") {
testonly = true
sources = [
"alive_checker_unittest.cc",
"audio_debug_file_writer_unittest.cc",
"audio_debug_recording_helper_unittest.cc",
"audio_debug_recording_manager_unittest.cc",
"audio_debug_recording_session_impl_unittest.cc",
"audio_encoders_unittest.cc",
"audio_input_device_unittest.cc",
"audio_input_stream_data_interceptor_unittest.cc",
"audio_input_unittest.cc",
"audio_manager_unittest.cc",
"audio_output_device_unittest.cc",
"audio_output_proxy_unittest.cc",
"audio_output_unittest.cc",
"audio_system_impl_unittest.cc",
"audio_thread_hang_monitor_unittest.cc",
"power_observer_helper_unittest.cc",
"simple_sources_unittest.cc",
]
deps = [
"//base",
"//base/test:test_support",
"//build:chromeos_buildflags",
"//media:test_support",
"//testing/gmock",
"//testing/gtest",
"//third_party/opus:opus",
"//url",
]
configs += [
":platform_config",
"//media:media_config",
]
if (is_android) {
sources += [ "android/audio_android_unittest.cc" ]
deps += [ "//ui/gl" ]
}
if (is_mac) {
sources += [
"mac/audio_auhal_mac_unittest.cc",
"mac/audio_device_listener_mac_unittest.cc",
"mac/audio_low_latency_input_mac_unittest.cc",
]
}
if (is_chromeos_ash || is_chromecast) {
sources += [
"test_data.h",
"wav_audio_handler_unittest.cc",
]
if (!is_chromecast) {
deps += [
"//ash/components/audio",
"//chromeos/dbus/audio",
]
}
if (use_cras) {
sources += [
"cras/audio_manager_chromeos_unittest.cc",
"cras/cras_input_unittest.cc",
"cras/cras_unified_unittest.cc",
]
}
}
if (is_win) {
sources += [
"win/audio_device_listener_win_unittest.cc",
"win/audio_low_latency_input_win_unittest.cc",
"win/audio_low_latency_output_win_unittest.cc",
"win/audio_output_win_unittest.cc",
"win/audio_session_event_listener_win_unittest.cc",
"win/core_audio_util_win_unittest.cc",
"win/device_enumeration_win_unittest.cc",
"win/volume_range_util_unittest.cc",
]
}
if (use_alsa) {
sources += [
"alsa/alsa_output_unittest.cc",
"alsa/alsa_util_unittest.cc",
"audio_low_latency_input_output_unittest.cc",
]
}
}
fuzzer_test("wav_audio_handler_fuzzer") {
sources = [ "wav_audio_handler_fuzzer.cc" ]
deps = [
":audio",
"//base",
"//media:test_support",
]
}