From 715e2fa845f163bd9e46ab9060b5238ed69f06ab Mon Sep 17 00:00:00 2001 From: yanghaizhou Date: Sat, 15 Jan 2022 23:55:16 +0800 Subject: [PATCH] unify the audio ipc proxy shared library with the Audio service Signed-off-by: yanghaizhou --- audio/BUILD.gn | 4 +- audio/hal/hdi_binder/proxy/BUILD.gn | 232 +++++++++--------- audio/hal/hdi_binder/server/BUILD.gn | 168 +++++++------ .../hdi_binder/server/src/hdf_audio_server.c | 2 +- audio/sample/framework_capture.c | 4 +- audio/sample/framework_render.c | 4 +- .../common/include/audio_hdi_fuzzer_common.h | 2 +- .../hdi_common/include/audio_hdi_common.h | 4 +- 8 files changed, 218 insertions(+), 202 deletions(-) diff --git a/audio/BUILD.gn b/audio/BUILD.gn index 8ffdf5d402..1d25476a4e 100755 --- a/audio/BUILD.gn +++ b/audio/BUILD.gn @@ -27,8 +27,8 @@ group("hdi_audio") { } else { deps += [ "config/linux:hdf_audio_json", - "hal/hdi_binder/proxy:audio_hdi_proxy_server", - "hal/hdi_binder/server:audio_hdi_adapter_server", + "hal/hdi_binder/proxy:hdi_audio_client", + "hal/hdi_binder/server:hdi_audio_server", ] } diff --git a/audio/hal/hdi_binder/proxy/BUILD.gn b/audio/hal/hdi_binder/proxy/BUILD.gn index 46b77863e9..282a9024ac 100755 --- a/audio/hal/hdi_binder/proxy/BUILD.gn +++ b/audio/hal/hdi_binder/proxy/BUILD.gn @@ -47,121 +47,129 @@ config("hdi_service_proxy_config") { ldflags = [ "-Wl" ] } -if (defined(ohos_lite)) { - shared_library("audio_hdi_proxy_server") { - include_dirs = [ - "//drivers/peripheral/audio/interfaces/include", - "//drivers/peripheral/audio/hal/hdi_passthrough/include", - "//drivers/peripheral/audio/hal/hdi_binder/proxy/include", - "//drivers/peripheral/audio/hal/hdi_binder/server/include", - "$hdf_framework_path/include/core", - "$hdf_framework_path/include/utils", - "$hdf_framework_path/include/osal", - "$hdf_framework_path/ability/sbuf/include", - "$hdf_framework_path/utils/include", - "$hdf_framework_path/include", - "$hdf_framework_path/core/sec/include", - "$hdf_framework_path/core/shared/include", - "$hdf_framework_path/core/host/include", - "$hdf_framework_path/core/manager/include", - "$hdf_framework_path/core/common/include/host/", - "//third_party/cJSON", - "//third_party/bounds_checking_function/include", - "//drivers/adapter/khdf/liteos/osal/include", - "$hdf_uhdf_path/shared/include", - "$hdf_uhdf_path/include/hdi/", - "$hdf_uhdf_path/host/include", - ] - - sources = [ - "$hdf_framework_path/ability/sbuf/src/hdf_sbuf.c", - "//drivers/peripheral/audio/hal/hdi_passthrough/src/audio_adapter_info_common.c", - "//drivers/peripheral/audio/hal/hdi_passthrough/src/audio_common.c", - "//third_party/cJSON/cJSON.c", - "src/audio_proxy_adapter.c", - "src/audio_proxy_capture.c", - "src/audio_proxy_common.c", - "src/audio_proxy_manager.c", - "src/audio_proxy_render.c", - ] - - deps = [ - "//drivers/peripheral/audio/hal/hdi_passthrough:hdi_audio", - "//third_party/bounds_checking_function:libsec_shared", - ] - - if (enable_audio_hal_hdf_log) { - defines = [ "AUDIO_HAL_HDF_LOG" ] +if ("$product_name" != "ohos-arm64") { + import("//vendor/$product_company/$product_name/hals/audio/product.gni") +} +if (!defined(enable_hdf_proxy_stub) || enable_hdf_proxy_stub == true) { + if (defined(ohos_lite)) { + shared_library("hdi_audio_client") { + include_dirs = [ + "//drivers/peripheral/audio/interfaces/include", + "//drivers/peripheral/audio/hal/hdi_passthrough/include", + "//drivers/peripheral/audio/hal/hdi_binder/proxy/include", + "//drivers/peripheral/audio/hal/hdi_binder/server/include", + "$hdf_framework_path/include/core", + "$hdf_framework_path/include/utils", + "$hdf_framework_path/include/osal", + "$hdf_framework_path/ability/sbuf/include", + "$hdf_framework_path/utils/include", + "$hdf_framework_path/include", + "$hdf_framework_path/core/sec/include", + "$hdf_framework_path/core/shared/include", + "$hdf_framework_path/core/host/include", + "$hdf_framework_path/core/manager/include", + "$hdf_framework_path/core/common/include/host/", + "//third_party/cJSON", + "//third_party/bounds_checking_function/include", + "//drivers/adapter/khdf/liteos/osal/include", + "$hdf_uhdf_path/shared/include", + "$hdf_uhdf_path/include/hdi/", + "$hdf_uhdf_path/host/include", + ] + + sources = [ + "$hdf_framework_path/ability/sbuf/src/hdf_sbuf.c", + "//drivers/peripheral/audio/hal/hdi_passthrough/src/audio_adapter_info_common.c", + "//drivers/peripheral/audio/hal/hdi_passthrough/src/audio_common.c", + "//third_party/cJSON/cJSON.c", + "src/audio_proxy_adapter.c", + "src/audio_proxy_capture.c", + "src/audio_proxy_common.c", + "src/audio_proxy_manager.c", + "src/audio_proxy_render.c", + ] + + deps = [ + "//drivers/peripheral/audio/hal/hdi_passthrough:hdi_audio", + "//third_party/bounds_checking_function:libsec_shared", + ] + + if (enable_audio_hal_hdf_log) { + defines = [ "AUDIO_HAL_HDF_LOG" ] + } + + public_configs = [ ":hdi_service_proxy_config" ] } - public_configs = [ ":hdi_service_proxy_config" ] - } - - lite_component("hdi_audio") { - features = [ ":audio_hdi_proxy_server" ] - } -} else { - ohos_shared_library("audio_hdi_proxy_server") { - include_dirs = [ - "//drivers/peripheral/audio/interfaces/include", - "//drivers/peripheral/audio/hal/hdi_passthrough/include", - "//drivers/peripheral/audio/hal/hdi_binder/proxy/include", - "//drivers/peripheral/audio/hal/hdi_binder/server/include", - "//third_party/cJSON", - "$hdf_framework_path/include/core", - "$hdf_framework_path/include/utils", - "$hdf_framework_path/include/osal", - "$hdf_framework_path/include", - "//third_party/bounds_checking_function/include", - "$hdf_framework_path/ability/sbuf/include", - "$hdf_framework_path/utils/include", - "$hdf_framework_path/ability/sbuf/include", - "$hdf_uhdf_path/osal/include", - "$hdf_framework_path/include", - "$hdf_framework_path/core/sec/include", - "$hdf_framework_path/core/shared/include", - "$hdf_framework_path/core/host/include", - "$hdf_framework_path/core/manager/include", - "$hdf_uhdf_path/include/devhost", - "$hdf_uhdf_path/devhost/include", - "$hdf_uhdf_path/devmgr/include", - "$hdf_uhdf_path/host/include", - "$hdf_uhdf_path/manager/include", - "$hdf_uhdf_path/include/host", - ] - - sources = [ - "//drivers/peripheral/audio/hal/hdi_passthrough/src/audio_adapter_info_common.c", - "//drivers/peripheral/audio/hal/hdi_passthrough/src/audio_common.c", - "//third_party/cJSON/cJSON.c", - "src/audio_proxy_adapter.c", - "src/audio_proxy_capture.c", - "src/audio_proxy_common.c", - "src/audio_proxy_manager.c", - "src/audio_proxy_render.c", - ] - - deps = [ - "$hdf_uhdf_path/hdi:libhdi", - "$hdf_uhdf_path/host:libhdf_host", - "$hdf_uhdf_path/ipc:libhdf_ipc_adapter", - "$hdf_uhdf_path/utils:libhdf_utils", - "//drivers/peripheral/audio/hal/hdi_passthrough:hdi_audio", - "//utils/native/base:utils", - ] - - if (is_standard_system) { - external_deps = [ "hiviewdfx_hilog_native:libhilog" ] - } else { - external_deps = [ "hilog:libhilog" ] + lite_component("hdi_audio") { + features = [ ":hdi_audio_client" ] } - - if (enable_audio_hal_hdf_log) { - defines = [ "AUDIO_HAL_HDF_LOG" ] + } else { + ohos_shared_library("hdi_audio_client") { + include_dirs = [ + "//drivers/peripheral/audio/interfaces/include", + "//drivers/peripheral/audio/hal/hdi_passthrough/include", + "//drivers/peripheral/audio/hal/hdi_binder/proxy/include", + "//drivers/peripheral/audio/hal/hdi_binder/server/include", + "//third_party/cJSON", + "$hdf_framework_path/include/core", + "$hdf_framework_path/include/utils", + "$hdf_framework_path/include/osal", + "$hdf_framework_path/include", + "//third_party/bounds_checking_function/include", + "$hdf_framework_path/ability/sbuf/include", + "$hdf_framework_path/utils/include", + "$hdf_framework_path/ability/sbuf/include", + "$hdf_uhdf_path/osal/include", + "$hdf_framework_path/include", + "$hdf_framework_path/core/sec/include", + "$hdf_framework_path/core/shared/include", + "$hdf_framework_path/core/host/include", + "$hdf_framework_path/core/manager/include", + "$hdf_uhdf_path/include/devhost", + "$hdf_uhdf_path/devhost/include", + "$hdf_uhdf_path/devmgr/include", + "$hdf_uhdf_path/host/include", + "$hdf_uhdf_path/manager/include", + "$hdf_uhdf_path/include/host", + ] + + sources = [ + "//drivers/peripheral/audio/hal/hdi_passthrough/src/audio_adapter_info_common.c", + "//drivers/peripheral/audio/hal/hdi_passthrough/src/audio_common.c", + "//third_party/cJSON/cJSON.c", + "src/audio_proxy_adapter.c", + "src/audio_proxy_capture.c", + "src/audio_proxy_common.c", + "src/audio_proxy_manager.c", + "src/audio_proxy_render.c", + ] + + deps = [ + "//drivers/peripheral/audio/hal/hdi_passthrough:hdi_audio", + "//utils/native/base:utils", + ] + + if (is_standard_system) { + external_deps = [ + "device_driver_framework:libhdf_host", + "device_driver_framework:libhdf_ipc_adapter", + "device_driver_framework:libhdf_utils", + "device_driver_framework:libhdi", + "hiviewdfx_hilog_native:libhilog", + ] + } else { + external_deps = [ "hilog:libhilog" ] + } + + if (enable_audio_hal_hdf_log) { + defines = [ "AUDIO_HAL_HDF_LOG" ] + } + + public_configs = [ ":hdi_service_proxy_config" ] + + subsystem_name = "hdf" + part_name = "audio_device_driver" } - - public_configs = [ ":hdi_service_proxy_config" ] - - subsystem_name = "hdf" } } diff --git a/audio/hal/hdi_binder/server/BUILD.gn b/audio/hal/hdi_binder/server/BUILD.gn index b208a1beab..f901121fc0 100755 --- a/audio/hal/hdi_binder/server/BUILD.gn +++ b/audio/hal/hdi_binder/server/BUILD.gn @@ -47,89 +47,97 @@ config("hdi_service_config") { ldflags = [ "-Wl" ] } -if (defined(ohos_lite)) { - shared_library("audio_hdi_adapter_server") { - include_dirs = [ - "//drivers/peripheral/audio/interfaces/include", - "//drivers/peripheral/audio/hal/hdi_passthrough/include", - "//drivers/peripheral/audio/hal/hdi_binder/proxy/include", - "//drivers/peripheral/audio/hal/hdi_binder/server/include", - "$hdf_framework_path/core/sec/include", - "$hdf_framework_path/core/shared/include", - "$hdf_framework_path/core/host/include", - "$hdf_framework_path/core/manager/include", - "$hdf_framework_path/core/common/include/host/", - "//third_party/bounds_checking_function/include", - "//drivers/adapter/khdf/liteos/osal/include", - "//drivers/adapter/uhdf2/shared/include", - "//drivers/adapter/uhdf2/include/hdi/", - ] - - sources = [ - "$hdf_framework_path/support/posix/src/osal_mem.c", - "$hdf_framework_path/utils/src/hdf_sbuf.c", - "src/hdf_audio_server.c", - "src/hdf_audio_server_capture.c", - "src/hdf_audio_server_common.c", - "src/hdf_audio_server_render.c", - ] - - deps = [ - "//drivers/peripheral/audio/hal/hdi_passthrough:hdi_audio", - "//third_party/bounds_checking_function:libsec_shared", - ] - - if (enable_audio_hal_hdf_log) { - defines = [ "AUDIO_HAL_HDF_LOG" ] +if ("$product_name" != "ohos-arm64") { + import("//vendor/$product_company/$product_name/hals/audio/product.gni") +} +if (!defined(enable_hdf_proxy_stub) || enable_hdf_proxy_stub == true) { + if (defined(ohos_lite)) { + shared_library("hdi_audio_server") { + include_dirs = [ + "//drivers/peripheral/audio/interfaces/include", + "//drivers/peripheral/audio/hal/hdi_passthrough/include", + "//drivers/peripheral/audio/hal/hdi_binder/proxy/include", + "//drivers/peripheral/audio/hal/hdi_binder/server/include", + "$hdf_framework_path/core/sec/include", + "$hdf_framework_path/core/shared/include", + "$hdf_framework_path/core/host/include", + "$hdf_framework_path/core/manager/include", + "$hdf_framework_path/core/common/include/host/", + "//third_party/bounds_checking_function/include", + "//drivers/adapter/khdf/liteos/osal/include", + "//drivers/adapter/uhdf2/shared/include", + "//drivers/adapter/uhdf2/include/hdi/", + ] + + sources = [ + "$hdf_framework_path/support/posix/src/osal_mem.c", + "$hdf_framework_path/utils/src/hdf_sbuf.c", + "src/hdf_audio_server.c", + "src/hdf_audio_server_capture.c", + "src/hdf_audio_server_common.c", + "src/hdf_audio_server_render.c", + ] + + deps = [ + "//drivers/peripheral/audio/hal/hdi_passthrough:hdi_audio", + "//third_party/bounds_checking_function:libsec_shared", + ] + + if (enable_audio_hal_hdf_log) { + defines = [ "AUDIO_HAL_HDF_LOG" ] + } + + public_configs = [ ":hdi_service_config" ] } - public_configs = [ ":hdi_service_config" ] - } - - lite_component("hdi") { - features = [ ":audio_hdi_adapter_server" ] - } -} else { - ohos_shared_library("audio_hdi_adapter_server") { - include_dirs = [ - "//drivers/peripheral/audio/interfaces/include", - "//drivers/peripheral/audio/hal/hdi_passthrough/include", - "//drivers/peripheral/audio/hal/hdi_binder/server/include", - "//third_party/bounds_checking_function/include", - ] - - sources = [ - "src/hdf_audio_server.c", - "src/hdf_audio_server_capture.c", - "src/hdf_audio_server_common.c", - "src/hdf_audio_server_render.c", - ] - - deps = [ - "$hdf_uhdf_path/hdi:libhdi", - "$hdf_uhdf_path/host:libhdf_host", - "$hdf_uhdf_path/ipc:libhdf_ipc_adapter", - "$hdf_uhdf_path/utils:libhdf_utils", - "//drivers/peripheral/audio/hal/hdi_passthrough:hdi_audio", - "//utils/native/base:utils", - ] - - defines = [] - if (enable_audio_device_mpi) { - defines += [ "AUDIO_HAL_USER" ] - } - if (is_standard_system) { - external_deps = [ "hiviewdfx_hilog_native:libhilog" ] - } else { - external_deps = [ "hilog:libhilog" ] + lite_component("hdi") { + features = [ ":hdi_audio_server" ] } - - if (enable_audio_hal_hdf_log) { - defines += [ "AUDIO_HAL_HDF_LOG" ] + } else { + ohos_shared_library("hdi_audio_server") { + include_dirs = [ + "//drivers/peripheral/audio/interfaces/include", + "//drivers/peripheral/audio/hal/hdi_passthrough/include", + "//drivers/peripheral/audio/hal/hdi_binder/server/include", + "//third_party/bounds_checking_function/include", + ] + + sources = [ + "src/hdf_audio_server.c", + "src/hdf_audio_server_capture.c", + "src/hdf_audio_server_common.c", + "src/hdf_audio_server_render.c", + ] + + deps = [ + "//drivers/peripheral/audio/hal/hdi_passthrough:hdi_audio", + "//utils/native/base:utils", + ] + + defines = [] + if (enable_audio_device_mpi) { + defines += [ "AUDIO_HAL_USER" ] + } + if (is_standard_system) { + external_deps = [ + "device_driver_framework:libhdf_host", + "device_driver_framework:libhdf_ipc_adapter", + "device_driver_framework:libhdf_utils", + "device_driver_framework:libhdi", + "hiviewdfx_hilog_native:libhilog", + ] + } else { + external_deps = [ "hilog:libhilog" ] + } + + if (enable_audio_hal_hdf_log) { + defines += [ "AUDIO_HAL_HDF_LOG" ] + } + + public_configs = [ ":hdi_service_config" ] + + subsystem_name = "hdf" + part_name = "audio_device_driver" } - - public_configs = [ ":hdi_service_config" ] - - subsystem_name = "hdf" } } diff --git a/audio/hal/hdi_binder/server/src/hdf_audio_server.c b/audio/hal/hdi_binder/server/src/hdf_audio_server.c index 537720b8ac..0a7c13d146 100755 --- a/audio/hal/hdi_binder/server/src/hdf_audio_server.c +++ b/audio/hal/hdi_binder/server/src/hdf_audio_server.c @@ -547,7 +547,7 @@ int AudioHdiServerInit(struct HdfDeviceObject *deviceObject) struct HdfDriverEntry g_hdiServerEntry = { .moduleVersion = 1, - .moduleName = "audio_hdi_adapter_server", + .moduleName = "hdi_audio_server", .Bind = AudioHdiServerBind, .Init = AudioHdiServerInit, .Release = AudioHdiServerRelease, diff --git a/audio/sample/framework_capture.c b/audio/sample/framework_capture.c index 48d6de61cc..ef90955327 100755 --- a/audio/sample/framework_capture.c +++ b/audio/sample/framework_capture.c @@ -469,10 +469,10 @@ int32_t SelectLoadingMode(char *resolvedPath, int32_t pathLen, char *func, int32 int32_t ret; #ifdef __LITEOS__ soPathHdi = "/usr/lib/libhdi_audio.so"; - soPathProxy = "/usr/lib/libaudio_hdi_proxy_server.so"; + soPathProxy = "/usr/lib/libhdi_audio_client.so"; #else soPathHdi = "/system/lib/libhdi_audio.z.so"; - soPathProxy = "/system/lib/libaudio_hdi_proxy_server.z.so"; + soPathProxy = "/system/lib/libhdi_audio_client.z.so"; #endif PrintMenu1(); printf("Please enter your choice:"); diff --git a/audio/sample/framework_render.c b/audio/sample/framework_render.c index 1858dc614c..c0307ca577 100755 --- a/audio/sample/framework_render.c +++ b/audio/sample/framework_render.c @@ -626,10 +626,10 @@ int32_t SelectLoadingMode(char *resolvedPath, int32_t pathLen, char *func, int32 char *soPathProxy = NULL; #ifdef __LITEOS__ soPathHdi = "/usr/lib/libhdi_audio.so"; - soPathProxy = "/usr/lib/libaudio_hdi_proxy_server.so"; + soPathProxy = "/usr/lib/libhdi_audio_client.so"; #else soPathHdi = "/system/lib/libhdi_audio.z.so"; - soPathProxy = "/system/lib/libaudio_hdi_proxy_server.z.so"; + soPathProxy = "/system/lib/libhdi_audio_client.z.so"; #endif PrintMenu1(); printf("Please enter your choice:"); diff --git a/audio/test/fuzztest/common/include/audio_hdi_fuzzer_common.h b/audio/test/fuzztest/common/include/audio_hdi_fuzzer_common.h index 0c6c3a3b55..7345507a0a 100755 --- a/audio/test/fuzztest/common/include/audio_hdi_fuzzer_common.h +++ b/audio/test/fuzztest/common/include/audio_hdi_fuzzer_common.h @@ -53,7 +53,7 @@ using namespace std; #endif #ifdef AUDIO_ADM_SERVICE const std::string FUNCTION_NAME = "GetAudioProxyManagerFuncs"; - const std::string RESOLVED_PATH = "//system/lib/libaudio_hdi_proxy_server.z.so"; + const std::string RESOLVED_PATH = "//system/lib/libhdi_audio_client.z.so"; using TestAudioManager = struct AudioProxyManager; #endif const uint32_t INT_32_MAX = 0x7fffffff; diff --git a/audio/test/systemtest/common/hdi_common/include/audio_hdi_common.h b/audio/test/systemtest/common/hdi_common/include/audio_hdi_common.h index 633834ce5a..4dde9c8315 100755 --- a/audio/test/systemtest/common/hdi_common/include/audio_hdi_common.h +++ b/audio/test/systemtest/common/hdi_common/include/audio_hdi_common.h @@ -60,13 +60,13 @@ namespace Audio { #endif #ifdef AUDIO_ADM_SERVICE const std::string FUNCTION_NAME = "GetAudioProxyManagerFuncs"; - const std::string RESOLVED_PATH = "//system/lib/libaudio_hdi_proxy_server.z.so"; + const std::string RESOLVED_PATH = "//system/lib/libhdi_audio_client.z.so"; using TestAudioManager = struct AudioProxyManager; const int IS_ADM = true; #endif #ifdef AUDIO_MPI_SERVICE const std::string FUNCTION_NAME = "GetAudioProxyManagerFuncs"; - const std::string RESOLVED_PATH = "//system/lib/libaudio_hdi_proxy_server.z.so"; + const std::string RESOLVED_PATH = "//system/lib/libhdi_audio_client.z.so"; using TestAudioManager = struct AudioProxyManager; const int IS_ADM = false; #endif -- Gitee