1# Copyright (c) 2025 Huawei Device Co., Ltd. 2# Licensed under the Apache License, Version 2.0 (the "License"); 3# you may not use this file except in compliance with the License. 4# You may obtain a copy of the License at 5# 6# http://www.apache.org/licenses/LICENSE-2.0 7# 8# Unless required by applicable law or agreed to in writing, software 9# distributed under the License is distributed on an "AS IS" BASIS, 10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11# See the License for the specific language governing permissions and 12# limitations under the License. 13 14import("//build/ohos.gni") 15import("//build/test.gni") 16import("../../../audio_framework_test_sources.gni") 17import("../../../config.gni") 18 19ohos_shared_library("hdiadapter_new") { 20 branch_protector_ret = "pac_ret" 21 sanitize = { 22 cfi = true 23 cfi_cross_dso = true 24 cfi_vcall_icall_only = true 25 debug = false 26 integer_overflow = true 27 ubsan = true 28 boundary_sanitize = true 29 } 30 install_enable = true 31 32 cflags = [ 33 "-fPIC", 34 "-Wall", 35 "-Os", 36 ] 37 cflags_cc = cflags 38 39 include_dirs = [ 40 "include", 41 "../../../services/audio_service/common/include", 42 "../../../interfaces/inner_api/native/audiocommon/include", 43 "../audioutils/include", 44 "../audioeffect/include", 45 "../audioschedule/include", 46 ] 47 48 sources = [ 49 "adapter/bluetooth_device_manager.cpp", 50 "adapter/local_device_manager.cpp", 51 "adapter/remote_device_manager.cpp", 52 "manager/hdi_adapter_factory.cpp", 53 "manager/hdi_adapter_manager.cpp", 54 "sink/audio_render_sink.cpp", 55 "sink/bluetooth_audio_render_sink.cpp", 56 "sink/fast_audio_render_sink.cpp", 57 "sink/file_audio_render_sink.cpp", 58 "sink/multichannel_audio_render_sink.cpp", 59 "sink/offload_audio_render_sink.cpp", 60 "sink/remote_audio_render_sink.cpp", 61 "sink/remote_fast_audio_render_sink.cpp", 62 "source/audio_capture_source.cpp", 63 "source/bluetooth_audio_capture_source.cpp", 64 "source/fast_audio_capture_source.cpp", 65 "source/file_audio_capture_source.cpp", 66 "source/remote_audio_capture_source.cpp", 67 "source/remote_fast_audio_capture_source.cpp", 68 "source/wakeup_audio_capture_source.cpp", 69 "util/callback_wrapper.cpp", 70 "util/id_handler.cpp", 71 "util/ring_buffer_handler.cpp", 72 ] 73 74 deps = [ 75 "../../../services/audio_service:audio_common", 76 "../audioeffect:audio_effect", 77 "../audioschedule:audio_schedule", 78 "../audioutils:audio_utils", 79 ] 80 81 external_deps = [ 82 "bounds_checking_function:libsec_shared", 83 "c_utils:utils", 84 "drivers_interface_audio:libaudio_proxy_4.0", 85 "drivers_interface_distributed_audio:libdaudio_proxy_1.0", 86 "drivers_peripheral_bluetooth:hdi_audio_bluetooth_header", 87 "hdf_core:libhdf_ipc_adapter", 88 "hilog:libhilog", 89 "init:libbegetutil", 90 "ipc:ipc_single", 91 "media_foundation:media_monitor_client", 92 "media_foundation:media_monitor_common", 93 ] 94 95 defines = [] 96 97 if (audio_framework_feature_file_io) { 98 defines += [ "FEATURE_FILE_IO" ] 99 } 100 if (audio_framework_feature_distributed_audio) { 101 defines += [ "FEATURE_DISTRIBUTE_AUDIO" ] 102 } 103 if (use_libfuzzer || use_clang_coverage) { 104 defines += [ "TEST_COVERAGE" ] 105 } 106 if (audio_framework_feature_power_manager) { 107 sources += [ "util/audio_running_lock.cpp" ] 108 external_deps += [ "power_manager:powermgr_client" ] 109 defines += [ "FEATURE_POWER_MANAGER" ] 110 } 111 112 part_name = "audio_framework" 113 subsystem_name = "multimedia" 114 version_script = "libhdiadapter_new.versionscript" 115} 116 117ohos_unittest("hdiadapter_unit_test") { 118 module_out_path = "multimedia_audio_framework/hdiadapter_new" 119 120 cflags = [ 121 "-Wall", 122 "-Werror", 123 "-fno-access-control", 124 ] 125 126 include_dirs = [ 127 "include", 128 "../../../interfaces/inner_api/native/audiocommon/include", 129 "../audioutils/include", 130 ] 131 132 sources = [ 133 "test/unittest/adapter_unit_test.cpp", 134 "test/unittest/manager_unit_test.cpp", 135 "test/unittest/sink/audio_render_sink_unit_test.cpp", 136 "test/unittest/sink/bluetooth_audio_render_sink_unit_test.cpp", 137 "test/unittest/sink/fast_audio_render_sink_unit_test.cpp", 138 "test/unittest/sink/multichannel_audio_render_sink_unit_test.cpp", 139 "test/unittest/sink/offload_audio_render_sink_unit_test.cpp", 140 "test/unittest/sink/remote_audio_render_sink_unit_test.cpp", 141 "test/unittest/sink/remote_fast_audio_render_sink_unit_test.cpp", 142 "test/unittest/source/audio_capture_source_unit_test.cpp", 143 "test/unittest/source/bluetooth_audio_capture_source_unit_test.cpp", 144 "test/unittest/source/fast_audio_capture_source_unit_test.cpp", 145 "test/unittest/source/remote_audio_capture_source_unit_test.cpp", 146 "test/unittest/source/remote_fast_audio_capture_source_unit_test.cpp", 147 "test/unittest/source/wakeup_audio_capture_source_unit_test.cpp", 148 "test/unittest/util_unit_test.cpp", 149 ] 150 151 deps = [ ":hdiadapter_new" ] 152 153 external_deps = [ 154 "googletest:gmock", 155 "googletest:gtest", 156 ] 157 158 part_name = "audio_framework" 159 subsystem_name = "multimedia" 160} 161