| # Copyright 2016 The Fuchsia 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/fuzzing/fuzzer.gni") |
| import("//build/test/test_package.gni") |
| import("//src/media/audio/audio_core_package.gni") |
| import("//third_party/cobalt/metrics_registry.gni") |
| |
| declare_args() { |
| # Set to |true| to enable collecting execution traces of audio_core, or |false| to remove all |
| # tracing overhead. |
| audio_core_trace_enabled = true |
| } |
| |
| config("audio_core_config") { |
| if (!audio_core_trace_enabled) { |
| defines = [ "NTRACE" ] |
| } |
| |
| cflags_cc = [ "-Wsuggest-override" ] |
| } |
| |
| action_foreach("json_schema_headers") { |
| visibility = [ ":*" ] |
| |
| script = "//src/media/audio/audio_core/schema/make_schema_header.py" |
| |
| outputs = [ "$target_gen_dir/schema/{{source_name_part}}.inl" ] |
| |
| args = [ |
| "{{source}}", |
| rebase_path("$target_gen_dir") + "/schema/{{source_name_part}}.inl", |
| ] |
| |
| sources = [ |
| "schema/audio_core_config_schema.jsx", |
| "schema/audio_policy_schema.jsx", |
| ] |
| } |
| |
| metrics_registry("media_metrics_registry") { |
| # This must match the ID of our Cobalt project as specified in: |
| # third_party/cobalt_config/projects.yaml |
| project_id = 3142410971 |
| generate_cc = true |
| } |
| |
| audio_core_package("audio_core") { |
| effects = { |
| target = "//src/media/audio/effects/passthrough:audio_effects" |
| name = "audio_effects.so" |
| } |
| } |
| |
| source_set("audio_core_lib") { |
| public_configs = [ ":audio_core_config" ] |
| sources = [ |
| "activity_dispatcher.cc", |
| "activity_dispatcher.h", |
| "audio_admin.cc", |
| "audio_admin.h", |
| "audio_capturer.cc", |
| "audio_capturer.h", |
| "audio_core_impl.cc", |
| "audio_core_impl.h", |
| "audio_device.cc", |
| "audio_device.h", |
| "audio_device_manager.cc", |
| "audio_device_manager.h", |
| "audio_device_settings.cc", |
| "audio_device_settings.h", |
| "audio_driver.cc", |
| "audio_driver.h", |
| "audio_input.cc", |
| "audio_input.h", |
| "audio_object.h", |
| "audio_output.cc", |
| "audio_output.h", |
| "audio_policy.h", |
| "audio_renderer.cc", |
| "audio_renderer.h", |
| "base_capturer.cc", |
| "base_capturer.h", |
| "base_renderer.cc", |
| "base_renderer.h", |
| "context.cc", |
| "context.h", |
| "device_config.cc", |
| "device_config.h", |
| "device_registry.h", |
| "driver_output.cc", |
| "driver_output.h", |
| "driver_utils.cc", |
| "driver_utils.h", |
| "effects_stage.cc", |
| "effects_stage.h", |
| "format.cc", |
| "format.h", |
| "intermediate_buffer.cc", |
| "intermediate_buffer.h", |
| "link_matrix.cc", |
| "link_matrix.h", |
| "loudness_transform.cc", |
| "loudness_transform.h", |
| "mix_stage.cc", |
| "mix_stage.h", |
| "output_pipeline.cc", |
| "output_pipeline.h", |
| "packet.cc", |
| "packet.h", |
| "packet_queue.cc", |
| "packet_queue.h", |
| "pending_capture_buffer.cc", |
| "pending_capture_buffer.h", |
| "pending_flush_token.cc", |
| "pending_flush_token.h", |
| "pipeline_config.h", |
| "plug_detector.cc", |
| "plug_detector.h", |
| "policy_loader.cc", |
| "policy_loader.h", |
| "process_config.cc", |
| "process_config.h", |
| "process_config_loader.cc", |
| "process_config_loader.h", |
| "profile_provider.cc", |
| "profile_provider.h", |
| "reporter.cc", |
| "reporter.h", |
| "ring_buffer.cc", |
| "ring_buffer.h", |
| "route_graph.cc", |
| "route_graph.h", |
| "stream.h", |
| "stream_usage.h", |
| "stream_volume_manager.cc", |
| "stream_volume_manager.h", |
| "tap_stage.cc", |
| "tap_stage.h", |
| "thermal_agent.cc", |
| "thermal_agent.h", |
| "thermal_config.h", |
| "threading_model.cc", |
| "threading_model.h", |
| "throttle_output.h", |
| "ultrasound_factory.cc", |
| "ultrasound_factory.h", |
| "usage_reporter_impl.cc", |
| "usage_reporter_impl.h", |
| "usage_settings.cc", |
| "usage_settings.h", |
| "utils.cc", |
| "utils.h", |
| "versioned_timeline_function.h", |
| "volume_control.cc", |
| "volume_control.h", |
| "volume_curve.cc", |
| "volume_curve.h", |
| "wakeup_event.cc", |
| "wakeup_event.h", |
| ] |
| |
| public_deps = [ |
| "//sdk/fidl/fuchsia.media", |
| "//sdk/fidl/fuchsia.thermal", |
| "//sdk/fidl/fuchsia.ultrasound", |
| "//sdk/lib/sys/inspect/cpp", |
| "//src/lib/syslog/cpp", |
| "//third_party/rapidjson", |
| "//zircon/public/lib/ffl", |
| "//zircon/public/lib/fzl", |
| "//zircon/public/lib/trace", |
| "//zircon/system/fidl/fuchsia-cobalt", |
| ] |
| |
| deps = [ |
| ":json_schema_headers", |
| ":media_metrics_registry", |
| "//sdk/fidl/fuchsia.hardware.audio", |
| "//sdk/fidl/fuchsia.media", |
| "//sdk/lib/media/audio/cpp", |
| "//sdk/lib/media/cpp:no_converters", |
| "//sdk/lib/sys/cpp", |
| "//src/lib/fsl", |
| "//src/lib/fxl", |
| "//src/media/audio/audio_core/mixer", |
| "//src/media/audio/lib/clock", |
| "//src/media/audio/lib/effects_loader", |
| "//src/media/audio/lib/logging", |
| "//src/media/audio/lib/wav_writer:wav_writer", |
| "//zircon/public/lib/async-loop-cpp", |
| "//zircon/public/lib/async-loop-default", |
| "//zircon/public/lib/fbl", |
| "//zircon/public/lib/fdio", |
| "//zircon/public/lib/fit", |
| "//zircon/public/lib/zx", |
| "//zircon/system/fidl/fuchsia-scheduler", |
| "//zircon/system/ulib/audio-proto-utils", |
| ] |
| } |
| |
| executable("audio_core_bin") { |
| output_name = "audio_core" |
| |
| sources = [ "main.cc" ] |
| |
| deps = [ |
| ":audio_core_lib", |
| "//src/lib/fsl", |
| "//src/media/audio/lib/logging", |
| ] |
| if (audio_core_trace_enabled) { |
| deps += [ "//zircon/public/lib/trace-provider-with-fdio" ] |
| } |
| } |
| |
| executable("unittest_bin") { |
| visibility = [ ":*" ] |
| testonly = true |
| output_name = "audio_core_unittests" |
| |
| sources = [ |
| "activity_dispatcher_unittest.cc", |
| "audio_admin_unittest.cc", |
| "audio_capturer_unittest.cc", |
| "audio_device_settings_unittest.cc", |
| "audio_device_unittest.cc", |
| "audio_driver_unittest.cc", |
| "audio_input_unittest.cc", |
| "audio_output_unittest.cc", |
| "audio_renderer_unittest.cc", |
| "device_config_unittest.cc", |
| "driver_output_unittest.cc", |
| "effects_stage_unittest.cc", |
| "format_unittest.cc", |
| "intermediate_buffer_unittest.cc", |
| "link_matrix_unittest.cc", |
| "loudness_transform_unittest.cc", |
| "mix_stage_unittest.cc", |
| "output_pipeline_unittest.cc", |
| "packet_queue_unittest.cc", |
| "packet_unittest.cc", |
| "plug_detector_unittest.cc", |
| "policy_loader_unittest.cc", |
| "policy_loader_unittest_data.h", |
| "process_config_loader_unittest.cc", |
| "process_config_unittest.cc", |
| "profile_provider_unittest.cc", |
| "reporter_unittest.cc", |
| "ring_buffer_unittest.cc", |
| "route_graph_unittest.cc", |
| "stream_volume_manager_unittest.cc", |
| "tap_stage_unittest.cc", |
| "thermal_agent_unittest.cc", |
| "threading_model_unittest.cc", |
| "usage_reporter_impl_unittest.cc", |
| "usage_settings_unittest.cc", |
| "utils_unittest.cc", |
| "versioned_timeline_function_unittest.cc", |
| "volume_control_unittest.cc", |
| "volume_curve_unittest.cc", |
| "wakeup_event_unittest.cc", |
| ] |
| |
| deps = [ |
| ":audio_core_lib", |
| "testing", |
| "//garnet/public/lib/gtest", |
| "//sdk/fidl/fuchsia.hardware.audio", |
| "//sdk/lib/inspect/testing/cpp", |
| "//sdk/lib/sys/cpp/testing:unit", |
| "//src/lib/fxl/test:gtest_main", |
| "//src/media/audio/audio_core/mixer", |
| "//src/media/audio/lib/clock/testing", |
| "//src/media/audio/lib/effects_loader/testing", |
| "//src/media/audio/lib/test:null_renderer_capturer", |
| "//zircon/public/lib/async-loop-cpp", |
| "//zircon/public/lib/async-loop-default", |
| "//zircon/public/lib/fs", |
| "//zircon/public/lib/fzl", |
| "//zircon/system/fidl/fuchsia-scheduler", |
| ] |
| |
| # TODO(46533): Fix the leaks and remove this. |
| deps += [ "//build/config/sanitizers:suppress-lsan.DO-NOT-USE-THIS" ] |
| } |
| |
| test_package("audio_core_unittests") { |
| deps = [ |
| ":unittest_bin", |
| "//src/media/audio/effects/test_effects", |
| ] |
| |
| loadable_modules = [ |
| { |
| name = "test_effects.so" |
| }, |
| ] |
| |
| tests = [ |
| { |
| name = "audio_core_unittests" |
| environments = basic_envs |
| }, |
| ] |
| } |
| |
| fuzzer("audio_core_fuzzer") { |
| sources = [ "policy_loader_fuzzer.cc" ] |
| deps = [ ":audio_core_lib" ] |
| } |
| |
| group("tests") { |
| testonly = true |
| |
| deps = [ |
| ":audio_core_unittests", |
| "mixer:tests", |
| "test", |
| |
| # include this explicitly, in case product includes a custom audio_core package by other name |
| "//src/media/audio/audio_core", |
| ] |
| } |