From e3597530ec4c4b870b332b46dbf406f587b0085a Mon Sep 17 00:00:00 2001 From: w30042960 Date: Wed, 12 Apr 2023 10:02:48 +0800 Subject: [PATCH 1/9] modify daudio code Signed-off-by: w30042960 --- bundle.json | 14 +- .../unittest/src/daudio_hidumper_test.cpp | 3 - common/include/daudio_constants.h | 5 + common/include/daudio_util.h | 5 + common/src/daudio_util.cpp | 48 ++- .../audioext/v1_0/IDAudioCallback.idl | 2 +- .../distributed_audio/audioext/v1_0/Types.idl | 12 +- .../hdi_service/audio/v1_0/BUILD.gn | 2 - .../include/audio_adapter_interface_impl.h | 12 +- .../include/audio_capture_interface_impl.h | 4 +- .../include/audio_render_interface_impl.h | 6 + .../v1_0/src/audio_adapter_interface_impl.cpp | 22 +- .../v1_0/src/audio_capture_interface_impl.cpp | 31 +- .../v1_0/src/audio_render_interface_impl.cpp | 13 +- .../audio/v1_0/test/unittest/BUILD.gn | 2 - .../unittest/audio_adapter_interface/BUILD.gn | 2 +- .../src/audio_adapter_interface_impl_test.cpp | 2 + .../src/audio_capture_interface_impl_test.cpp | 4 +- .../audio_test_utils/audio_test_utils.h | 7 +- .../test/unittest/include/daudio_test_utils.h | 3 +- .../common/include/daudio_constants.h | 6 +- .../common/include/daudio_events.h | 4 - .../common/utils/include/daudio_utils.h | 5 + .../common/utils/src/daudio_utils.cpp | 23 +- .../audio_ext/v1_0/i_daudio_hdf_callback.h | 2 +- .../src/daudio_ipc_callback_stub.cpp | 2 +- services/audioclient/interface/imic_client.h | 37 ++ services/audioclient/interface/ispk_client.h | 40 ++ .../micclient/include/dmic_client.h | 13 +- .../spkclient/include/dspeaker_client.h | 24 +- .../spkclient/src/dspeaker_client.cpp | 34 +- .../test/unittest/micclient/BUILD.gn | 1 + .../micclient/src/dmic_client_test.cpp | 3 + .../test/unittest/spkclient/BUILD.gn | 1 + .../spkclient/src/dspeaker_client_test.cpp | 22 +- .../include/daudio_manager_callback.h | 4 +- .../include/idaudio_hdi_callback.h | 18 +- .../src/daudio_manager_callback.cpp | 51 +-- .../include/audio_test_utils.h | 12 - .../include/audio_test_utils.h | 12 - .../managersink/include/daudio_sink_dev.h | 6 +- .../managersink/src/daudio_sink_dev.cpp | 15 +- .../managersink/src/daudio_sink_manager.cpp | 11 + .../managersource/include/daudio_source_dev.h | 6 - .../managersource/include/dmic_dev.h | 23 +- .../managersource/include/dspeaker_dev.h | 20 - .../managersource/src/daudio_source_dev.cpp | 73 +--- .../src/daudio_source_manager.cpp | 9 + .../managersource/src/dmic_dev.cpp | 117 +----- .../managersource/src/dspeaker_dev.cpp | 100 +---- services/audiomanager/servicesink/BUILD.gn | 5 + .../servicesink/src/daudio_sink_stub.cpp | 2 +- .../servicesource/src/daudio_source_stub.cpp | 2 +- .../test/unittest/managersink/BUILD.gn | 31 ++ .../managersink/src/daudio_sink_dev_test.cpp | 384 ++++++++++++++++++ .../src/daudio_sink_manager_test.cpp | 17 + .../src/daudio_source_service_test.cpp | 13 + .../src/daudio_source_dev_test.cpp | 75 +++- .../source_device/src/dmic_dev_test.cpp | 1 + .../src/daudio_source_mgr_test.cpp | 4 +- .../common/decodeprocessor/decoder_test.cpp | 26 ++ .../common/encodeprocessor/encoder_test.cpp | 1 + .../audiotransport/decodetransport/BUILD.gn | 2 - .../include/audio_decode_transport.h | 1 - .../src/audio_decode_transport.cpp | 7 +- .../audiotransport/encodetransport/BUILD.gn | 2 - .../include/audio_encode_transport.h | 1 - .../src/audio_encode_transport.cpp | 7 +- .../src/audio_ctrl_channel_test.cpp | 9 +- .../src/audio_ctrl_transport_test.cpp | 18 + .../src/audio_data_channel_test.cpp | 1 + .../src/audio_transport_pause_status_test.cpp | 22 +- .../src/audio_transport_start_status_test.cpp | 55 ++- .../src/audio_transport_stop_status_test.cpp | 26 +- .../src/decode_transport_test.cpp | 33 +- .../src/encode_transport_test.cpp | 51 ++- services/common/BUILD.gn | 18 +- services/common/audioparam/audio_event.h | 8 - services/common/audioparam/audio_param.h | 19 +- .../audio_adapter_internal_test.h | 6 +- .../unittest/src/softbus_adapter_test.cpp | 11 - 81 files changed, 1150 insertions(+), 601 deletions(-) create mode 100644 services/audioclient/interface/imic_client.h create mode 100644 services/audioclient/interface/ispk_client.h diff --git a/bundle.json b/bundle.json index 4667befe..d01f118f 100755 --- a/bundle.json +++ b/bundle.json @@ -65,8 +65,7 @@ "//foundation/distributedhardware/distributed_audio/services/audiotransport/audiochannel/audiodatachannel:distributed_audio_data_channel", "//foundation/distributedhardware/distributed_audio/services/audiotransport/audiotransportstatus:distributed_audio_transport_status", "//foundation/distributedhardware/distributed_audio/services/audiotransport/decodetransport:distributed_audio_decode_transport", - "//foundation/distributedhardware/distributed_audio/services/audiotransport/encodetransport:distributed_audio_encode_transport", - "//foundation/distributedhardware/distributed_audio/services/audioprocessor/effectcomponent:daudio_effect_component" + "//foundation/distributedhardware/distributed_audio/services/audiotransport/encodetransport:distributed_audio_encode_transport" ], "inner_kits":[ { @@ -88,6 +87,17 @@ "idaudio_source.h" ] } + }, + { + "type": "so", + "name": "//foundation/distributedhardware/distributed_audio/services/common:distributed_audio_utils", + "header": { + "header_base": "//foundation/distributedhardware/distributed_audio/services/common/", + "header_files": [ + "audiodata/include/audio_data.h", + "audioparam/audio_param.h" + ] + } } ], "test":[ diff --git a/common/dfx_utils/test/unittest/src/daudio_hidumper_test.cpp b/common/dfx_utils/test/unittest/src/daudio_hidumper_test.cpp index 391b8deb..73f6da8a 100644 --- a/common/dfx_utils/test/unittest/src/daudio_hidumper_test.cpp +++ b/common/dfx_utils/test/unittest/src/daudio_hidumper_test.cpp @@ -43,9 +43,6 @@ void DAudioHidumperTest::TearDown() HWTEST_F(DAudioHidumperTest, Dump_001, TestSize.Level1) { std::string result; - int32_t taskId = 1; - DaudioStartAsyncTrace(result, taskId); - DaudioFinishAsyncTrace(result, taskId); std::vector args; EXPECT_EQ(true, hidumper_->Dump(args, result)); args = { "-h"}; diff --git a/common/include/daudio_constants.h b/common/include/daudio_constants.h index 8f42b230..ed2b9bb6 100644 --- a/common/include/daudio_constants.h +++ b/common/include/daudio_constants.h @@ -63,6 +63,10 @@ constexpr uint32_t DAUDIO_MAX_TASKQUEUE_LEN = 100; constexpr uint32_t DAUDIO_MAX_RECV_DATA_LEN = 104857600; constexpr uint32_t DAUDIO_MAX_JSON_LEN = 1024; +static constexpr int64_t AUDIO_OFFSET_FRAME_NUM = 10; +static constexpr int64_t LOW_LATENCY_INTERVAL_NS = 5000000; +static constexpr int64_t LOW_LATENCY_CLIENT_INTERVAL_NS = 20000000; + const std::string DAUDIO_LOG_TITLE_TAG = "DAUDIO"; const std::string DAUDIO_PREFIX = "DISTRIBUTED_AUDIO"; const std::string AUDIO_PREFIX = "AUDIO"; @@ -97,6 +101,7 @@ constexpr const char *KEY_RESULT = "result"; constexpr const char *KEY_EVENT_TYPE = "eventType"; constexpr const char *KEY_AUDIO_PARAM = "audioParam"; constexpr const char *KEY_ATTRS = "attrs"; +constexpr const char *KEY_RANDOM_TASK_CODE = "randomTaskCode"; constexpr const char *KEY_SAMPLING_RATE = "samplingRate"; constexpr const char *KEY_CHANNELS = "channels"; diff --git a/common/include/daudio_util.h b/common/include/daudio_util.h index f43deb0f..5b95679e 100644 --- a/common/include/daudio_util.h +++ b/common/include/daudio_util.h @@ -42,6 +42,11 @@ bool IsAudioParam(const json &jsonObj, const std::string &key); int32_t CalculateSampleNum(uint32_t sampleRate, uint32_t timems); int64_t GetCurNano(); int32_t AbsoluteSleep(int64_t nanoTime); +int64_t CalculateOffset(const int64_t frameIndex, const int64_t framePeriodNs, const int64_t startTime); +int64_t UpdateTimeOffset(const int64_t frameIndex, const int64_t framePeriodNs, const int64_t updateInterval, + int64_t &startTime); +void GetCurrentTime(int64_t &tvSec, int64_t &tvNSec); +bool CheckIsNum(const std::string &jsonString); } // namespace DistributedHardware } // namespace OHOS #endif // OHOS_DAUDIO_UTIL_H diff --git a/common/src/daudio_util.cpp b/common/src/daudio_util.cpp index 167d0363..3babad56 100644 --- a/common/src/daudio_util.cpp +++ b/common/src/daudio_util.cpp @@ -40,6 +40,7 @@ constexpr int32_t WORD_WIDTH_4 = 4; constexpr size_t INT32_SHORT_ID_LENGTH = 20; constexpr size_t INT32_MIN_ID_LENGTH = 3; constexpr size_t INT32_PLAINTEXT_LENGTH = 4; +constexpr uint8_t MAX_KEY_DH_ID_LEN = 20; std::map typeCheckMap = { std::map::value_type(KEY_TYPE, &DistributedHardware::IsInt32), @@ -50,6 +51,7 @@ std::map typeCheckMap = { std::map::value_type(KEY_EVENT_TYPE, &DistributedHardware::IsInt32), std::map::value_type(KEY_AUDIO_PARAM, &DistributedHardware::IsAudioParam), std::map::value_type(KEY_ATTRS, &DistributedHardware::IsString), + std::map::value_type(KEY_RANDOM_TASK_CODE, &DistributedHardware::IsString), std::map::value_type(KEY_SAMPLING_RATE, &DistributedHardware::IsInt32), std::map::value_type(KEY_CHANNELS, &DistributedHardware::IsInt32), std::map::value_type(KEY_FORMAT, &DistributedHardware::IsInt32), @@ -128,6 +130,16 @@ int32_t GetDevTypeByDHId(int32_t dhId) return AUDIO_DEVICE_TYPE_UNKNOWN; } +void GetCurrentTime(int64_t &tvSec, int64_t &tvNSec) +{ + struct timespec time; + if (clock_gettime(CLOCK_MONOTONIC, &time) < 0) { + DHLOGE("Get current time failed"); + } + tvSec = time.tv_sec; + tvNSec = time.tv_nsec; +} + int64_t GetNowTimeUs() { std::chrono::microseconds nowUs = @@ -216,7 +228,7 @@ bool IsAudioParam(const json &jsonObj, const std::string &key) int32_t CalculateSampleNum(uint32_t sampleRate, uint32_t timems) { - return sampleRate * timems / AUDIO_MS_PER_SECOND; + return (sampleRate * timems) / AUDIO_MS_PER_SECOND; } int64_t GetCurNano() @@ -249,8 +261,40 @@ int32_t AbsoluteSleep(int64_t nanoTime) if (ret != 0) { DHLOGE("AbsoluteSleep may failed, ret is : %d", ret); } - return ret; } + +int64_t CalculateOffset(const int64_t frameIndex, const int64_t framePeriodNs, const int64_t startTime) +{ + int64_t totalOffset = GetCurNano() - startTime; + return totalOffset - frameIndex * framePeriodNs; +} + +int64_t UpdateTimeOffset(const int64_t frameIndex, const int64_t framePeriodNs, const int64_t updateInterval, + int64_t &startTime) +{ + int64_t timeOffset = 0; + if (frameIndex == 0) { + startTime = GetCurNano(); + } else if (frameIndex % updateInterval == 0) { + timeOffset = CalculateOffset(frameIndex, framePeriodNs, startTime); + } + return timeOffset; +} + +bool CheckIsNum(const std::string &jsonString) +{ + if (jsonString.empty() || jsonString.size() > MAX_KEY_DH_ID_LEN) { + DHLOGE("Json string size %d, is zero or too long.", jsonString.size()); + return false; + } + for (char const &c : jsonString) { + if (!std::isdigit(c)) { + DHLOGE("Json string is not number."); + return false; + } + } + return true; +} } // namespace DistributedHardware } // namespace OHOS \ No newline at end of file diff --git a/hdf_interfaces/distributed_audio/audioext/v1_0/IDAudioCallback.idl b/hdf_interfaces/distributed_audio/audioext/v1_0/IDAudioCallback.idl index 6c2c6c17..b4f787c7 100644 --- a/hdf_interfaces/distributed_audio/audioext/v1_0/IDAudioCallback.idl +++ b/hdf_interfaces/distributed_audio/audioext/v1_0/IDAudioCallback.idl @@ -24,6 +24,6 @@ import ohos.hdi.distributed_audio.audioext.v1_0.Types; NotifyEvent([in] String adpName, [in] int devId, [in] struct DAudioEvent event); WriteStreamData([in] String adpName, [in] int devId, [in] struct AudioData data); ReadStreamData([in] String adpName, [in] int devId, [out] struct AudioData data); - ReadMmapPosition([in] String adpName, [in] int devId, [out] unsigned long frames, [out] unsigned long timeStamp); + ReadMmapPosition([in] String adpName, [in] int devId, [out] unsigned long frames, [out] struct CurrentTime time); RefreshAshmemInfo([in] String adpName, [in] int devId, [in] FileDescriptor fd, [in] int ashmemLength, [in] int lengthPerTrans); } \ No newline at end of file diff --git a/hdf_interfaces/distributed_audio/audioext/v1_0/Types.idl b/hdf_interfaces/distributed_audio/audioext/v1_0/Types.idl index d31a47ae..35b5c1fb 100644 --- a/hdf_interfaces/distributed_audio/audioext/v1_0/Types.idl +++ b/hdf_interfaces/distributed_audio/audioext/v1_0/Types.idl @@ -14,6 +14,10 @@ */ package ohos.hdi.distributed_audio.audioext.v1_0; +enum PortOperationMode { + NORMAL_MODE = 0, + MMAP_MODE = 1, +}; struct AudioParameter { unsigned int format; unsigned int channelCount; @@ -21,8 +25,8 @@ struct AudioParameter { unsigned int period; unsigned int frameSize; unsigned int streamUsage; - int renderFlags; - int capturerFlags; + enum PortOperationMode renderFlags; + enum PortOperationMode capturerFlags; String ext; }; struct AudioData { @@ -33,3 +37,7 @@ struct DAudioEvent { int type; String content; }; +struct CurrentTime { + long tvSec; + long tvNSec; +}; \ No newline at end of file diff --git a/hdf_service/distributed_audio/hdi_service/audio/v1_0/BUILD.gn b/hdf_service/distributed_audio/hdi_service/audio/v1_0/BUILD.gn index 638663e1..1c1229f9 100644 --- a/hdf_service/distributed_audio/hdi_service/audio/v1_0/BUILD.gn +++ b/hdf_service/distributed_audio/hdi_service/audio/v1_0/BUILD.gn @@ -28,11 +28,9 @@ ohos_shared_library("libaudio_manager_daudio_primary_service_1.0") { "./src/audio_adapter_interface_impl.cpp", "./src/audio_capture_interface_impl.cpp", "./src/audio_capture_interface_impl_base.cpp", - "./src/audio_capture_lowlatency_impl.cpp", "./src/audio_manager_interface_impl.cpp", "./src/audio_render_interface_impl.cpp", "./src/audio_render_interface_impl_base.cpp", - "./src/audio_render_lowlatency_impl.cpp", ] public_deps = [ diff --git a/hdf_service/distributed_audio/hdi_service/audio/v1_0/include/audio_adapter_interface_impl.h b/hdf_service/distributed_audio/hdi_service/audio/v1_0/include/audio_adapter_interface_impl.h index 73c4df7a..569bbbf5 100644 --- a/hdf_service/distributed_audio/hdi_service/audio/v1_0/include/audio_adapter_interface_impl.h +++ b/hdf_service/distributed_audio/hdi_service/audio/v1_0/include/audio_adapter_interface_impl.h @@ -26,10 +26,8 @@ #include "audio_capture_interface_impl.h" #include "audio_capture_interface_impl_base.h" -#include "audio_capture_lowlatency_impl.h" #include "audio_render_interface_impl.h" #include "audio_render_interface_impl_base.h" -#include "audio_render_lowlatency_impl.h" namespace OHOS { namespace HDI { @@ -37,6 +35,7 @@ namespace DistributedAudio { namespace Audio { namespace V1_0 { using OHOS::HDI::DistributedAudio::Audioext::V1_0::DAudioEvent; +using OHOS::HDI::DistributedAudio::Audioext::V1_0::PortOperationMode; using OHOS::HDI::DistributedAudio::Audioext::V1_0::AudioParameter; using OHOS::HDI::DistributedAudio::Audioext::V1_0::IDAudioCallback; @@ -63,11 +62,6 @@ typedef enum { EVENT_IS_STREAM_MUTE = 4, } VolumeEventType; -typedef enum { - NORMAL_FLAG = 0, - MMAP_FLAG = 1, -} RenderCaptureFlag; - class AudioAdapterInterfaceImpl : public IAudioAdapter { public: explicit AudioAdapterInterfaceImpl(const AudioAdapterDescriptor &desc); @@ -156,8 +150,8 @@ private: uint32_t timeInterval_ = 5; // mmap param - int32_t renderFlags_ = NORMAL_FLAG; - int32_t capturerFlags_ = NORMAL_FLAG; + PortOperationMode renderFlags_ = Audioext::V1_0::NORMAL_MODE; + PortOperationMode capturerFlags_ = Audioext::V1_0::NORMAL_MODE; const std::string NOT_MUTE_STATUS = "0"; const std::string IS_MUTE_STATUS = "1"; diff --git a/hdf_service/distributed_audio/hdi_service/audio/v1_0/include/audio_capture_interface_impl.h b/hdf_service/distributed_audio/hdi_service/audio/v1_0/include/audio_capture_interface_impl.h index cf216936..d60f8db4 100644 --- a/hdf_service/distributed_audio/hdi_service/audio/v1_0/include/audio_capture_interface_impl.h +++ b/hdf_service/distributed_audio/hdi_service/audio/v1_0/include/audio_capture_interface_impl.h @@ -80,14 +80,14 @@ public: int32_t TurnStandbyMode() override; int32_t AudioDevDump(int32_t range, int32_t fd) override; int32_t IsSupportsPauseAndResume(bool &supportPause, bool &supportResume) override; - int64_t CalculateOffset(int64_t count); private: + static constexpr int64_t AUDIO_OFFSET_FRAME_NUM = 10; std::string adapterName_; AudioDeviceDescriptor devDesc_; AudioSampleAttributes devAttrs_; uint32_t timeInterval_ = 5; - int32_t frameIdx_ = 0; + int64_t frameIndex_ = 0; int64_t framePeriodNs_ = 0; int64_t startTime_ = 0; diff --git a/hdf_service/distributed_audio/hdi_service/audio/v1_0/include/audio_render_interface_impl.h b/hdf_service/distributed_audio/hdi_service/audio/v1_0/include/audio_render_interface_impl.h index b5b9a77f..ff602bd8 100644 --- a/hdf_service/distributed_audio/hdi_service/audio/v1_0/include/audio_render_interface_impl.h +++ b/hdf_service/distributed_audio/hdi_service/audio/v1_0/include/audio_render_interface_impl.h @@ -97,6 +97,8 @@ private: int32_t FadeInProcess(const uint32_t durationFrame, int8_t* frameData, const size_t frameLength); private: + static constexpr int64_t AUDIO_OFFSET_FRAME_NUM = 10; + std::string adapterName_; AudioDeviceDescriptor devDesc_; AudioSampleAttributes devAttrs_; @@ -110,6 +112,10 @@ private: sptr audioExtCallback_ = nullptr; sptr renderCallback_ = nullptr; bool firstOpenFlag = true; + + int64_t frameIndex_ = 0; + int64_t framePeriodNs_ = 0; + int64_t startTime_ = 0; }; } // V1_0 } // Audio diff --git a/hdf_service/distributed_audio/hdi_service/audio/v1_0/src/audio_adapter_interface_impl.cpp b/hdf_service/distributed_audio/hdi_service/audio/v1_0/src/audio_adapter_interface_impl.cpp index 20349c9a..b993d2f8 100644 --- a/hdf_service/distributed_audio/hdi_service/audio/v1_0/src/audio_adapter_interface_impl.cpp +++ b/hdf_service/distributed_audio/hdi_service/audio/v1_0/src/audio_adapter_interface_impl.cpp @@ -84,13 +84,8 @@ int32_t AudioAdapterInterfaceImpl::CreateRender(const AudioDeviceDescriptor &des return HDF_FAILURE; } } - if (attrs.type == AUDIO_MMAP_NOIRQ) { - renderFlags_ = MMAP_FLAG; - audioRender_ = new AudioRenderLowLatencyImpl(adpDescriptor_.adapterName, desc, attrs, extSpkCallback_); - } else { - renderFlags_ = NORMAL_FLAG; - audioRender_ = new AudioRenderInterfaceImpl(adpDescriptor_.adapterName, desc, attrs, extSpkCallback_); - } + renderFlags_ = Audioext::V1_0::NORMAL_MODE; + audioRender_ = new AudioRenderInterfaceImpl(adpDescriptor_.adapterName, desc, attrs, extSpkCallback_); if (audioRender_ == nullptr) { DHLOGE("Create render failed."); return HDF_FAILURE; @@ -141,13 +136,8 @@ int32_t AudioAdapterInterfaceImpl::CreateCapture(const AudioDeviceDescriptor &de return HDF_FAILURE; } } - if (attrs.type == AUDIO_MMAP_NOIRQ) { - capturerFlags_ = MMAP_FLAG; - audioCapture_ = new AudioCaptureLowLatencyImpl(adpDescriptor_.adapterName, desc, attrs, extMicCallback_); - } else { - capturerFlags_ = NORMAL_FLAG; - audioCapture_ = new AudioCaptureInterfaceImpl(adpDescriptor_.adapterName, desc, attrs, extMicCallback_); - } + capturerFlags_ = Audioext::V1_0::NORMAL_MODE; + audioCapture_ = new AudioCaptureInterfaceImpl(adpDescriptor_.adapterName, desc, attrs, extMicCallback_); if (audioCapture_ == nullptr) { DHLOGE("Create capture failed."); return HDF_FAILURE; @@ -420,7 +410,7 @@ int32_t AudioAdapterInterfaceImpl::OpenRenderDevice(const AudioDeviceDescriptor renderParam_.sampleRate = attrs.sampleRate; renderParam_.streamUsage = attrs.type; renderParam_.frameSize = CalculateFrameSize(attrs.sampleRate, attrs.channelCount, attrs.format, - timeInterval_, renderFlags_ == MMAP_FLAG); + timeInterval_, renderFlags_ == Audioext::V1_0::MMAP_MODE); renderParam_.renderFlags = renderFlags_; int32_t ret = extSpkCallback_->SetParameters(adpDescriptor_.adapterName, desc.pins, renderParam_); @@ -483,7 +473,7 @@ int32_t AudioAdapterInterfaceImpl::OpenCaptureDevice(const AudioDeviceDescriptor captureParam_.sampleRate = attrs.sampleRate; captureParam_.streamUsage = attrs.type; captureParam_.frameSize = CalculateFrameSize(attrs.sampleRate, attrs.channelCount, - attrs.format, timeInterval_, capturerFlags_ == MMAP_FLAG); + attrs.format, timeInterval_, capturerFlags_ == Audioext::V1_0::MMAP_MODE); captureParam_.capturerFlags = capturerFlags_; int32_t ret = extMicCallback_->SetParameters(adpDescriptor_.adapterName, desc.pins, captureParam_); diff --git a/hdf_service/distributed_audio/hdi_service/audio/v1_0/src/audio_capture_interface_impl.cpp b/hdf_service/distributed_audio/hdi_service/audio/v1_0/src/audio_capture_interface_impl.cpp index 3b84eeaf..b0331913 100644 --- a/hdf_service/distributed_audio/hdi_service/audio/v1_0/src/audio_capture_interface_impl.cpp +++ b/hdf_service/distributed_audio/hdi_service/audio/v1_0/src/audio_capture_interface_impl.cpp @@ -40,7 +40,8 @@ AudioCaptureInterfaceImpl::AudioCaptureInterfaceImpl(const std::string &adpName, devAttrs_(attrs), audioExtCallback_(callback) { devAttrs_.frameSize = CalculateFrameSize(attrs.sampleRate, attrs.channelCount, attrs.format, timeInterval_, false); - framePeriodNs_ = devAttrs_.frameSize * AUDIO_NS_PER_SECOND / (attrs.sampleRate * attrs.channelCount * attrs.format); + const int32_t sizePerSec = static_cast(attrs.sampleRate * attrs.channelCount) *attrs.format; + framePeriodNs_ = (static_cast(devAttrs_.frameSize) * AUDIO_NS_PER_SECOND) / sizePerSec; DHLOGD("Distributed audio capture constructed, period(%d),frameSize(%d), framePeriodNs_(%d).", attrs.period, devAttrs_.frameSize, framePeriodNs_); DHLOGD("Distributed audio capture constructed, id(%d).", desc.pins); @@ -59,30 +60,18 @@ int32_t AudioCaptureInterfaceImpl::GetCapturePosition(uint64_t &frames, AudioTim return HDF_SUCCESS; } -int64_t AudioCaptureInterfaceImpl::CalculateOffset(int64_t count) -{ - const int64_t gapTime = AUDIO_OFFSET_FRAME_NUM * framePeriodNs_; - int64_t totalOffset = GetCurNano() - startTime_; - return totalOffset - count * gapTime; -} - int32_t AudioCaptureInterfaceImpl::CaptureFrame(std::vector &frame, uint64_t requestBytes) { - DHLOGI("Capture frame[sampleRate: %d, channelCount: %d, format: %d, frameSize: %d].", devAttrs_.sampleRate, + DHLOGD("Capture frame[sampleRate: %d, channelCount: %d, format: %d, frameSize: %d].", devAttrs_.sampleRate, devAttrs_.channelCount, devAttrs_.format, devAttrs_.frameSize); - int64_t timeOffset = 0; - if (frameIdx_ == 0) { - startTime_ = GetCurNano(); - } else if (frameIdx_ % AUDIO_OFFSET_FRAME_NUM == 0) { - timeOffset = CalculateOffset(frameIdx_ / AUDIO_OFFSET_FRAME_NUM); - DHLOGI("Capture frameIdx_: %d, timeOffset: %d.", frameIdx_, timeOffset); - } + int64_t timeOffset = UpdateTimeOffset(frameIndex_, framePeriodNs_, AUDIO_OFFSET_FRAME_NUM, startTime_); + DHLOGD("Capture framIndex: %lld, timeOffset: %lld.", frameIndex_, timeOffset); + std::lock_guard captureLck(captureMtx_); if (captureStatus_ != CAPTURE_STATUS_START) { DHLOGE("Capture status wrong, return false."); return HDF_FAILURE; } - if (audioExtCallback_ == nullptr) { DHLOGE("Callback is nullptr."); return HDF_FAILURE; @@ -101,9 +90,9 @@ int32_t AudioCaptureInterfaceImpl::CaptureFrame(std::vector &frame, uint DHLOGE("Copy capture frame failed, error code %d.", ret); return HDF_FAILURE; } - ++frameIdx_; - AbsoluteSleep(startTime_ + frameIdx_ * framePeriodNs_ - timeOffset); - DHLOGI("Capture audio frame success."); + ++frameIndex_; + AbsoluteSleep(startTime_ + frameIndex_ * framePeriodNs_ - timeOffset); + DHLOGD("Capture audio frame success."); return HDF_SUCCESS; } @@ -121,7 +110,7 @@ int32_t AudioCaptureInterfaceImpl::Start() } std::lock_guard captureLck(captureMtx_); captureStatus_ = CAPTURE_STATUS_START; - frameIdx_ = 0; + frameIndex_ = 0; startTime_ = 0; return HDF_SUCCESS; } diff --git a/hdf_service/distributed_audio/hdi_service/audio/v1_0/src/audio_render_interface_impl.cpp b/hdf_service/distributed_audio/hdi_service/audio/v1_0/src/audio_render_interface_impl.cpp index 4ad915d7..83a07389 100644 --- a/hdf_service/distributed_audio/hdi_service/audio/v1_0/src/audio_render_interface_impl.cpp +++ b/hdf_service/distributed_audio/hdi_service/audio/v1_0/src/audio_render_interface_impl.cpp @@ -39,7 +39,10 @@ AudioRenderInterfaceImpl::AudioRenderInterfaceImpl(const std::string &adpName, c devAttrs_(attrs), audioExtCallback_(callback) { devAttrs_.frameSize = CalculateFrameSize(attrs.sampleRate, attrs.channelCount, attrs.format, timeInterval_, false); - DHLOGD("Distributed audio render constructed, id(%d).", desc.pins); + const int32_t sizePerSec = static_cast(attrs.sampleRate * attrs.channelCount) *attrs.format; + framePeriodNs_ = (static_cast(devAttrs_.frameSize) * AUDIO_NS_PER_SECOND) /sizePerSec; + DHLOGD("Distributed audio render constructed, period(%d), frameSize(%d), framePeriodNs_(%d).", + attrs.period, devAttrs_.frameSize, framePeriodNs_); } AudioRenderInterfaceImpl::~AudioRenderInterfaceImpl() @@ -89,6 +92,8 @@ int32_t AudioRenderInterfaceImpl::RenderFrame(const std::vector &frame, { DHLOGI("Render frame[sampleRate: %d, channelCount: %d, format: %d, frameSize: %d].", devAttrs_.sampleRate, devAttrs_.channelCount, devAttrs_.format, devAttrs_.frameSize); + int64_t timeOffset = UpdateTimeOffset(frameIndex_, framePeriodNs_, AUDIO_OFFSET_FRAME_NUM, startTime_); + DHLOGD("Render frameIndex: %lld, timeOffset: %lld.", frameIndex_, timeOffset); std::lock_guard renderLck(renderMtx_); if (renderStatus_ != RENDER_STATUS_START) { @@ -109,7 +114,9 @@ int32_t AudioRenderInterfaceImpl::RenderFrame(const std::vector &frame, return HDF_FAILURE; } - DHLOGI("Render audio frame success."); + ++frameIndex_; + AbsoluteSleep(startTime_ + frameIndex_ * framePeriodNs_ - timeOffset); + DHLOGD("Render audio frame success."); return HDF_SUCCESS; } @@ -186,6 +193,8 @@ int32_t AudioRenderInterfaceImpl::Start() std::lock_guard renderLck(renderMtx_); renderStatus_ = RENDER_STATUS_START; currentFrame_ = CUR_FRAME_INIT_VALUE; + frameIndex_ = 0; + startTime_ = 0; return HDF_SUCCESS; } diff --git a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/BUILD.gn b/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/BUILD.gn index 22fe15d1..2e12f391 100644 --- a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/BUILD.gn +++ b/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/BUILD.gn @@ -23,7 +23,5 @@ group("hdi_service_audio_test") { "${hdf_ser_aud_path}/test/unittest/audio_capture_interface:hdi_service_audio_capture_test", "${hdf_ser_aud_path}/test/unittest/audio_manager_interface:hdi_service_audio_manager_test", "${hdf_ser_aud_path}/test/unittest/audio_render_interface:hdi_service_audio_render_test", - "${hdf_ser_aud_path}/test/unittest/audio_render_lowlatency:hdi_service_audio_render_lowlatency_test", - "${hdf_ser_aud_path}/test/unittest/audio_capture_lowlatency:hdi_service_audio_capture_lowlatency_test", ] } diff --git a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/audio_adapter_interface/BUILD.gn b/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/audio_adapter_interface/BUILD.gn index 9bf727a0..0dc8b0b6 100644 --- a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/audio_adapter_interface/BUILD.gn +++ b/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/audio_adapter_interface/BUILD.gn @@ -34,7 +34,7 @@ config("module_private_config") { ] } -## UnitTest hdi_service_audio_test +## UnitTest hdi_service_adapter_test ohos_unittest("HDIServiceAudioAdapterTest") { module_out_path = module_out_path diff --git a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/audio_adapter_interface/src/audio_adapter_interface_impl_test.cpp b/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/audio_adapter_interface/src/audio_adapter_interface_impl_test.cpp index 9a1efa57..c2c586a3 100644 --- a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/audio_adapter_interface/src/audio_adapter_interface_impl_test.cpp +++ b/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/audio_adapter_interface/src/audio_adapter_interface_impl_test.cpp @@ -51,6 +51,8 @@ HWTEST_F(AudioAdapterInterfaceImpTest, InitAllPorts_001, TestSize.Level1) { sptr speakerCallback = nullptr; AdapterTest_->SetSpeakerCallback(speakerCallback); + speakerCallback = new MockIDAudioCallback(); + AdapterTest_->SetSpeakerCallback(speakerCallback); sptr micCallback = nullptr; AdapterTest_->SetMicCallback(micCallback); diff --git a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/audio_capture_interface/src/audio_capture_interface_impl_test.cpp b/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/audio_capture_interface/src/audio_capture_interface_impl_test.cpp index bb13246f..d23237d3 100644 --- a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/audio_capture_interface/src/audio_capture_interface_impl_test.cpp +++ b/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/audio_capture_interface/src/audio_capture_interface_impl_test.cpp @@ -113,7 +113,7 @@ HWTEST_F(AudioCaptureInterfaceImplTest, CaptureFrame_003, TestSize.Level1) */ HWTEST_F(AudioCaptureInterfaceImplTest, Start_001, TestSize.Level1) { - EXPECT_EQ(HDF_SUCCESS, audioCaptureInterfaceImpl_->Start()); + EXPECT_EQ(HDF_FAILURE, audioCaptureInterfaceImpl_->Start()); } /** @@ -124,7 +124,7 @@ HWTEST_F(AudioCaptureInterfaceImplTest, Start_001, TestSize.Level1) */ HWTEST_F(AudioCaptureInterfaceImplTest, Stop_001, TestSize.Level1) { - EXPECT_EQ(HDF_SUCCESS, audioCaptureInterfaceImpl_->Stop()); + EXPECT_EQ(HDF_FAILURE, audioCaptureInterfaceImpl_->Stop()); } /** diff --git a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/audio_test_utils/audio_test_utils.h b/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/audio_test_utils/audio_test_utils.h index 883035ee..bc57b7db 100644 --- a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/audio_test_utils/audio_test_utils.h +++ b/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/audio_test_utils/audio_test_utils.h @@ -34,6 +34,7 @@ namespace V1_0 { using OHOS::HDI::DistributedAudio::Audioext::V1_0::DAudioEvent; using OHOS::HDI::DistributedAudio::Audioext::V1_0::AudioData; using OHOS::HDI::DistributedAudio::Audioext::V1_0::AudioParameter; +using OHOS::HDI::DistributedAudio::Audioext::V1_0::CurrentTime; using OHOS::HDI::DistributedAudio::Audioext::V1_0::IDAudioCallback; using OHOS::HDI::DistributedAudio::Audio::V1_0::IAudioCallback; class MockIDAudioCallback : public IDAudioCallback { @@ -71,7 +72,8 @@ public: return DistributedHardware::DH_SUCCESS; } - int32_t ReadMmapPosition(const std::string &adpName, int32_t devId, uint64_t &frames, uint64_t &timeStamp) override + int32_t ReadMmapPosition(const std::string &adpName, int32_t devId, uint64_t &frames, + CurrentTime &time) override { return DistributedHardware::DH_SUCCESS; } @@ -514,7 +516,8 @@ public: return DistributedHardware::ERR_DH_AUDIO_HDF_FAIL; } - int32_t ReadMmapPosition(const std::string &adpName, int32_t devId, uint64_t &frames, uint64_t &timeStamp) override + int32_t ReadMmapPosition(const std::string &adpName, int32_t devId, uint64_t &frames, + CurrentTime &time) override { return DistributedHardware::DH_SUCCESS; } diff --git a/hdf_service/distributed_audio/hdi_service/audio_ext/v1_0/test/unittest/include/daudio_test_utils.h b/hdf_service/distributed_audio/hdi_service/audio_ext/v1_0/test/unittest/include/daudio_test_utils.h index 3d1c3062..e54fc355 100644 --- a/hdf_service/distributed_audio/hdi_service/audio_ext/v1_0/test/unittest/include/daudio_test_utils.h +++ b/hdf_service/distributed_audio/hdi_service/audio_ext/v1_0/test/unittest/include/daudio_test_utils.h @@ -57,7 +57,8 @@ public: return 0; } - int32_t ReadMmapPosition(const std::string &adpName, int32_t devId, uint64_t &frames, uint64_t &timeStamp) override + int32_t ReadMmapPosition(const std::string &adpName, int32_t devId, uint64_t &frames, + CurrentTime &time) override { return 0; } diff --git a/hdf_service/distributed_audio/hdi_service/common/include/daudio_constants.h b/hdf_service/distributed_audio/hdi_service/common/include/daudio_constants.h index 9b58ba74..56ef2fb6 100644 --- a/hdf_service/distributed_audio/hdi_service/common/include/daudio_constants.h +++ b/hdf_service/distributed_audio/hdi_service/common/include/daudio_constants.h @@ -66,13 +66,13 @@ constexpr uint32_t AUDIO_FORMAT_DEFAULT = 16; constexpr int32_t MILLISECOND_PER_SECOND = 1000; constexpr uint32_t DEFAULT_AUDIO_DATA_SIZE = 4096; -constexpr int32_t AUDIO_OFFSET_FRAME_NUM = 10; +constexpr int64_t AUDIO_OFFSET_FRAME_NUM = 10; constexpr uint32_t AUDIO_DEFAULT_MAX_VOLUME_LEVEL = 15; constexpr uint32_t AUDIO_DEFAULT_MIN_VOLUME_LEVEL = 0; -constexpr uint32_t DAUDIO_MAX_ASHMEM_LEN = 100000; -constexpr uint32_t DAUDIO_MIN_ASHMEM_LEN = 10; +constexpr int32_t DAUDIO_MAX_ASHMEM_LEN = 100000; +constexpr int32_t DAUDIO_MIN_ASHMEM_LEN = 10; } // DistributeHardware } // OHOS #endif // OHOS_DAUDIO_CONSTANTS_H diff --git a/hdf_service/distributed_audio/hdi_service/common/include/daudio_events.h b/hdf_service/distributed_audio/hdi_service/common/include/daudio_events.h index b8ef0121..5c9dd473 100644 --- a/hdf_service/distributed_audio/hdi_service/common/include/daudio_events.h +++ b/hdf_service/distributed_audio/hdi_service/common/include/daudio_events.h @@ -59,10 +59,6 @@ typedef enum AudioExtParamEvent { HDF_AUDIO_EVENT_RENDER_STATE_CHANGE = 11, HDF_AUDIO_EVNET_MUTE_SET = 12, HDF_AUDIO_EVENT_CHANGE_PLAY_STATUS = 13, - HDF_AUDIO_EVENT_MMAP_START = 14, - HDF_AUDIO_EVENT_MMAP_STOP = 15, - HDF_AUDIO_EVENT_MMAP_START_MIC = 16, - HDF_AUDIO_EVENT_MMAP_STOP_MIC = 17, HDF_AUDIO_EVENT_START = 18, HDF_AUDIO_EVENT_STOP = 19, } EXT_PARAM_EVENT; diff --git a/hdf_service/distributed_audio/hdi_service/common/utils/include/daudio_utils.h b/hdf_service/distributed_audio/hdi_service/common/utils/include/daudio_utils.h index 64da2408..903d1c27 100644 --- a/hdf_service/distributed_audio/hdi_service/common/utils/include/daudio_utils.h +++ b/hdf_service/distributed_audio/hdi_service/common/utils/include/daudio_utils.h @@ -45,6 +45,11 @@ int32_t CalculateSampleNum(uint32_t sampleRate, uint32_t timems); int64_t GetCurNano(); int32_t AbsoluteSleep(int64_t nanoTime); + +int64_t CalculateOffset(const int64_t frameindex, const int64_t framePeriodNs, const int64_t startTime); + +int64_t UpdateTimeOffset(const int64_t frameIndex, const int64_t framePeriodNs, const int64_t updateInterval, + int64_t &startTime); } // DistributedHardware } // OHOS #endif \ No newline at end of file diff --git a/hdf_service/distributed_audio/hdi_service/common/utils/src/daudio_utils.cpp b/hdf_service/distributed_audio/hdi_service/common/utils/src/daudio_utils.cpp index 8bee9c30..68cf9d1b 100644 --- a/hdf_service/distributed_audio/hdi_service/common/utils/src/daudio_utils.cpp +++ b/hdf_service/distributed_audio/hdi_service/common/utils/src/daudio_utils.cpp @@ -108,12 +108,12 @@ int32_t GetDevTypeByDHId(int32_t dhId) uint32_t CalculateFrameSize(uint32_t sampleRate, uint32_t channelCount, int32_t format, uint32_t timeInterval, bool isMMAP) { - return isMMAP ? sampleRate * channelCount * format * timeInterval / AUDIO_MS_PER_SECOND : DEFAULT_AUDIO_DATA_SIZE; + return isMMAP ? (sampleRate * channelCount * format * timeInterval) / AUDIO_MS_PER_SECOND : DEFAULT_AUDIO_DATA_SIZE; } int32_t CalculateSampleNum(uint32_t sampleRate, uint32_t timems) { - return sampleRate * timems / AUDIO_MS_PER_SECOND; + return (sampleRate * timems) / AUDIO_MS_PER_SECOND; } int64_t GetCurNano() @@ -141,8 +141,25 @@ int32_t AbsoluteSleep(int64_t nanoTime) clockid_t clockId = CLOCK_MONOTONIC; ret = clock_nanosleep(clockId, TIMER_ABSTIME, &time, nullptr); - return ret; } + +int64_t CalculateOffset(const int64_t frameIndex, const int64_t framePeriodNs, const int64_t startTime) +{ + int64_t totalOffset = GetCurNano() - startTime; + return totalOffset - frameIndex * framePeriodNs; +} + +int64_t UpdateTimeOffset(const int64_t frameIndex, const int64_t framePeriodNs, const int64_t updateInterval, + int64_t &startTime) +{ + int64_t timeOffset = 0; + if (frameIndex ==0) { + startTime = GetCurNano(); + } else if (frameIndex % updateInterval == 0) { + timeOffset = CalculateOffset(frameIndex, framePeriodNs, startTime); + } + return timeOffset; +} } // namespace DistributedHardware } // namespace OHOS \ No newline at end of file diff --git a/hdf_service/distributed_audio/interface/audio_ext/v1_0/i_daudio_hdf_callback.h b/hdf_service/distributed_audio/interface/audio_ext/v1_0/i_daudio_hdf_callback.h index aaf00165..c5fb27a0 100644 --- a/hdf_service/distributed_audio/interface/audio_ext/v1_0/i_daudio_hdf_callback.h +++ b/hdf_service/distributed_audio/interface/audio_ext/v1_0/i_daudio_hdf_callback.h @@ -30,7 +30,7 @@ public: virtual int32_t WriteStreamData(int32_t devId, int32_t dhId, struct AudioStreamData &data) = 0; virtual struct AudioStreamData* ReadStreamData(int32_t devId, int32_t dhId) = 0; virtual int32_t ReadMmapPosition(int32_t devId, int32_t dhId, - uint64_t &frames, uint64_t &timeStamp) = 0; + uint64_t &frames, struct CurrentTime &time) = 0; virtual int32_t RefreshAshmemInfo(int32_t devId, int32_t dhId, int32_t fd, int32_t ashmemLength, int32_t lengthPerTrans) = 0; } // namespace DistributedHardware diff --git a/interfaces/inner_kits/native_cpp/audio_source/src/daudio_ipc_callback_stub.cpp b/interfaces/inner_kits/native_cpp/audio_source/src/daudio_ipc_callback_stub.cpp index 149a1098..68f950c2 100644 --- a/interfaces/inner_kits/native_cpp/audio_source/src/daudio_ipc_callback_stub.cpp +++ b/interfaces/inner_kits/native_cpp/audio_source/src/daudio_ipc_callback_stub.cpp @@ -43,7 +43,7 @@ int32_t DAudioIpcCallbackStub::OnRemoteRequest(uint32_t code, MessageParcel &dat std::map::iterator iter = memberFuncMap_.find(code); if (iter == memberFuncMap_.end()) { DHLOGE("Invalid request code."); - return ERR_DH_AUDIO_SA_INVALID_REQUEST_CODE; + return IPCObjectStub::OnRemoteRequest(code, data, reply, option); } DAudioCallbackFunc &func = iter->second; return (this->*func)(data, reply, option); diff --git a/services/audioclient/interface/imic_client.h b/services/audioclient/interface/imic_client.h new file mode 100644 index 00000000..91feb930 --- /dev/null +++ b/services/audioclient/interface/imic_client.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OHOS_IMIC_CLIENT_H +#define OHOS_IMIC_CLIENT_H + +#include + +#include "audio_param.h" + +namespace OHOS { +namespace DistributedHardware { +class IMicClient { +public: + IMicClient() = default; + virtual ~IMicClient() = default; + + virtual int32_t SetUp(const AudioParam ¶m) = 0; + virtual int32_t Release() = 0; + virtual int32_t StartCapture() = 0; + virtual int32_t StopCapture() = 0; +}; +} // namespace DistributedHardware +} // namespace OHOS +#endif // OHOS_IMIC_CLIENT_H diff --git a/services/audioclient/interface/ispk_client.h b/services/audioclient/interface/ispk_client.h new file mode 100644 index 00000000..a6c03854 --- /dev/null +++ b/services/audioclient/interface/ispk_client.h @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OHOS_ISPK_CLIENT_H +#define OHOS_ISPK_CLIENT_H + +#include + +#include "audio_param.h" + +namespace OHOS { +namespace DistributedHardware { +class ISpkClient { +public: + ISpkClient() = default; + virtual ~ISpkClient() = default; + + virtual int32_t SetUp(const AudioParam ¶m) = 0; + virtual int32_t Release() = 0; + virtual int32_t StartRender() = 0; + virtual int32_t StopRender() = 0; + virtual int32_t SetMute(const AudioEvent &event) = 0; + virtual int32_t SetAudioParameters(const AudioEvent &event) = 0; + virtual void PlayStatusChange(const std::string &args) = 0; +}; +} // namespace DistributedHardware +} // namespace OHOS +#endif // OHOS_ISPK_CLIENT_H \ No newline at end of file diff --git a/services/audioclient/micclient/include/dmic_client.h b/services/audioclient/micclient/include/dmic_client.h index 9263220c..0e131309 100644 --- a/services/audioclient/micclient/include/dmic_client.h +++ b/services/audioclient/micclient/include/dmic_client.h @@ -37,20 +37,23 @@ #include "iaudio_data_transport.h" #include "iaudio_datatrans_callback.h" #include "iaudio_event_callback.h" +#include "imic_client.h" namespace OHOS { namespace DistributedHardware { -class DMicClient : public IAudioDataTransCallback, public std::enable_shared_from_this { +class DMicClient : public IAudioDataTransCallback, + public IMicClient, + public std::enable_shared_from_this { public: DMicClient(const std::string &devId, const std::shared_ptr &callback) : devId_(devId), eventCallback_(callback) {}; ~DMicClient() override; int32_t OnStateChange(const AudioEventType type) override; int32_t OnDecodeTransDataDone(const std::shared_ptr &audioData) override; - int32_t SetUp(const AudioParam ¶m); - int32_t Release(); - int32_t StartCapture(); - int32_t StopCapture(); + int32_t SetUp(const AudioParam ¶m) override; + int32_t Release() override; + int32_t StartCapture() override; + int32_t StopCapture() override; private: void CaptureThreadRunning(); diff --git a/services/audioclient/spkclient/include/dspeaker_client.h b/services/audioclient/spkclient/include/dspeaker_client.h index c5453a1e..bce42c94 100644 --- a/services/audioclient/spkclient/include/dspeaker_client.h +++ b/services/audioclient/spkclient/include/dspeaker_client.h @@ -39,10 +39,12 @@ #include "iaudio_data_transport.h" #include "iaudio_datatrans_callback.h" #include "iaudio_event_callback.h" +#include "ispk_client.h" namespace OHOS { namespace DistributedHardware { class DSpeakerClient : public IAudioDataTransCallback, + public ISpkClient, public AudioStandard::VolumeKeyEventCallback, public AudioStandard::AudioRendererCallback, public std::enable_shared_from_this { @@ -57,23 +59,27 @@ public: int32_t OnDecodeTransDataDone(const std::shared_ptr &audioData) override; void OnVolumeKeyEvent(AudioStandard::VolumeEvent volumeEvent) override; void OnInterrupt(const AudioStandard::InterruptEvent &interruptEvent) override; - int32_t SetUp(const AudioParam ¶m); - int32_t Release(); - int32_t StartRender(); - int32_t StopRender(); - int32_t SetMute(const AudioEvent &event); - int32_t SetAudioParameters(const AudioEvent &event); - std::string GetVolumeLevel(); - void PlayStatusChange(const std::string &args); + int32_t SetUp(const AudioParam ¶m) override; + int32_t Release() override; + int32_t StartRender() override; + int32_t StopRender() override; + int32_t SetMute(const AudioEvent &event) override; + int32_t SetAudioParameters(const AudioEvent &event) override; + void PlayStatusChange(const std::string &args) override; private: + std::string GetVolumeLevel(); void PlayThreadRunning(); void Pause(); void ReStart(); + void FillJitterQueue(); + void FlushJitterQueue(); private: - constexpr static size_t DATA_QUEUE_MAX_SIZE = 5; + constexpr static size_t DATA_QUEUE_MAX_SIZE = 12; constexpr static size_t REQUEST_DATA_WAIT = 10; + constexpr static size_t DATA_QUEUE_SIZE = 8; + constexpr static size_t SLEEP_TIME = 5000; static constexpr const char* RENDERTHREAD = "renderThread"; std::string devId_; diff --git a/services/audioclient/spkclient/src/dspeaker_client.cpp b/services/audioclient/spkclient/src/dspeaker_client.cpp index 1fecd9af..a0b63064 100644 --- a/services/audioclient/spkclient/src/dspeaker_client.cpp +++ b/services/audioclient/spkclient/src/dspeaker_client.cpp @@ -153,6 +153,8 @@ int32_t DSpeakerClient::StopRender() "daudio renderer is nullptr."); return ERR_DH_AUDIO_CLIENT_RENDER_OR_TRANS_IS_NULL; } + + FlushJitterQueue(); isRenderReady_.store(false); if (renderDataThread_.joinable()) { renderDataThread_.join(); @@ -174,6 +176,8 @@ void DSpeakerClient::PlayThreadRunning() if (pthread_setname_np(pthread_self(), RENDERTHREAD) != DH_SUCCESS) { DHLOGE("Render data thread setname failed."); } + + FillJitterQueue(); while (audioRenderer_ != nullptr && isRenderReady_.load()) { std::shared_ptr audioData = nullptr; { @@ -183,10 +187,11 @@ void DSpeakerClient::PlayThreadRunning() if (dataQueue_.empty()) { continue; } - audioData = dataQueue_.front(); dataQueue_.pop(); + DHLOGD("Pop spk data, dataqueue size: %d.", dataQueue_.size()); } + int32_t writeOffSet = 0; while (writeOffSet < static_cast(audioData->Capacity())) { int32_t writeLen = audioRenderer_->Write(audioData->Data() + writeOffSet, @@ -201,6 +206,32 @@ void DSpeakerClient::PlayThreadRunning() } } +void DSpeakerClient::FillJitterQueue() +{ + while (true) { + { + std::lock_guard lock(dataQueueMtx_); + if (dataQueue_.size() >= DATA_QUEUE_SIZE) { + break; + } + } + usleep(SLEEP_TIME); + } +} + +void DSpeakerClient::FlushJitterQueue() +{ + while (true) { + { + std::lock_guard lock(dataQueueMtx_); + if (dataQueue_.empty()) { + break; + } + } + usleep(SLEEP_TIME); + } +} + int32_t DSpeakerClient::OnDecodeTransDataDone(const std::shared_ptr &audioData) { DHLOGI("Write stream buffer."); @@ -394,6 +425,7 @@ int32_t DSpeakerClient::SetMute(const AudioEvent &event) void DSpeakerClient::Pause() { DHLOGI("Pause and flush"); + FlushJitterQueue(); isRenderReady_.store(false); if (renderDataThread_.joinable()) { renderDataThread_.join(); diff --git a/services/audioclient/test/unittest/micclient/BUILD.gn b/services/audioclient/test/unittest/micclient/BUILD.gn index 78f700d3..d429f8e6 100644 --- a/services/audioclient/test/unittest/micclient/BUILD.gn +++ b/services/audioclient/test/unittest/micclient/BUILD.gn @@ -29,6 +29,7 @@ config("module_private_config") { ] include_dirs += [ + "${audio_client_path}/interface", "${audio_client_path}/micclient/include", "${audio_client_path}/test/unittest/micclient/include", "${audio_client_path}/test/unittest/audioclienttestutils/include", diff --git a/services/audioclient/test/unittest/micclient/src/dmic_client_test.cpp b/services/audioclient/test/unittest/micclient/src/dmic_client_test.cpp index e32369ab..410e4f0a 100644 --- a/services/audioclient/test/unittest/micclient/src/dmic_client_test.cpp +++ b/services/audioclient/test/unittest/micclient/src/dmic_client_test.cpp @@ -87,6 +87,7 @@ HWTEST_F(DMicClientTest, SetUp_001, TestSize.Level1) */ HWTEST_F(DMicClientTest, StartCapture001, TestSize.Level1) { + micClient_->CaptureThreadRunning(); EXPECT_NE(DH_SUCCESS, micClient_->StartCapture()); EXPECT_NE(DH_SUCCESS, micClient_->StopCapture()); } @@ -101,6 +102,8 @@ HWTEST_F(DMicClientTest, StopCapture001, TestSize.Level1) { std::shared_ptr audioData = nullptr; EXPECT_NE(DH_SUCCESS, micClient_->StopCapture()); + micClient_->clientStatus_ = STATUS_START; + EXPECT_NE(DH_SUCCESS, micClient_->StopCapture()); EXPECT_EQ(DH_SUCCESS, micClient_->OnDecodeTransDataDone(audioData)); } } // DistributedHardware diff --git a/services/audioclient/test/unittest/spkclient/BUILD.gn b/services/audioclient/test/unittest/spkclient/BUILD.gn index f54951ea..62ce87cb 100644 --- a/services/audioclient/test/unittest/spkclient/BUILD.gn +++ b/services/audioclient/test/unittest/spkclient/BUILD.gn @@ -33,6 +33,7 @@ config("module_private_config") { ] include_dirs += [ + "${audio_client_path}/interface", "${audio_client_path}/spkclient/include", "${audio_client_path}/test/unittest/spkclient/include", "${audio_client_path}/test/unittest/audioclienttestutils/include", diff --git a/services/audioclient/test/unittest/spkclient/src/dspeaker_client_test.cpp b/services/audioclient/test/unittest/spkclient/src/dspeaker_client_test.cpp index 943e0e29..bc642961 100644 --- a/services/audioclient/test/unittest/spkclient/src/dspeaker_client_test.cpp +++ b/services/audioclient/test/unittest/spkclient/src/dspeaker_client_test.cpp @@ -88,6 +88,9 @@ HWTEST_F(DSpeakerClientTest, StartRender001, TestSize.Level1) { EXPECT_NE(DH_SUCCESS, speakerClient_->StartRender()); EXPECT_NE(DH_SUCCESS, speakerClient_->StopRender()); + + speakerClient_->clientStatus_ = STATUS_START; + EXPECT_EQ(ERR_DH_AUDIO_SA_STATUS_ERR, speakerClient_->StopRender()); } /** @@ -104,7 +107,10 @@ HWTEST_F(DSpeakerClientTest, StopRender001, TestSize.Level1) speakerClient_->PlayStatusChange(args); speakerClient_->SetAudioParameters(event); speakerClient_->SetMute(event); - + for(size_t i =0; i<10; i++) { + std::shared_ptr data = std::make_shared(4096); + speakerClient_->dataQueue_.push(data); + } args = "restart"; speakerClient_->PlayStatusChange(args); @@ -127,12 +133,24 @@ HWTEST_F(DSpeakerClientTest, OnDecodeTransDataDone001, TestSize.Level1) { std::shared_ptr audioData = nullptr; EXPECT_EQ(ERR_DH_AUDIO_CLIENT_PARAM_IS_NULL, speakerClient_->OnDecodeTransDataDone(audioData)); - for (size_t i = 0; i < 6; i++) { + for (size_t i = 0; i < 10; i++) { std::shared_ptr data = std::make_shared(4096); speakerClient_->dataQueue_.push(data); } audioData = std::make_shared(4096); EXPECT_EQ(DH_SUCCESS, speakerClient_->OnDecodeTransDataDone(audioData)); } + +/** + * @tc.name: Release_001 + * @tc.desc: Verify the Release function. + * @tc.type: FUNC + * @tc.require: AR000H0E6G + */ +HWTEST_F(DSpeakerClientTest, Release001, TestSize.Level1) +{ + speakerClient_->Pause(); + EXPECT_EQ(ERR_DH_AUDIO_SA_STATUS_ERR, speakerClient_->Release()); +} } // DistributedHardware } // OHOS diff --git a/services/audiohdiproxy/include/daudio_manager_callback.h b/services/audiohdiproxy/include/daudio_manager_callback.h index 7b7e0dbe..4962b3da 100644 --- a/services/audiohdiproxy/include/daudio_manager_callback.h +++ b/services/audiohdiproxy/include/daudio_manager_callback.h @@ -44,8 +44,8 @@ public: int32_t ReadStreamData(const std::string &adpName, int32_t devId, OHOS::HDI::DistributedAudio::Audioext::V1_0::AudioData &data) override; - int32_t ReadMmapPosition(const std::string &adpName, int32_t devId, - uint64_t &frames, uint64_t &timeStamp) override; + int32_t ReadMmapPosition(const std::string &adpName, int32_t devId, uint64_t &frames, + OHOS::HDI::DistributedAudio::Audioext::V1_0::CurrentTime &time) override; int32_t RefreshAshmemInfo(const std::string &adpName, int32_t devId, int fd, int32_t ashmemLength, int32_t lengthPerTrans) override; diff --git a/services/audiohdiproxy/include/idaudio_hdi_callback.h b/services/audiohdiproxy/include/idaudio_hdi_callback.h index 804702ff..2c7a70f8 100644 --- a/services/audiohdiproxy/include/idaudio_hdi_callback.h +++ b/services/audiohdiproxy/include/idaudio_hdi_callback.h @@ -26,23 +26,17 @@ class IDAudioHdiCallback { public: virtual ~IDAudioHdiCallback() = default; - virtual int32_t OpenDevice(const std::string& devId, const int32_t dhId) = 0; + virtual int32_t OpenDevice(const std::string &devId, const int32_t dhId) = 0; - virtual int32_t CloseDevice(const std::string& devId, const int32_t dhId) = 0; + virtual int32_t CloseDevice(const std::string &devId, const int32_t dhId) = 0; - virtual int32_t SetParameters(const std::string& devId, const int32_t dhId, const AudioParamHDF& param) = 0; + virtual int32_t SetParameters(const std::string &devId, const int32_t dhId, const AudioParamHDF& param) = 0; - virtual int32_t NotifyEvent(const std::string& devId, const int32_t dhId, const AudioEvent& event) = 0; + virtual int32_t NotifyEvent(const std::string &devId, const int32_t dhId, const AudioEvent& event) = 0; - virtual int32_t WriteStreamData(const std::string& devId, const int32_t dhId, std::shared_ptr &data) = 0; + virtual int32_t WriteStreamData(const std::string &devId, const int32_t dhId, std::shared_ptr &data) = 0; - virtual int32_t ReadStreamData(const std::string& devId, const int32_t dhId, std::shared_ptr &data) = 0; - - virtual int32_t ReadMmapPosition(const std::string &devId, const int32_t dhId, - uint64_t &frames, uint64_t &timeStamp) = 0; - - virtual int32_t RefreshAshmemInfo(const std::string &devId, const int32_t dhId, - int32_t fd, int32_t ashmemLength, int32_t lengthPerTrans) = 0; + virtual int32_t ReadStreamData(const std::string &devId, const int32_t dhId, std::shared_ptr &data) = 0; }; } // DistributedHardware } // OHOS diff --git a/services/audiohdiproxy/src/daudio_manager_callback.cpp b/services/audiohdiproxy/src/daudio_manager_callback.cpp index 5764966a..17860e11 100644 --- a/services/audiohdiproxy/src/daudio_manager_callback.cpp +++ b/services/audiohdiproxy/src/daudio_manager_callback.cpp @@ -100,8 +100,8 @@ int32_t DAudioManagerCallback::GetAudioParamHDF(const AudioParameter& param, Aud paramHDF.frameSize = param.frameSize; paramHDF.period = param.period; paramHDF.ext = param.ext; - paramHDF.renderFlags = param.renderFlags; - paramHDF.capturerFlags = param.capturerFlags; + paramHDF.renderFlags = static_cast(param.renderFlags); + paramHDF.capturerFlags = static_cast(param.capturerFlags); DHLOGI("HDF Param: sample rate %d, channel %d, bit format %d, stream usage %d, frame size %zu, " + "period %zu, renderFlags %d, capturerFlags %d, ext {%s}.", paramHDF.sampleRate, paramHDF.channelMask, paramHDF.bitFormat, paramHDF.streamUsage, paramHDF.frameSize, paramHDF.period, paramHDF.renderFlags, @@ -150,18 +150,6 @@ int32_t DAudioManagerCallback::NotifyEvent(const std::string& adpName, int32_t d case AudioEventHDF::AUDIO_EVENT_CHANGE_PLAY_STATUS: newEvent.type = AudioEventType::CHANGE_PLAY_STATUS; break; - case AudioEventHDF::AUDIO_EVENT_MMAP_START: - newEvent.type = AudioEventType::MMAP_START; - break; - case AudioEventHDF::AUDIO_EVENT_MMAP_STOP: - newEvent.type = AudioEventType::MMAP_STOP; - break; - case AudioEventHDF::AUDIO_EVENT_MIC_MMAP_START: - newEvent.type = AudioEventType::MMAP_START_MIC; - break; - case AudioEventHDF::AUDIO_EVENT_MIC_MMAP_STOP: - newEvent.type = AudioEventType::MMAP_STOP_MIC; - break; case AudioEventHDF::AUDIO_EVENT_START: newEvent.type = AudioEventType::AUDIO_START; break; @@ -233,38 +221,23 @@ int32_t DAudioManagerCallback::ReadStreamData(const std::string &adpName, int32_ } int32_t DAudioManagerCallback::ReadMmapPosition(const std::string &adpName, int32_t devId, - uint64_t &frames, uint64_t &timeStamp) + uint64_t &frames, OHOS::HDI::DistributedAudio::Audioext::V1_0::CurrentTime &time) { - DHLOGI("Read mmap position."); - if (callback_ == nullptr) { - DHLOGE("Register hdi callback is nullptr."); - return HDF_FAILURE; - } - - int32_t ret = callback_->ReadMmapPosition(adpName, devId, frames, timeStamp); - if (ret != DH_SUCCESS) { - DHLOGE("Read mmap postion failed."); - return HDF_FAILURE; - } - DHLOGI("Read mmap position success."); + (void) adpName; + (void) devId; + (void) frames; + (void) time; return HDF_SUCCESS; } int32_t DAudioManagerCallback::RefreshAshmemInfo(const std::string &adpName, int32_t devId, int fd, int32_t ashmemLength, int32_t lengthPerTrans) { - DHLOGI("Refresh ashmem info."); - if (callback_ == nullptr) { - DHLOGE("Register hdi callback is nullptr."); - return HDF_FAILURE; - } - - int32_t ret = callback_->RefreshAshmemInfo(adpName, devId, fd, ashmemLength, lengthPerTrans); - if (ret != DH_SUCCESS) { - DHLOGE("RefreshAshmemInfo failed."); - return HDF_FAILURE; - } - DHLOGI("RefreshAshmemInfo success."); + (void) adpName; + (void) devId; + (void) fd; + (void) ashmemLength; + (void) lengthPerTrans; return HDF_SUCCESS; } } // DistributedHardware diff --git a/services/audiohdiproxy/test/unittest/daudio_hdi_handler/include/audio_test_utils.h b/services/audiohdiproxy/test/unittest/daudio_hdi_handler/include/audio_test_utils.h index c804ed9c..333761fc 100644 --- a/services/audiohdiproxy/test/unittest/daudio_hdi_handler/include/audio_test_utils.h +++ b/services/audiohdiproxy/test/unittest/daudio_hdi_handler/include/audio_test_utils.h @@ -84,18 +84,6 @@ public: { return DH_SUCCESS; } - - int32_t ReadMmapPosition(const std::string &devId, const int32_t dhId, - uint64_t &frames, uint64_t &timeStamp) override - { - return DH_SUCCESS; - } - - virtual int32_t RefreshAshmemInfo(const std::string &devId, const int32_t dhId, - int32_t fd, int32_t ashmemLength, int32_t lengthPerTrans) override - { - return DH_SUCCESS; - } }; } // DistributedHardware } // OHOS diff --git a/services/audiohdiproxy/test/unittest/daudio_manager_callback/include/audio_test_utils.h b/services/audiohdiproxy/test/unittest/daudio_manager_callback/include/audio_test_utils.h index 7134ef9b..c772cbb7 100644 --- a/services/audiohdiproxy/test/unittest/daudio_manager_callback/include/audio_test_utils.h +++ b/services/audiohdiproxy/test/unittest/daudio_manager_callback/include/audio_test_utils.h @@ -57,18 +57,6 @@ public: data = std::make_shared(DEFAULT_AUDIO_DATA_SIZE); return DH_SUCCESS; } - - int32_t ReadMmapPosition(const std::string &devId, const int32_t dhId, - uint64_t &frames, uint64_t &timeStamp) override - { - return DH_SUCCESS; - } - - virtual int32_t RefreshAshmemInfo(const std::string &devId, const int32_t dhId, - int32_t fd, int32_t ashmemLength, int32_t lengthPerTrans) override - { - return DH_SUCCESS; - } }; } // DistributedHardware } // OHOS diff --git a/services/audiomanager/managersink/include/daudio_sink_dev.h b/services/audiomanager/managersink/include/daudio_sink_dev.h index b664d817..282f2b37 100644 --- a/services/audiomanager/managersink/include/daudio_sink_dev.h +++ b/services/audiomanager/managersink/include/daudio_sink_dev.h @@ -26,6 +26,8 @@ #include "dmic_client.h" #include "dspeaker_client.h" #include "task_queue.h" +#include "imic_client.h" +#include "ispk_client.h" #include "iaudio_event_callback.h" using json = nlohmann::json; @@ -88,8 +90,8 @@ private: std::string spkDhId_; std::string micDhId_; std::shared_ptr taskQueue_ = nullptr; - std::shared_ptr speakerClient_ = nullptr; - std::shared_ptr micClient_ = nullptr; + std::shared_ptr speakerClient_ = nullptr; + std::shared_ptr micClient_ = nullptr; std::shared_ptr audioCtrlMgr_ = nullptr; using DAudioSinkDevFunc = int32_t (DAudioSinkDev::*)(const AudioEvent &audioEvent); diff --git a/services/audiomanager/managersink/src/daudio_sink_dev.cpp b/services/audiomanager/managersink/src/daudio_sink_dev.cpp index 44e91e57..c549dc86 100644 --- a/services/audiomanager/managersink/src/daudio_sink_dev.cpp +++ b/services/audiomanager/managersink/src/daudio_sink_dev.cpp @@ -388,8 +388,10 @@ int32_t DAudioSinkDev::TaskOpenDSpeaker(const std::string &args) return ret; } - if (audioParam.renderOpts.renderFlags == 1) { - DHLOGI("dsink dev low-latency mode"); + if (speakerClient_ == nullptr) { + if (audioParam.renderOpts.renderFlags == NORMAL_MODE) { + speakerClient_ = std::make_shared(devId_, shared_from_this()); + } } if (speakerClient_ == nullptr) { @@ -456,7 +458,9 @@ int32_t DAudioSinkDev::TaskOpenDMic(const std::string &args) do { if (micClient_ == nullptr) { - micClient_ = std::make_shared(devId_, shared_from_this()); + if (audioParam.captureOpts.capturerFlags == NORMAL_MODE) { + micClient_ = std::make_shared(devId_, shared_from_this()); + } } ret = micClient_->SetUp(audioParam); if (ret != DH_SUCCESS) { @@ -600,10 +604,15 @@ void DAudioSinkDev::OnTaskResult(int32_t resultCode, const std::string &result, void DAudioSinkDev::NotifySourceDev(const AudioEventType type, const std::string dhId, const int32_t result) { + srand(static_cast(time(0))); + const int32_t randomTaskCode = rand(); json jEvent; jEvent[KEY_DH_ID] = dhId; jEvent[KEY_RESULT] = result; jEvent[KEY_EVENT_TYPE] = type; + jEvent[KEY_RANDOM_TASK_CODE] = std::to_string(randomTaskCode); + + DHLOGI("notify source dev, random task code: %d", randomTaskCode); DAudioSinkManager::GetInstance().DAudioNotify(devId_, dhId, type, jEvent.dump()); } diff --git a/services/audiomanager/managersink/src/daudio_sink_manager.cpp b/services/audiomanager/managersink/src/daudio_sink_manager.cpp index 242acd81..1c50d32a 100644 --- a/services/audiomanager/managersink/src/daudio_sink_manager.cpp +++ b/services/audiomanager/managersink/src/daudio_sink_manager.cpp @@ -91,6 +91,17 @@ int32_t DAudioSinkManager::HandleDAudioNotify(const std::string &devId, const st const int32_t eventType, const std::string &eventContent) { DHLOGI("Receive audio event from devId: %s, event type: %d.", GetAnonyString(devId).c_str(), eventType); + + if (eventContent.length() > DAUDIO_MAX_JSON_LEN || eventContent.empty()) { + return ERR_DH_AUDIO_FAILED; + } + + json jParam = json::parse(eventContent, nullptr, false); + if (JsonParamCheck(jParam, { KEY_RANDOM_TASK_CODE }) && CheckIsNum((std::string)jParam[KEY_RANDOM_TASK_CODE])) { + int32_t randomCode = std::stoi((std::string)jParam[KEY_RANDOM_TASK_CODE]); + DHLOGI("Receive audio notify from source, random task code: %d", randomCode); + } + std::lock_guard lock(devMapMutex_); auto iter = audioDevMap_.find(devId); if (iter == audioDevMap_.end() && CreateAudioDevice(devId) != DH_SUCCESS) { diff --git a/services/audiomanager/managersource/include/daudio_source_dev.h b/services/audiomanager/managersource/include/daudio_source_dev.h index 4d3304f3..d4258335 100644 --- a/services/audiomanager/managersource/include/daudio_source_dev.h +++ b/services/audiomanager/managersource/include/daudio_source_dev.h @@ -89,10 +89,6 @@ private: int32_t HandleFocusChange(const AudioEvent &event); int32_t HandleRenderStateChange(const AudioEvent &event); int32_t HandlePlayStatusChange(const AudioEvent &event); - int32_t HandleMmapStart(const AudioEvent &event); - int32_t HandleMmapStop(const AudioEvent &event); - int32_t HandleMicMmapStart(const AudioEvent &event); - int32_t HandleMicMmapStop(const AudioEvent &event); int32_t NotifySinkDev(const AudioEventType type, const json Param, const std::string dhId); int32_t NotifyHDF(const AudioEventType type, const std::string result); @@ -100,7 +96,6 @@ private: int32_t CloseCtrlTrans(const AudioEvent &event, bool isSpk); AudioEventType getEventTypeFromArgs(const std::string &args); void to_json(json &j, const AudioParam ¶m); - bool CheckIsNum(const std::string &jsonString); private: static constexpr uint8_t RPC_WAIT_SECONDS = 2; @@ -111,7 +106,6 @@ private: static constexpr uint8_t EVENT_NOTIFY_CLOSE_MIC = 0x08; static constexpr uint8_t EVENT_NOTIFY_OPEN_CTRL = 0x10; static constexpr uint8_t EVENT_NOTIFY_CLOSE_CTRL = 0x20; - static constexpr uint8_t MAX_KEY_DH_ID_LEN = 10; std::string devId_; std::shared_ptr mgrCallback_; diff --git a/services/audiomanager/managersource/include/dmic_dev.h b/services/audiomanager/managersource/include/dmic_dev.h index 516f1ad2..22c9ee04 100644 --- a/services/audiomanager/managersource/include/dmic_dev.h +++ b/services/audiomanager/managersource/include/dmic_dev.h @@ -18,12 +18,10 @@ #include #include -#include #include "nlohmann/json.hpp" #include "audio_param.h" #include "audio_status.h" -#include "ashmem.h" #include "daudio_hdi_handler.h" #include "iaudio_datatrans_callback.h" #include "iaudio_data_transport.h" @@ -51,12 +49,6 @@ public: int32_t WriteStreamData(const std::string &devId, const int32_t dhId, std::shared_ptr &data) override; int32_t ReadStreamData(const std::string &devId, const int32_t dhId, std::shared_ptr &data) override; int32_t NotifyEvent(const std::string &devId, const int32_t dhId, const AudioEvent &event) override; - int32_t ReadMmapPosition(const std::string &devId, const int32_t dhId, - uint64_t &frames, uint64_t &timeStamp) override; - int32_t RefreshAshmemInfo(const std::string &devId, const int32_t dhId, - int32_t fd, int32_t ashmemLength, int32_t lengthPerTrans) override; - int32_t MmapStart(); - int32_t MmapStop(); int32_t SetUp(); int32_t Start(); @@ -72,21 +64,19 @@ public: private: int32_t EnableDevice(const int32_t dhId, const std::string &capability); int32_t DisableDevice(const int32_t dhId); - void EnqueueThread(); private: static constexpr uint8_t CHANNEL_WAIT_SECONDS = 5; static constexpr size_t DATA_QUEUE_MAX_SIZE = 10; static constexpr size_t DATA_QUEUE_HALF_SIZE = DATA_QUEUE_MAX_SIZE >> 1U; - static constexpr int64_t periodNanoSec_ = 5000000; - static constexpr int32_t CAPTURE_MMAP_FLAG = 1; + static constexpr size_t LOW_LATENCY_DATA_QUEUE_MAX_SIZE = 40; + static constexpr size_t LOW_LATENCY_DATA_QUEUE_HALF_SIZE = LOW_LATENCY_DATA_QUEUE_MAX_SIZE >> 1U; static constexpr const char* ENQUEUE_THREAD = "micEnqueueTh"; std::string devId_; std::weak_ptr audioEventCallback_; std::mutex dataQueueMtx_; std::mutex channelWaitMutex_; - std::mutex writeAshmemtMutex_; std::condition_variable channelWaitCond_; int32_t curPort_ = 0; std::atomic isTransReady_ = false; @@ -99,15 +89,6 @@ private: // Mic capture parameters AudioParamHDF paramHDF_; AudioParam param_; - - // Ashmem - sptr ashmem_ = nullptr; - std::atomic isEnqueueRunning_ = false; - int32_t writeIndex_ = -1; - int32_t ashmemLength_ = -1; - int32_t lengthPerTrans_ = -1; - std::thread enqueueDataThread_; - std::condition_variable dataQueueCond_; }; } // DistributedHardware } // OHOS diff --git a/services/audiomanager/managersource/include/dspeaker_dev.h b/services/audiomanager/managersource/include/dspeaker_dev.h index 75e447cd..d5ced91b 100644 --- a/services/audiomanager/managersource/include/dspeaker_dev.h +++ b/services/audiomanager/managersource/include/dspeaker_dev.h @@ -50,12 +50,6 @@ public: int32_t WriteStreamData(const std::string &devId, const int32_t dhId, std::shared_ptr &data) override; int32_t ReadStreamData(const std::string &devId, const int32_t dhId, std::shared_ptr &data) override; int32_t NotifyEvent(const std::string &devId, const int32_t dhId, const AudioEvent &event) override; - int32_t ReadMmapPosition(const std::string &devId, const int32_t dhId, - uint64_t &frames, uint64_t &timeStamp) override; - int32_t RefreshAshmemInfo(const std::string &devId, const int32_t dhId, - int32_t fd, int32_t ashmemLength, int32_t lengthPerTrans) override; - int32_t MmapStart(); - int32_t MmapStop(); int32_t OnStateChange(const AudioEventType type) override; int32_t OnDecodeTransDataDone(const std::shared_ptr &audioData) override; @@ -74,7 +68,6 @@ public: private: int32_t EnableDevice(const int32_t dhId, const std::string &capability); int32_t DisableDevice(const int32_t dhId); - void EnqueueThread(); private: static constexpr const char* ENQUEUE_THREAD = "spkEnqueueTh"; @@ -92,19 +85,6 @@ private: // Speaker render parameters AudioParamHDF paramHDF_; AudioParam param_; - - // mmap parameters - uint32_t timeInterval_ = 5; - uint32_t readStartDelayms_ = 2000; - int64_t periodNanoSec_ = 5000000; - sptr ashmem_ = nullptr; - int32_t ashmemLength_ = -1; - int32_t lengthPerTrans_ = -1; - std::atomic isEnqueueRunning_ = false; - uint64_t readNum_ = 0; - int32_t readIndex_ = 0; - uint64_t readTimeStamp_ = 0; - std::thread enqueueDataThread_; }; } // DistributedHardware } // OHOS diff --git a/services/audiomanager/managersource/src/daudio_source_dev.cpp b/services/audiomanager/managersource/src/daudio_source_dev.cpp index 319fd498..177ab262 100644 --- a/services/audiomanager/managersource/src/daudio_source_dev.cpp +++ b/services/audiomanager/managersource/src/daudio_source_dev.cpp @@ -52,10 +52,6 @@ DAudioSourceDev::DAudioSourceDev(const std::string &devId, const std::shared_ptr memberFuncMap_[AUDIO_FOCUS_CHANGE] = &DAudioSourceDev::HandleFocusChange; memberFuncMap_[AUDIO_RENDER_STATE_CHANGE] = &DAudioSourceDev::HandleRenderStateChange; memberFuncMap_[CHANGE_PLAY_STATUS] = &DAudioSourceDev::HandlePlayStatusChange; - memberFuncMap_[MMAP_START] = &DAudioSourceDev::HandleMmapStart; - memberFuncMap_[MMAP_STOP] = &DAudioSourceDev::HandleMmapStop; - memberFuncMap_[MMAP_START_MIC] = &DAudioSourceDev::HandleMicMmapStart; - memberFuncMap_[MMAP_STOP_MIC] = &DAudioSourceDev::HandleMicMmapStop; eventNotifyMap_[NOTIFY_OPEN_SPEAKER_RESULT] = EVENT_NOTIFY_OPEN_SPK; eventNotifyMap_[NOTIFY_CLOSE_SPEAKER_RESULT] = EVENT_NOTIFY_CLOSE_SPK; @@ -392,54 +388,6 @@ int32_t DAudioSourceDev::HandlePlayStatusChange(const AudioEvent &event) } } -int32_t DAudioSourceDev::HandleMmapStart(const AudioEvent &event) -{ - DHLOGI("Mmap start, content: %s.", event.content.c_str()); - if (speaker_ == nullptr) { - DHLOGE("Mmap start, speaker is nullptr."); - return ERR_DH_AUDIO_NULLPTR; - } - speaker_->MmapStart(); - return DH_SUCCESS; -} - -int32_t DAudioSourceDev::HandleMmapStop(const AudioEvent &event) -{ - DHLOGI("Mmap stop, content: %s.", event.content.c_str()); - if (speaker_ == nullptr) { - DHLOGE("Mmap stop, speaker is nullptr."); - return ERR_DH_AUDIO_NULLPTR; - } - speaker_->MmapStop(); - return DH_SUCCESS; -} - -int32_t DAudioSourceDev::HandleMicMmapStart(const AudioEvent &event) -{ - DHLOGI("Mmap start, content: %s.", event.content.c_str()); - if (mic_ == nullptr) { - DHLOGE("Mmap start, mic is nullptr."); - return ERR_DH_AUDIO_NULLPTR; - } - if (mic_->MmapStart() != DH_SUCCESS) { - return ERR_DH_AUDIO_FAILED; - } - return DH_SUCCESS; -} - -int32_t DAudioSourceDev::HandleMicMmapStop(const AudioEvent &event) -{ - DHLOGI("Mmap stop, content: %s.", event.content.c_str()); - if (mic_ == nullptr) { - DHLOGE("Mmap stop, mic is nullptr."); - return ERR_DH_AUDIO_NULLPTR; - } - if (mic_->MmapStop() != DH_SUCCESS) { - return ERR_DH_AUDIO_FAILED; - } - return DH_SUCCESS; -} - int32_t DAudioSourceDev::WaitForRPC(const AudioEventType type) { std::unique_lock lck(rpcWaitMutex_); @@ -867,10 +815,14 @@ void DAudioSourceDev::OnTaskResult(int32_t resultCode, const std::string &result int32_t DAudioSourceDev::NotifySinkDev(const AudioEventType type, const json Param, const std::string dhId) { + srand(static_cast(time(0))); + const int32_t randomTaskCode = rand(); constexpr uint32_t eventOffset = 4; json jParam = { { KEY_DH_ID, dhId }, { KEY_EVENT_TYPE, type }, - { KEY_AUDIO_PARAM, Param } }; + { KEY_AUDIO_PARAM, Param }, + { KEY_RANDOM_TASK_CODE, std::to_string(randomTaskCode) } }; + DHLOGI("Notify sin dev, random task code: %d", randomTaskCode); DAudioSourceManager::GetInstance().DAudioNotify(devId_, dhId, type, jParam.dump()); return WaitForRPC(static_cast(static_cast(type) + eventOffset)); } @@ -922,20 +874,5 @@ void DAudioSourceDev::to_json(json &j, const AudioParam ¶m) { KEY_SOURCE_TYPE, param.captureOpts.sourceType }, }; } - -bool DAudioSourceDev::CheckIsNum(const std::string &jsonString) -{ - if (jsonString.empty() || jsonString.size() > MAX_KEY_DH_ID_LEN) { - DHLOGE("Json string size %d, is zero or too long.", jsonString.size()); - return false; - } - for (char const &c : jsonString) { - if (!std::isdigit(c)) { - DHLOGE("Json string is not number."); - return false; - } - } - return true; -} } // namespace DistributedHardware } // namespace OHOS \ No newline at end of file diff --git a/services/audiomanager/managersource/src/daudio_source_manager.cpp b/services/audiomanager/managersource/src/daudio_source_manager.cpp index bd7f3d4d..45b8dc49 100644 --- a/services/audiomanager/managersource/src/daudio_source_manager.cpp +++ b/services/audiomanager/managersource/src/daudio_source_manager.cpp @@ -128,6 +128,15 @@ int32_t DAudioSourceManager::HandleDAudioNotify(const std::string &devId, const { DHLOGI("Handle distributed audio notify, devId: %s, dhId: %s, eventType: %d.", GetAnonyString(devId).c_str(), dhId.c_str(), eventType); + if (eventContent.length() > DAUDIO_MAX_JSON_LEN || eventContent.empty()) { + return ERR_DH_AUDIO_FAILED; + } + + json jParam = json::parse(eventContent, nullptr, false); + if (JsonParamCheck(jParam, { KEY_RANDOM_TASK_CODE }) && CheckIsNum((std::string)jParam[KEY_RANDOM_TASK_CODE])) { + int32_t randomCode = std::stoi((std::string)jParam[KEY_RANDOM_TASK_CODE]); + DHLOGI("Handle distributed audio notify from sink, random task code: %d", randomCode); + } std::lock_guard lock(devMapMtx_); auto dev = audioDevMap_.find(devId); if (dev == audioDevMap_.end()) { diff --git a/services/audiomanager/managersource/src/dmic_dev.cpp b/services/audiomanager/managersource/src/dmic_dev.cpp index 20d06880..93f46ba0 100644 --- a/services/audiomanager/managersource/src/dmic_dev.cpp +++ b/services/audiomanager/managersource/src/dmic_dev.cpp @@ -161,77 +161,21 @@ int32_t DMicDev::NotifyEvent(const std::string &devId, const int32_t dhId, const DHLOGE("Event callback is null"); return ERR_DH_AUDIO_SA_EVENT_CALLBACK_NULL; } - if (event.type == AudioEventType::AUDIO_START) { - curStatus_ = AudioStatus::STATUS_START; - return DH_SUCCESS; - } - if (event.type == AudioEventType::AUDIO_STOP) { - curStatus_ = AudioStatus::STATUS_STOP; - return DH_SUCCESS; + switch (event.type) { + case AudioEventType::AUDIO_START: + curStatus_ = AudioStatus::STATUS_START; + break; + case AudioEventType::AUDIO_STOP: + curStatus_ = AudioStatus::STATUS_STOP; + break; + default: + break; } AudioEvent audioEvent(event.type, event.content); cbObj->NotifyEvent(audioEvent); return DH_SUCCESS; } -int32_t DMicDev::MmapStart() -{ - if (ashmem_ == nullptr || micTrans_ == nullptr) { - DHLOGE("Ashmem or trans is null."); - return ERR_DH_AUDIO_NULLPTR; - } - std::lock_guard lock(writeAshmemtMutex_); - isEnqueueRunning_.store(true); - enqueueDataThread_ = std::thread(&DMicDev::EnqueueThread, this); - if (pthread_setname_np(enqueueDataThread_.native_handle(), ENQUEUE_THREAD) != DH_SUCCESS) { - DHLOGE("Enqueue data thread setname failed."); - } - return DH_SUCCESS; -} - -void DMicDev::EnqueueThread() -{ - writeIndex_ = 0; - DHLOGI("lengthPerRead length: %d", lengthPerTrans_); - int64_t startTime = GetCurNano(); - uint64_t writeCount = 0; - while (isEnqueueRunning_.load()) { - std::shared_ptr audioData = nullptr; - { - std::lock_guard lock(dataQueueMtx_); - if (dataQueue_.empty()) { - DHLOGI("Data queue is empty."); - audioData = std::make_shared(param_.comParam.frameSize); - } else { - audioData = dataQueue_.front(); - dataQueue_.pop(); - } - } - bool writeRet = ashmem_->WriteToAshmem(audioData->Data(), audioData->Size(), writeIndex_); - if (writeRet) { - DHLOGI("Write to ashmem success! write index: %d, writeLength: %d", writeIndex_, lengthPerTrans_); - } else { - DHLOGE("Write daTa to ashmem failed."); - } - writeIndex_ += lengthPerTrans_; - if (writeIndex_ >= ashmemLength_) { - writeIndex_ = 0; - } - writeCount++; - AbsoluteSleep(startTime + writeCount * periodNanoSec_); - } -} - -int32_t DMicDev::MmapStop() -{ - std::lock_guard lock(writeAshmemtMutex_); - isEnqueueRunning_.store(false); - if (enqueueDataThread_.joinable()) { - enqueueDataThread_.join(); - } - return DH_SUCCESS; -} - int32_t DMicDev::SetUp() { DHLOGI("Set up mic device."); @@ -290,12 +234,6 @@ int32_t DMicDev::Stop() int32_t DMicDev::Release() { DHLOGI("Release mic device."); - if (ashmem_ != nullptr) { - ashmem_->UnmapAshmem(); - ashmem_->CloseAshmem(); - ashmem_ = nullptr; - DHLOGI("UnInitAshmem success."); - } if (micTrans_ == nullptr) { DHLOGE("Mic trans is null."); return DH_SUCCESS; @@ -339,40 +277,6 @@ int32_t DMicDev::ReadStreamData(const std::string &devId, const int32_t dhId, st return DH_SUCCESS; } -int32_t DMicDev::ReadMmapPosition(const std::string &devId, const int32_t dhId, uint64_t &frames, uint64_t &timeStamp) -{ - DHLOGI("Read mmap position."); - (void)devId; - (void)dhId; - (void)frames; - (void)timeStamp; - return DH_SUCCESS; -} - -int32_t DMicDev::RefreshAshmemInfo(const std::string &devId, const int32_t dhId, - int32_t fd, int32_t ashmemLength, int32_t lengthPerTrans) -{ - DHLOGI("RefreshAshmemInfo: fd: %d, ashmemLength: %d, lengthPerTrans: %d", fd, ashmemLength, lengthPerTrans); - if (param_.captureOpts.capturerFlags == CAPTURE_MMAP_FLAG) { - DHLOGI("Dmic dev low-latency mode"); - if (ashmem_ != nullptr) { - return DH_SUCCESS; - } - ashmem_ = new Ashmem(fd, ashmemLength); - ashmemLength_ = ashmemLength; - lengthPerTrans_ = lengthPerTrans; - DHLOGI("Create ashmem success. fd: %d, ashmem length: %d, lengthPerTrans: %d", - fd, ashmemLength_, lengthPerTrans_); - bool mapRet = ashmem_->MapReadAndWriteAshmem(); - if (!mapRet) { - DHLOGE("Mmap ashmem failed"); - return ERR_DH_AUDIO_NULLPTR; - } - } - return DH_SUCCESS; -} - - AudioParam DMicDev::GetAudioParam() const { return param_; @@ -421,7 +325,8 @@ int32_t DMicDev::OnDecodeTransDataDone(const std::shared_ptr &audioDa } std::lock_guard lock(dataQueueMtx_); size_t dataQueSize = curStatus_ != AudioStatus::STATUS_START ? - DATA_QUEUE_HALF_SIZE : DATA_QUEUE_MAX_SIZE; + (param_.captureOpts.capturerFlags == MMAP_MODE ? LOW_LATENCY_DATA_QUEUE_HALF_SIZE : DATA_QUEUE_HALF_SIZE) : + (param_.captureOpts.capturerFlags == MMAP_MODE ? LOW_LATENCY_DATA_QUEUE_MAX_SIZE : DATA_QUEUE_MAX_SIZE); while (dataQueue_.size() > dataQueSize) { DHLOGI("Data queue overflow. buf current size: %d", dataQueue_.size()); dataQueue_.pop(); diff --git a/services/audiomanager/managersource/src/dspeaker_dev.cpp b/services/audiomanager/managersource/src/dspeaker_dev.cpp index 849bbdf4..db9eb5dc 100644 --- a/services/audiomanager/managersource/src/dspeaker_dev.cpp +++ b/services/audiomanager/managersource/src/dspeaker_dev.cpp @@ -168,68 +168,6 @@ int32_t DSpeakerDev::NotifyEvent(const std::string &devId, int32_t dhId, const A return DH_SUCCESS; } -int32_t DSpeakerDev::MmapStart() -{ - if (ashmem_ == nullptr || speakerTrans_ == nullptr) { - DHLOGE("Ashmem or trans is null."); - return ERR_DH_AUDIO_NULLPTR; - } - isEnqueueRunning_.store(true); - enqueueDataThread_ = std::thread(&DSpeakerDev::EnqueueThread, this); - if (pthread_setname_np(enqueueDataThread_.native_handle(), ENQUEUE_THREAD) != DH_SUCCESS) { - DHLOGE("Enqueue data thread setname failed."); - } - return DH_SUCCESS; -} - -void DSpeakerDev::EnqueueThread() -{ - readIndex_ = 0; - readNum_ = 0; - DHLOGI("lengthPerRead length: %d", lengthPerTrans_); - std::this_thread::sleep_for(std::chrono::microseconds(readStartDelayms_)); - int64_t startTime = GetCurNano(); - uint64_t readCount = 0; - while (isEnqueueRunning_.load()) { - auto readData = ashmem_->ReadFromAshmem(lengthPerTrans_, readIndex_); - DHLOGI("Read from ashmem success! read index: %d, readLength: %d", readIndex_, lengthPerTrans_); - std::shared_ptr audioData = std::make_shared(lengthPerTrans_); - if (readData != nullptr) { - const uint8_t *readAudioData = reinterpret_cast(readData); - int32_t ret = memcpy_s(audioData->Data(), audioData->Capacity(), readAudioData, param_.comParam.frameSize); - if (ret != EOK) { - DHLOGE("Copy audio data failed. errno: %d", ret); - } - } - - if (speakerTrans_ == nullptr) { - DHLOGE("Write stream data, speaker trans is null."); - return; - } - int32_t ret = speakerTrans_->FeedAudioData(audioData); - if (ret != DH_SUCCESS) { - DHLOGE("Write stream data failed, ret: %d.", ret); - } - readIndex_ += lengthPerTrans_; - if (readIndex_ >= ashmemLength_) { - readIndex_ = 0; - } - readNum_ += static_cast(CalculateSampleNum(param_.comParam.sampleRate, timeInterval_)); - readTimeStamp_ = 0; - readCount++; - AbsoluteSleep(startTime + readCount * periodNanoSec_); - } -} - -int32_t DSpeakerDev::MmapStop() -{ - isEnqueueRunning_.store(false); - if (enqueueDataThread_.joinable()) { - enqueueDataThread_.join(); - } - return DH_SUCCESS; -} - int32_t DSpeakerDev::SetUp() { DHLOGI("Set up speaker device."); @@ -291,12 +229,6 @@ int32_t DSpeakerDev::Stop() int32_t DSpeakerDev::Release() { DHLOGI("Release speaker device."); - if (ashmem_ != nullptr) { - ashmem_->UnmapAshmem(); - ashmem_->CloseAshmem(); - ashmem_ = nullptr; - DHLOGI("UnInitAshmem success."); - } if (speakerTrans_ == nullptr) { DHLOGE("Speaker trans is null."); return DH_SUCCESS; @@ -353,6 +285,7 @@ int32_t DSpeakerDev::ReadStreamData(const std::string &devId, const int32_t dhId (void)devId; (void)dhId; (void)data; + DHLOGI("Dspeaker dev not support read stream data."); return DH_SUCCESS; } @@ -371,37 +304,6 @@ int32_t DSpeakerDev::WriteStreamData(const std::string &devId, const int32_t dhI return DH_SUCCESS; } -int32_t DSpeakerDev::ReadMmapPosition(const std::string &devId, const int32_t dhId, - uint64_t &frames, uint64_t &timeStamp) -{ - DHLOGI("Read mmap position"); - frames = readNum_; - timeStamp = readTimeStamp_; - return DH_SUCCESS; -} - -int32_t DSpeakerDev::RefreshAshmemInfo(const std::string &devId, const int32_t dhId, - int32_t fd, int32_t ashmemLength, int32_t lengthPerTrans) -{ - DHLOGI("RefreshAshmemInfo: fd: %d, ashmemLength: %d, lengthPerTrans: %d", fd, ashmemLength, lengthPerTrans); - if (param_.renderOpts.renderFlags == 1) { - DHLOGI("Dspeaker dev low-latency mode"); - if (ashmem_ == nullptr) { - ashmem_ = new Ashmem(fd, ashmemLength); - ashmemLength_ = ashmemLength; - lengthPerTrans_ = lengthPerTrans; - DHLOGI("Create ashmem success. fd: %d, ashmem length: %d, lengthPerTrans: %d", - fd, ashmemLength_, lengthPerTrans_); - bool mapRet = ashmem_->MapReadAndWriteAshmem(); - if (!mapRet) { - DHLOGE("Mmap ashmem failed"); - return ERR_DH_AUDIO_NULLPTR; - } - } - } - return DH_SUCCESS; -} - AudioParam DSpeakerDev::GetAudioParam() const { return param_; diff --git a/services/audiomanager/servicesink/BUILD.gn b/services/audiomanager/servicesink/BUILD.gn index ace4763d..2e70adf5 100755 --- a/services/audiomanager/servicesink/BUILD.gn +++ b/services/audiomanager/servicesink/BUILD.gn @@ -40,6 +40,7 @@ ohos_shared_library("distributed_audio_sink") { "${audio_client_path}/micclient/include", "${audio_client_path}/spkclient/include", "${audio_control_path}/controlsink/include", + "${audio_client_path}/interface", "${audio_processor_path}/encodeprocessor/include", "${audio_processor_path}/decodeprocessor/include", "${audio_processor_path}/interface", @@ -64,6 +65,7 @@ ohos_shared_library("distributed_audio_sink") { "${services_path}/common/audiodata/include", "${services_path}/audiomanager/managersink/include", "${softbusadapter_path}/include", + "//drivers/hdf_core/framework/include/osal", ] sources = [ @@ -89,6 +91,9 @@ ohos_shared_library("distributed_audio_sink") { external_deps = [ "c_utils:utils", + "drivers_interface_audio:libaudio_proxy_1.0", + "hdf_core:libhdf_ipc_adapter", + "hdf_core:libhdi", "hitrace_native:hitrace_meter", "ipc:ipc_core", "safwk:system_ability_fwk", diff --git a/services/audiomanager/servicesink/src/daudio_sink_stub.cpp b/services/audiomanager/servicesink/src/daudio_sink_stub.cpp index dcaa60be..de02c128 100644 --- a/services/audiomanager/servicesink/src/daudio_sink_stub.cpp +++ b/services/audiomanager/servicesink/src/daudio_sink_stub.cpp @@ -52,7 +52,7 @@ int32_t DAudioSinkStub::OnRemoteRequest(uint32_t code, MessageParcel &data, Mess const auto &iter = memberFuncMap_.find(code); if (iter == memberFuncMap_.end()) { DHLOGE("Invalid request code."); - return ERR_DH_AUDIO_SA_INVALID_REQUEST_CODE; + return IPCObjectStub::OnRemoteRequest(code, data, reply, option); } DAudioSinkServiceFunc &func = iter->second; return (this->*func)(data, reply, option); diff --git a/services/audiomanager/servicesource/src/daudio_source_stub.cpp b/services/audiomanager/servicesource/src/daudio_source_stub.cpp index 1f1fdacf..ed68f4f9 100644 --- a/services/audiomanager/servicesource/src/daudio_source_stub.cpp +++ b/services/audiomanager/servicesource/src/daudio_source_stub.cpp @@ -48,7 +48,7 @@ int32_t DAudioSourceStub::OnRemoteRequest(uint32_t code, MessageParcel &data, Me const auto &iter = memberFuncMap_.find(code); if (iter == memberFuncMap_.end()) { DHLOGE("Invalid request code."); - return ERR_DH_AUDIO_SA_INVALID_REQUEST_CODE; + return IPCObjectStub::OnRemoteRequest(code, data, reply, option); } DAudioSourceServiceFunc &func = iter->second; return (this->*func)(data, reply, option); diff --git a/services/audiomanager/test/unittest/managersink/BUILD.gn b/services/audiomanager/test/unittest/managersink/BUILD.gn index 334a0dcd..9457215f 100644 --- a/services/audiomanager/test/unittest/managersink/BUILD.gn +++ b/services/audiomanager/test/unittest/managersink/BUILD.gn @@ -36,6 +36,7 @@ config("module_private_config") { include_dirs += [ "${audio_client_path}/micclient/include", "${audio_client_path}/spkclient/include", + "${audio_client_path}/interface", "${audio_control_path}/controlsink/include", "${audio_processor_path}/decodeprocessor/include", "${audio_processor_path}/encodeprocessor/include", @@ -77,6 +78,21 @@ ohos_unittest("DaudioSinkDevTest") { "//third_party/googletest:gtest_main", "${services_path}/audiomanager/servicesink:distributed_audio_sink", ] + + external_deps = [ + "c_utils:utils", + "drivers_interface_audio:libaudio_proxy_1.0", + "hdf_core:libhdf_ipc_adapter", + "hdf_core:libhdi", + "hitrace_native:hitrace_meter", + "hdf_core:libhdf_utils", + "ipc:ipc_core", + "safwk:system_ability_fwk", + "samgr:samgr_proxy", + "multimedia_audio_framework:audio_client", + "multimedia_audio_framework:audio_capturer", + "multimedia_audio_framework:audio_renderer", + ] } ## UnitTest daudio_sink_manager_test @@ -94,6 +110,21 @@ ohos_unittest("DAudioSinkManagerTest") { "//third_party/googletest:gtest_main", "${services_path}/audiomanager/servicesink:distributed_audio_sink", ] + + external_deps = [ + "c_utils:utils", + "drivers_interface_audio:libaudio_proxy_1.0", + "hdf_core:libhdf_ipc_adapter", + "hdf_core:libhdi", + "hitrace_native:hitrace_meter", + "hdf_core:libhdf_utils", + "ipc:ipc_core", + "safwk:system_ability_fwk", + "samgr:samgr_proxy", + "multimedia_audio_framework:audio_client", + "multimedia_audio_framework:audio_capturer", + "multimedia_audio_framework:audio_renderer", + ] } group("manager_sink_test") { diff --git a/services/audiomanager/test/unittest/managersink/src/daudio_sink_dev_test.cpp b/services/audiomanager/test/unittest/managersink/src/daudio_sink_dev_test.cpp index 035d5965..3c449e13 100644 --- a/services/audiomanager/test/unittest/managersink/src/daudio_sink_dev_test.cpp +++ b/services/audiomanager/test/unittest/managersink/src/daudio_sink_dev_test.cpp @@ -38,6 +38,36 @@ void DAudioSinkDevTest::TearDown() sinkDev_ = nullptr; } +/** + * @tc.name: NotifyOpenCtrlChannel_001 + * @tc.desc: Verify the NotifyOpenCtrlChannel function. + * @tc.type: FUNC + * @tc.require: AR000H0E5F + */ +HWTEST_F(DAudioSinkDevTest, NotifyOpenCtrlChannel_001, TestSize.Level1) +{ + constexpr size_t capacity = 20; + sinkDev_->taskQueue_ = std::make_shared(capacity); + AudioEvent event; + EXPECT_EQ(DH_SUCCESS, sinkDev_->NotifyOpenCtrlChannel(event)); + sinkDev_->NotifyEvent(event); +} + +/** + * @tc.name: NotifyCloseCtrlChannel_001 + * @tc.desc: Verify the NotifyCloseCtrlChannel function. + * @tc.type: FUNC + * @tc.require: AR000H0E5F + */ +HWTEST_F(DAudioSinkDevTest, NotifyCloseCtrlChannel_001, TestSize.Level1) +{ + constexpr size_t capacity = 20; + sinkDev_->taskQueue_ = std::make_shared(capacity); + AudioEvent event; + EXPECT_EQ(DH_SUCCESS, sinkDev_->NotifyCloseCtrlChannel(event)); + sinkDev_->NotifyEvent(event); +} + /** * @tc.name: NotifyCtrlOpened_001 * @tc.desc: Verify the NotifyCtrlOpened function. @@ -51,6 +81,32 @@ HWTEST_F(DAudioSinkDevTest, NotifyCtrlOpened_001, TestSize.Level1) sinkDev_->NotifyEvent(event); } +/** + * @tc.name: NotifyCtrlClosed_001 + * @tc.desc: Verify the NotifyCtrlClosed function. + * @tc.type: FUNC + * @tc.require: AR000H0E5F + */ +HWTEST_F(DAudioSinkDevTest, NotifyCtrlClosed_001, TestSize.Level1) +{ + AudioEvent event; + EXPECT_EQ(ERR_DH_AUDIO_NULLPTR, sinkDev_->NotifyCtrlClosed(event)); +} + +/** + * @tc.name: NotifyCtrlClosed_002 + * @tc.desc: Verify the NotifyCtrlClosed function. + * @tc.type: FUNC + * @tc.require: AR000H0E5F + */ +HWTEST_F(DAudioSinkDevTest, NotifyCtrlClosed_002, TestSize.Level1) +{ + AudioEvent event; + uint32_t maxSize = 10; + sinkDev_->taskQueue_ = std::make_shared(maxSize); + EXPECT_EQ(DH_SUCCESS, sinkDev_->NotifyCtrlClosed(event)); +} + /** * @tc.name: NotifySpeakerOpened_001 * @tc.desc: Verify the NotifySpeakerOpened function. @@ -63,6 +119,58 @@ HWTEST_F(DAudioSinkDevTest, NotifySpeakerOpened_001, TestSize.Level1) EXPECT_NE(DH_SUCCESS, sinkDev_->NotifySpeakerOpened(event)); } +/** + * @tc.name: NotifyOpenSpeaker_001 + * @tc.desc: Verify the NotifyOpenSpeaker function. + * @tc.type: FUNC + * @tc.require: AR000H0E5F + */ +HWTEST_F(DAudioSinkDevTest, NotifyOpenSpeaker_001, TestSize.Level1) +{ + AudioEvent event; + EXPECT_EQ(ERR_DH_AUDIO_NULLPTR, sinkDev_->NotifyOpenSpeaker(event)); +} + +/** + * @tc.name: NotifyOpenSpeaker_002 + * @tc.desc: Verify the NotifyOpenSpeaker function. + * @tc.type: FUNC + * @tc.require: AR000H0E5F + */ +HWTEST_F(DAudioSinkDevTest, NotifyOpenSpeaker_002, TestSize.Level1) +{ + AudioEvent event; + uint32_t maxSize = 10; + sinkDev_->taskQueue_ = std::make_shared(maxSize); + EXPECT_EQ(DH_SUCCESS, sinkDev_->NotifyOpenSpeaker(event)); +} + +/** + * @tc.name: NotifyCloseSpeaker_001 + * @tc.desc: Verify the NotifyCloseSpeaker function. + * @tc.type: FUNC + * @tc.require: AR000H0E5F + */ +HWTEST_F(DAudioSinkDevTest, NotifyCloseSpeaker_001, TestSize.Level1) +{ + AudioEvent event; + EXPECT_EQ(ERR_DH_AUDIO_NULLPTR, sinkDev_->NotifyCloseSpeaker(event)); +} + +/** + * @tc.name: NotifyCloseSpeaker_002 + * @tc.desc: Verify the NotifyCloseSpeaker function. + * @tc.type: FUNC + * @tc.require: AR000H0E5F + */ +HWTEST_F(DAudioSinkDevTest, NotifyCloseSpeaker_002, TestSize.Level1) +{ + AudioEvent event; + uint32_t maxSize = 10; + sinkDev_->taskQueue_ = std::make_shared(maxSize); + EXPECT_EQ(DH_SUCCESS, sinkDev_->NotifyCloseSpeaker(event)); +} + /** * @tc.name: NotifySpeakerOpened_002 * @tc.desc: Verify the NotifySpeakerOpened function. @@ -77,6 +185,48 @@ HWTEST_F(DAudioSinkDevTest, NotifySpeakerOpened_002, TestSize.Level1) EXPECT_NE(DH_SUCCESS, sinkDev_->NotifySpeakerOpened(event)); } +/** + * @tc.name: NotifySpeakerOpened_003 + * @tc.desc: Verify the NotifySpeakerOpened function. + * @tc.type: FUNC + * @tc.require: AR000H0E5F + */ +HWTEST_F(DAudioSinkDevTest, NotifySpeakerOpened_003, TestSize.Level1) +{ + constexpr size_t capacity = 20; + sinkDev_->taskQueue_ = std::make_shared(capacity); + AudioEvent event; + std::string devId = "devid"; + sinkDev_->speakerClient_ = std::make_shared(devId, sinkDev_); + EXPECT_NE(DH_SUCCESS, sinkDev_->NotifySpeakerOpened(event)); +} + +/** + * @tc.name: NotifySpeakerClosed_001 + * @tc.desc: Verify the NotifySpeakerClosed function. + * @tc.type: FUNC + * @tc.require: AR000H0E5F + */ +HWTEST_F(DAudioSinkDevTest, NotifySpeakerClosed_001, TestSize.Level1) +{ + AudioEvent event; + EXPECT_EQ(ERR_DH_AUDIO_NULLPTR, sinkDev_->NotifySpeakerClosed(event)); +} + +/** + * @tc.name: NotifySpeakerClosed_002 + * @tc.desc: Verify the NotifySpeakerClosed function. + * @tc.type: FUNC + * @tc.require: AR000H0E5F + */ +HWTEST_F(DAudioSinkDevTest, NotifySpeakerClosed_002, TestSize.Level1) +{ + AudioEvent event; + uint32_t maxSize = 10; + sinkDev_->taskQueue_ = std::make_shared(maxSize); + EXPECT_EQ(DH_SUCCESS, sinkDev_->NotifySpeakerClosed(event)); +} + /** * @tc.name: NotifyMicOpened_001 * @tc.desc: Verify the NotifyMicOpened function. @@ -89,6 +239,240 @@ HWTEST_F(DAudioSinkDevTest, NotifyMicOpened_001, TestSize.Level1) EXPECT_EQ(DH_SUCCESS, sinkDev_->NotifyMicOpened(event)); } +/** + * @tc.name: NotifyMicClosed_001 + * @tc.desc: Verify the NotifyMicClosed function. + * @tc.type: FUNC + * @tc.require: AR000H0E5F + */ +HWTEST_F(DAudioSinkDevTest, NotifyMicClosed_001, TestSize.Level1) +{ + AudioEvent event; + EXPECT_EQ(ERR_DH_AUDIO_NULLPTR, sinkDev_->NotifyMicClosed(event)); +} + +/** + * @tc.name: NotifyMicClosed_002 + * @tc.desc: Verify the NotifyMicClosed function. + * @tc.type: FUNC + * @tc.require: AR000H0E5F + */ +HWTEST_F(DAudioSinkDevTest, NotifyMicClosed_002, TestSize.Level1) +{ + constexpr size_t capacity = 20; + sinkDev_->taskQueue_ = std::make_shared(capacity); + AudioEvent event; + EXPECT_NE(ERR_DH_AUDIO_NULLPTR, sinkDev_->NotifyMicClosed(event)); +} + +/** + * @tc.name: NotifyOpenMic_001 + * @tc.desc: Verify the NotifyOpenMic function. + * @tc.type: FUNC + * @tc.require: AR000H0E5F + */ +HWTEST_F(DAudioSinkDevTest, NotifyOpenMic_001, TestSize.Level1) +{ + AudioEvent event; + EXPECT_EQ(ERR_DH_AUDIO_NULLPTR, sinkDev_->NotifyOpenMic(event)); +} + +/** + * @tc.name: NotifyOpenMic_002 + * @tc.desc: Verify the NotifyOpenMic function. + * @tc.type: FUNC + * @tc.require: AR000H0E5F + */ +HWTEST_F(DAudioSinkDevTest, NotifyOpenMic_002, TestSize.Level1) +{ + constexpr size_t capacity = 20; + sinkDev_->taskQueue_ = std::make_shared(capacity); + AudioEvent event; + EXPECT_NE(ERR_DH_AUDIO_NULLPTR, sinkDev_->NotifyOpenMic(event)); +} + +/** + * @tc.name: NotifyCloseMic_001 + * @tc.desc: Verify the NotifyCloseMic function. + * @tc.type: FUNC + * @tc.require: AR000H0E5F + */ +HWTEST_F(DAudioSinkDevTest, NotifyCloseMic_001, TestSize.Level1) +{ + AudioEvent event; + EXPECT_EQ(ERR_DH_AUDIO_NULLPTR, sinkDev_->NotifyCloseMic(event)); +} + +/** + * @tc.name: NotifyCloseMic_002 + * @tc.desc: Verify the NotifyCloseMic function. + * @tc.type: FUNC + * @tc.require: AR000H0E5F + */ +HWTEST_F(DAudioSinkDevTest, NotifyCloseMic_002, TestSize.Level1) +{ + constexpr size_t capacity = 20; + sinkDev_->taskQueue_ = std::make_shared(capacity); + AudioEvent event; + EXPECT_NE(ERR_DH_AUDIO_NULLPTR, sinkDev_->NotifyCloseMic(event)); +} + +/** + * @tc.name: NotifySetParam_001 + * @tc.desc: Verify the NotifySetParam function. + * @tc.type: FUNC + * @tc.require: AR000H0E5F + */ +HWTEST_F(DAudioSinkDevTest, NotifySetParam_001, TestSize.Level1) +{ + AudioEvent event; + EXPECT_EQ(ERR_DH_AUDIO_NULLPTR, sinkDev_->NotifySetParam(event)); +} + +/** + * @tc.name: NotifySetParam_002 + * @tc.desc: Verify the NotifySetParam function. + * @tc.type: FUNC + * @tc.require: AR000H0E5F + */ +HWTEST_F(DAudioSinkDevTest, NotifySetParam_002, TestSize.Level1) +{ + constexpr size_t capacity = 20; + sinkDev_->taskQueue_ = std::make_shared(capacity); + AudioEvent event; + EXPECT_NE(ERR_DH_AUDIO_NULLPTR, sinkDev_->NotifySetParam(event)); +} + +/** + * @tc.name: NotifySetVolume_001 + * @tc.desc: Verify the NotifySetVolume function. + * @tc.type: FUNC + * @tc.require: AR000H0E5F + */ +HWTEST_F(DAudioSinkDevTest, NotifySetVolume_001, TestSize.Level1) +{ + AudioEvent event; + EXPECT_EQ(ERR_DH_AUDIO_NULLPTR, sinkDev_->NotifySetVolume(event)); +} + +/** + * @tc.name: NotifySetVolume_002 + * @tc.desc: Verify the NotifySetVolume function. + * @tc.type: FUNC + * @tc.require: AR000H0E5F + */ +HWTEST_F(DAudioSinkDevTest, NotifySetVolume_002, TestSize.Level1) +{ + constexpr size_t capacity = 20; + sinkDev_->taskQueue_ = std::make_shared(capacity); + AudioEvent event; + EXPECT_NE(ERR_DH_AUDIO_NULLPTR, sinkDev_->NotifySetVolume(event)); +} + +/** + * @tc.name: NotifySetMute_001 + * @tc.desc: Verify the NotifySetMute function. + * @tc.type: FUNC + * @tc.require: AR000H0E5F + */ +HWTEST_F(DAudioSinkDevTest, NotifySetMute_001, TestSize.Level1) +{ + AudioEvent event; + EXPECT_EQ(ERR_DH_AUDIO_NULLPTR, sinkDev_->NotifySetMute(event)); +} + +/** + * @tc.name: NotifySetMute_002 + * @tc.desc: Verify the NotifySetMute function. + * @tc.type: FUNC + * @tc.require: AR000H0E5F + */ +HWTEST_F(DAudioSinkDevTest, NotifySetMute_002, TestSize.Level1) +{ + constexpr size_t capacity = 20; + sinkDev_->taskQueue_ = std::make_shared(capacity); + AudioEvent event; + EXPECT_NE(ERR_DH_AUDIO_NULLPTR, sinkDev_->NotifySetMute(event)); +} + +/** + * @tc.name: NotifyVolumeChange_001 + * @tc.desc: Verify the NotifyVolumeChange function. + * @tc.type: FUNC + * @tc.require: AR000H0E5F + */ +HWTEST_F(DAudioSinkDevTest, NotifyVolumeChange_001, TestSize.Level1) +{ + AudioEvent event; + EXPECT_EQ(ERR_DH_AUDIO_NULLPTR, sinkDev_->NotifyVolumeChange(event)); +} + +/** + * @tc.name: NotifyVolumeChange_002 + * @tc.desc: Verify the NotifyVolumeChange function. + * @tc.type: FUNC + * @tc.require: AR000H0E5F + */ +HWTEST_F(DAudioSinkDevTest, NotifyVolumeChange_002, TestSize.Level1) +{ + constexpr size_t capacity = 20; + sinkDev_->taskQueue_ = std::make_shared(capacity); + AudioEvent event; + EXPECT_NE(ERR_DH_AUDIO_NULLPTR, sinkDev_->NotifyVolumeChange(event)); +} + +/** + * @tc.name: NotifyFocusChange_001 + * @tc.desc: Verify the NotifyFocusChange function. + * @tc.type: FUNC + * @tc.require: AR000H0E5F + */ +HWTEST_F(DAudioSinkDevTest, NotifyFocusChange_001, TestSize.Level1) +{ + AudioEvent event; + EXPECT_EQ(ERR_DH_AUDIO_NULLPTR, sinkDev_->NotifyFocusChange(event)); +} + +/** + * @tc.name: NotifyFocusChange_002 + * @tc.desc: Verify the NotifyFocusChange function. + * @tc.type: FUNC + * @tc.require: AR000H0E5F + */ +HWTEST_F(DAudioSinkDevTest, NotifyFocusChange_002, TestSize.Level1) +{ + constexpr size_t capacity = 20; + sinkDev_->taskQueue_ = std::make_shared(capacity); + AudioEvent event; + EXPECT_NE(ERR_DH_AUDIO_NULLPTR, sinkDev_->NotifyFocusChange(event)); +} + +/** + * @tc.name: NotifyRenderStateChange_001 + * @tc.desc: Verify the NotifyRenderStateChange function. + * @tc.type: FUNC + * @tc.require: AR000H0E5F + */ +HWTEST_F(DAudioSinkDevTest, NotifyRenderStateChange_001, TestSize.Level1) +{ + AudioEvent event; + EXPECT_EQ(ERR_DH_AUDIO_NULLPTR, sinkDev_->NotifyRenderStateChange(event)); +} + +/** + * @tc.name: NotifyRenderStateChange_002 + * @tc.desc: Verify the NotifyRenderStateChange function. + * @tc.type: FUNC + * @tc.require: AR000H0E5F + */ +HWTEST_F(DAudioSinkDevTest, NotifyRenderStateChange_002, TestSize.Level1) +{ + constexpr size_t capacity = 20; + sinkDev_->taskQueue_ = std::make_shared(capacity); + AudioEvent event; + EXPECT_NE(ERR_DH_AUDIO_NULLPTR, sinkDev_->NotifyRenderStateChange(event)); +} + /** * @tc.name: NotifyPlayStatusChange_001 * @tc.desc: Verify the NotifyPlayStatusChange function. diff --git a/services/audiomanager/test/unittest/managersink/src/daudio_sink_manager_test.cpp b/services/audiomanager/test/unittest/managersink/src/daudio_sink_manager_test.cpp index 7aaca6f4..313eff39 100644 --- a/services/audiomanager/test/unittest/managersink/src/daudio_sink_manager_test.cpp +++ b/services/audiomanager/test/unittest/managersink/src/daudio_sink_manager_test.cpp @@ -53,6 +53,23 @@ HWTEST_F(DAudioSinkManagerTest, CreateAudioDevice_001, TestSize.Level1) std::string devId = "devId"; EXPECT_EQ(DH_SUCCESS, daudioSinkManager.CreateAudioDevice(devId)); daudioSinkManager.ClearAudioDev(devId); + daudioSinkManager.OnSinkDevReleased(devId); +} + +/** + * @tc.name: DAudioNotify_001 + * @tc.desc: Verify the DAudioNotify function. + * @tc.type: FUNC + * @tc.require: AR000H0E5F + */ +HWTEST_F(DAudioSinkManagerTest, DAudioNotify_001, TestSize.Level1) +{ + std::string devId = "devId"; + std::string dhId = "dhId"; + const int32_t eventType = 1; + const std::string eventContent = "eventContent"; + EXPECT_EQ(ERR_DH_AUDIO_SA_GET_REMOTE_SINK_FAILED, + daudioSinkManager.DAudioNotify(devId, dhId, eventType, eventContent)); } } // DistributedHardware } // OHOS diff --git a/services/audiomanager/test/unittest/servicesource/src/daudio_source_service_test.cpp b/services/audiomanager/test/unittest/servicesource/src/daudio_source_service_test.cpp index 8576c3b5..4b7acc22 100644 --- a/services/audiomanager/test/unittest/servicesource/src/daudio_source_service_test.cpp +++ b/services/audiomanager/test/unittest/servicesource/src/daudio_source_service_test.cpp @@ -93,5 +93,18 @@ HWTEST_F(DAudioSourceServiceTest, ConfigDistributedHardware_001, TestSize.Level1 EXPECT_EQ(ERR_DH_AUDIO_SA_FUNCTION_NOT_IMPLEMENT, sourceSrv_->ConfigDistributedHardware(devId, dhId, key, value)); } + +/** + * @tc.name: Dump_001 + * @tc.desc: Verify the Dump function. + * @tc.type: FUNC + * @tc.require: AR000H0E5F + */ +HWTEST_F(DAudioSourceServiceTest, Dump_001, TestSize.Level1) +{ + int32_t fd = 0; + const std::vector args; + EXPECT_EQ(DH_SUCCESS, sourceSrv_->Dump(fd, args)); +} } // DistributedHardware } // OHOS diff --git a/services/audiomanager/test/unittest/source_device/src/daudio_source_dev_test.cpp b/services/audiomanager/test/unittest/source_device/src/daudio_source_dev_test.cpp index 24c082ec..4031b69e 100644 --- a/services/audiomanager/test/unittest/source_device/src/daudio_source_dev_test.cpp +++ b/services/audiomanager/test/unittest/source_device/src/daudio_source_dev_test.cpp @@ -172,6 +172,18 @@ HWTEST_F(DAudioSourceDevTest, HandlePlayStatusChange_001, TestSize.Level1) EXPECT_EQ(ERR_DH_AUDIO_FAILED, sourceDev_->HandlePlayStatusChange(event)); } +/** + * @tc.name: WaitForRPC_001 + * @tc.desc: Verify the WaitForRPC function. + * @tc.type: FUNC + * @tc.require: AR000H0E5F + */ +HWTEST_F(DAudioSourceDevTest, WaitForRPC_001, TestSize.Level1) +{ + AudioEventType type = NOTIFY_OPEN_SPEAKER_RESULT; + EXPECT_EQ(ERR_DH_AUDIO_SA_RPC_WAIT_TIMEOUT, sourceDev_->WaitForRPC(type)); +} + /** * @tc.name: HandleDMicClosed_001 * @tc.desc: Verify the HandleDMicClosed function. @@ -198,6 +210,55 @@ HWTEST_F(DAudioSourceDevTest, HandleDMicClosed_002, TestSize.Level1) EXPECT_EQ(DH_SUCCESS, sourceDev_->HandleDMicClosed(event)); } +/** + * @tc.name: OpenCtrlTrans_001 + * @tc.desc: Verify the OpenCtrlTrans function. + * @tc.type: FUNC + * @tc.require: AR000H0E5F + */ +HWTEST_F(DAudioSourceDevTest, OpenCtrlTrans_001, TestSize.Level1) +{ + AudioEvent event; + EXPECT_EQ(ERR_DH_AUDIO_SA_OPEN_CTRL_FAILED, sourceDev_->OpenCtrlTrans(event)); +} + +/** + * @tc.name: CloseCtrlTrans_001 + * @tc.desc: Verify the CloseCtrlTrans function. + * @tc.type: FUNC + * @tc.require: AR000H0E5F + */ +HWTEST_F(DAudioSourceDevTest, CloseCtrlTrans_001, TestSize.Level1) +{ + AudioEvent event; + bool isSpk = false; + EXPECT_EQ(DH_SUCCESS, sourceDev_->CloseCtrlTrans(event, isSpk)); +} + +/** + * @tc.name: HandleOpenCtrlTrans_001 + * @tc.desc: Verify the HandleOpenCtrlTrans function. + * @tc.type: FUNC + * @tc.require: AR000H0E5F + */ +HWTEST_F(DAudioSourceDevTest, HandleOpenCtrlTrans_001, TestSize.Level1) +{ + AudioEvent event; + EXPECT_EQ(ERR_DH_AUDIO_NULLPTR, sourceDev_->HandleOpenCtrlTrans(event)); +} + +/** + * @tc.name: HandleCloseCtrlTrans_001 + * @tc.desc: Verify the HandleCloseCtrlTrans function. + * @tc.type: FUNC + * @tc.require: AR000H0E5F + */ +HWTEST_F(DAudioSourceDevTest, HandleCloseCtrlTrans_001, TestSize.Level1) +{ + AudioEvent event; + EXPECT_EQ(ERR_DH_AUDIO_NULLPTR, sourceDev_->HandleCloseCtrlTrans(event)); +} + /** * @tc.name: HandleNotifyRPC_001 * @tc.desc: Verify the HandleNotifyRPC function. @@ -636,19 +697,5 @@ HWTEST_F(DAudioSourceDevTest, NotifySinkDev_001, TestSize.Level1) json jAudioParam; EXPECT_EQ(ERR_DH_AUDIO_SA_RPC_WAIT_TIMEOUT, sourceDev_->NotifySinkDev(CLOSE_MIC, jAudioParam, DH_ID_SPK)); } - -/** - * @tc.name: CheckIsNum_001 - * @tc.desc: Verify the CheckIsNum function. - * @tc.type: FUNC - * @tc.require: AR000H0E5F - */ -HWTEST_F(DAudioSourceDevTest, CheckIsNum_001, TestSize.Level1) -{ - json jAudioParam; - EXPECT_FALSE(sourceDev_->CheckIsNum("")); - EXPECT_FALSE(sourceDev_->CheckIsNum("a5q")); - EXPECT_TRUE(sourceDev_->CheckIsNum("11")); -} } // namespace DistributedHardware } // namespace OHOS diff --git a/services/audiomanager/test/unittest/source_device/src/dmic_dev_test.cpp b/services/audiomanager/test/unittest/source_device/src/dmic_dev_test.cpp index dbf5e4a5..f441e1d3 100644 --- a/services/audiomanager/test/unittest/source_device/src/dmic_dev_test.cpp +++ b/services/audiomanager/test/unittest/source_device/src/dmic_dev_test.cpp @@ -261,6 +261,7 @@ HWTEST_F(DMicDevTest, Release_001, TestSize.Level1) */ HWTEST_F(DMicDevTest, ReadStreamData_001, TestSize.Level1) { + mic_->curStatus_ = AudioStatus::STATUS_START; const size_t capacity = 1; auto writeData = std::make_shared(capacity); EXPECT_EQ(DH_SUCCESS, mic_->WriteStreamData(DEV_ID, DH_ID, writeData)); diff --git a/services/audiomanager/test/unittest/sourcemanager/src/daudio_source_mgr_test.cpp b/services/audiomanager/test/unittest/sourcemanager/src/daudio_source_mgr_test.cpp index cce5d18e..297a9238 100644 --- a/services/audiomanager/test/unittest/sourcemanager/src/daudio_source_mgr_test.cpp +++ b/services/audiomanager/test/unittest/sourcemanager/src/daudio_source_mgr_test.cpp @@ -119,7 +119,7 @@ HWTEST_F(DAudioSourceMgrTest, EnableDAudio_003, TestSize.Level1) std::string reqId1 = GetRandomID(); DAudioSourceManager::AudioDevice device = { DEV_ID, nullptr }; sourceMgr.audioDevMap_[DEV_ID] = device; - EXPECT_EQ(ERR_DH_AUDIO_NULLPTR, sourceMgr.DisableDAudio(DEV_ID, DH_ID, reqId1)); + EXPECT_EQ(DH_SUCCESS, sourceMgr.DisableDAudio(DEV_ID, DH_ID, reqId1)); EXPECT_EQ(DH_SUCCESS, sourceMgr.UnInit()); } @@ -153,7 +153,7 @@ HWTEST_F(DAudioSourceMgrTest, HandleDAudioNotify_001, TestSize.Level1) EXPECT_EQ(DH_SUCCESS, sourceMgr.HandleDAudioNotify(DEV_ID, DH_ID, OPEN_SPEAKER, "openspk")); EXPECT_EQ(DH_SUCCESS, sourceMgr.DisableDAudio(DEV_ID, DH_ID, reqId)); - EXPECT_EQ(ERR_DH_AUDIO_SA_DEVICE_NOT_EXIST, sourceMgr.HandleDAudioNotify(DEV_ID + "1", DH_ID, CLOSE_CTRL, "")); + EXPECT_EQ(ERR_DH_AUDIO_FAILED, sourceMgr.HandleDAudioNotify(DEV_ID + "1", DH_ID, CLOSE_CTRL, "")); EXPECT_EQ(DH_SUCCESS, sourceMgr.UnInit()); } diff --git a/services/audioprocessor/test/unittest/common/decodeprocessor/decoder_test.cpp b/services/audioprocessor/test/unittest/common/decodeprocessor/decoder_test.cpp index db6f5ab3..36741443 100644 --- a/services/audioprocessor/test/unittest/common/decodeprocessor/decoder_test.cpp +++ b/services/audioprocessor/test/unittest/common/decodeprocessor/decoder_test.cpp @@ -75,6 +75,7 @@ HWTEST_F(DecoderTest, decode_test_001, TestSize.Level1) { EXPECT_EQ(DH_SUCCESS, audiodecoder_->ConfigureAudioCodec(LOC_COMPARA_ENC_TEST, decodeCb_)); audiodecoder_ = std::make_shared(); + EXPECT_EQ(ERR_DH_AUDIO_BAD_VALUE, audiodecoder_->ConfigureAudioCodec(LOC_COMPARA_ENC_TEST, nullptr)); } /** @@ -211,5 +212,30 @@ HWTEST_F(DecoderTest, ProcessData_001, TestSize.Level1) EXPECT_EQ(ERR_DH_AUDIO_BAD_VALUE, audiodecoder_->ProcessData(inputData, bufferIndex)); audiodecoder_->OnOutputBufferAvailable(index, info, flag); } + +/** + * @tc.name: IsInDecodeRange_001 + * @tc.desc: Verify IsInDecodeRange function. + * @tc.type: FUNC + * @tc.require: AR000H0E5U + */ +HWTEST_F(DecoderTest, IsInDecodeRange_001, TestSize.Level1) +{ + AudioCommonParam codecParam; + EXPECT_EQ(false, audiodecoder_->IsInDecodeRange(codecParam)); +} + +/** + * @tc.name: IsInDecodeRange_002 + * @tc.desc: Verify IsInDecodeRange function. + * @tc.type: FUNC + * @tc.require: AR000H0E5U + */ +HWTEST_F(DecoderTest, IsInDecodeRange_002, TestSize.Level1) +{ + AudioCommonParam codecParam; + codecParam.bitFormat = SAMPLE_S16LE; + EXPECT_EQ(true, audiodecoder_->IsInDecodeRange(codecParam)); +} } // namespace DistributedHardware } // namespace OHOS diff --git a/services/audioprocessor/test/unittest/common/encodeprocessor/encoder_test.cpp b/services/audioprocessor/test/unittest/common/encodeprocessor/encoder_test.cpp index 3e0d81dc..8e08c02f 100644 --- a/services/audioprocessor/test/unittest/common/encodeprocessor/encoder_test.cpp +++ b/services/audioprocessor/test/unittest/common/encodeprocessor/encoder_test.cpp @@ -75,6 +75,7 @@ HWTEST_F(EncoderTest, encode_test_001, TestSize.Level1) { EXPECT_EQ(DH_SUCCESS, audioEncoder_->ConfigureAudioCodec(LOC_COMPARA_ENC_TEST, encodeCb_)); audioEncoder_ = std::make_shared(); + EXPECT_EQ(ERR_DH_AUDIO_BAD_VALUE, audioEncoder_->ConfigureAudioCodec(LOC_COMPARA_ENC_TEST, nullptr)); } /** diff --git a/services/audiotransport/decodetransport/BUILD.gn b/services/audiotransport/decodetransport/BUILD.gn index 14703c9e..fc26df0c 100644 --- a/services/audiotransport/decodetransport/BUILD.gn +++ b/services/audiotransport/decodetransport/BUILD.gn @@ -33,7 +33,6 @@ ohos_shared_library("distributed_audio_decode_transport") { "${common_path}/dfx_utils/include", "${audio_processor_path}/decoder/include", "${audio_processor_path}/decodeprocessor/include", - "${audio_processor_path}/lowlatencyprocessor/include", "${audio_processor_path}/interface", "${audio_transport_path}/audiochannel/interface", "${audio_transport_path}/audiochannel/audiodatachannel/include", @@ -50,7 +49,6 @@ ohos_shared_library("distributed_audio_decode_transport") { "${audio_processor_path}/decoder/src/audio_decoder.cpp", "${audio_processor_path}/decoder/src/audio_decoder_callback.cpp", "${audio_processor_path}/decodeprocessor/src/audio_decoder_processor.cpp", - "${audio_processor_path}/lowlatencyprocessor/src/audio_lowlatency_processor.cpp", "${services_path}/common/audiodata/src/audio_data.cpp", ] diff --git a/services/audiotransport/decodetransport/include/audio_decode_transport.h b/services/audiotransport/decodetransport/include/audio_decode_transport.h index f7435754..1ff3e779 100644 --- a/services/audiotransport/decodetransport/include/audio_decode_transport.h +++ b/services/audiotransport/decodetransport/include/audio_decode_transport.h @@ -70,7 +70,6 @@ private: private: static constexpr size_t DATA_QUEUE_MAX_SIZE = 10; static constexpr size_t SLEEP_TIME = 20000; - static constexpr int32_t MMAP_FLAG = 1; std::weak_ptr dataTransCallback_; std::shared_ptr audioChannel_ = nullptr; diff --git a/services/audiotransport/decodetransport/src/audio_decode_transport.cpp b/services/audiotransport/decodetransport/src/audio_decode_transport.cpp index 22519b5c..43a153ec 100644 --- a/services/audiotransport/decodetransport/src/audio_decode_transport.cpp +++ b/services/audiotransport/decodetransport/src/audio_decode_transport.cpp @@ -17,7 +17,6 @@ #include "audio_data_channel.h" #include "audio_decoder_processor.h" -#include "audio_lowlatency_processor.h" #include "audio_param.h" #include "daudio_errorcode.h" #include "daudio_log.h" @@ -238,11 +237,9 @@ int32_t AudioDecodeTransport::RegisterChannelListener(const PortCapType capType) int32_t AudioDecodeTransport::RegisterProcessorListener(const AudioParam &localParam, const AudioParam &remoteParam) { DHLOGI("Register processor listener."); - if (localParam.renderOpts.renderFlags == MMAP_FLAG || localParam.captureOpts.capturerFlags == MMAP_FLAG) { - DHLOGE("Decode trans low-latency mode. renderFlags: %d, captureFlags: %d", + if (localParam.renderOpts.renderFlags == NORMAL_MODE || localParam.captureOpts.capturerFlags == NORMAL_MODE) { + DHLOGE("Decode trans normal mode. renderFlags: %d, captureFlags: %d", localParam.renderOpts.renderFlags, localParam.captureOpts.capturerFlags); - processor_ = std::make_shared(); - } else { processor_ = std::make_shared(); } int32_t ret = processor_->ConfigureAudioProcessor(localParam.comParam, remoteParam.comParam, shared_from_this()); diff --git a/services/audiotransport/encodetransport/BUILD.gn b/services/audiotransport/encodetransport/BUILD.gn index ad927484..c3d399cb 100644 --- a/services/audiotransport/encodetransport/BUILD.gn +++ b/services/audiotransport/encodetransport/BUILD.gn @@ -32,7 +32,6 @@ ohos_shared_library("distributed_audio_encode_transport") { "${common_path}/include", "${common_path}/dfx_utils/include", "${audio_processor_path}/encodeprocessor/include", - "${audio_processor_path}/lowlatencyprocessor/include", "${audio_processor_path}/encoder/include", "${audio_processor_path}/interface", "${audio_transport_path}/audiochannel/interface", @@ -48,7 +47,6 @@ ohos_shared_library("distributed_audio_encode_transport") { sources = [ "src/audio_encode_transport.cpp", "${audio_processor_path}/encodeprocessor/src/audio_encoder_processor.cpp", - "${audio_processor_path}/lowlatencyprocessor/src/audio_lowlatency_processor.cpp", "${audio_processor_path}/encoder/src/audio_encoder.cpp", "${audio_processor_path}/encoder/src/audio_encoder_callback.cpp", "${services_path}/common/audiodata/src/audio_data.cpp", diff --git a/services/audiotransport/encodetransport/include/audio_encode_transport.h b/services/audiotransport/encodetransport/include/audio_encode_transport.h index 0c393048..7616081c 100644 --- a/services/audiotransport/encodetransport/include/audio_encode_transport.h +++ b/services/audiotransport/encodetransport/include/audio_encode_transport.h @@ -64,7 +64,6 @@ private: private: static const constexpr uint8_t SESSION_WAIT_SECONDS = 5; - static constexpr int32_t MMAP_FLAG = 1; std::weak_ptr dataTransCallback_; std::shared_ptr audioChannel_ = nullptr; diff --git a/services/audiotransport/encodetransport/src/audio_encode_transport.cpp b/services/audiotransport/encodetransport/src/audio_encode_transport.cpp index c84c11c1..468b0134 100644 --- a/services/audiotransport/encodetransport/src/audio_encode_transport.cpp +++ b/services/audiotransport/encodetransport/src/audio_encode_transport.cpp @@ -17,7 +17,6 @@ #include "audio_data_channel.h" #include "audio_encoder_processor.h" -#include "audio_lowlatency_processor.h" #include "audio_param.h" #include "daudio_errorcode.h" #include "daudio_log.h" @@ -188,11 +187,9 @@ int32_t AudioEncodeTransport::RegisterChannelListener(const PortCapType capType) int32_t AudioEncodeTransport::RegisterProcessorListener(const AudioParam &localParam, const AudioParam &remoteParam) { DHLOGI("Register processor listener."); - if (localParam.renderOpts.renderFlags == MMAP_FLAG || localParam.captureOpts.capturerFlags == MMAP_FLAG) { - DHLOGE("Encode trans low-latency mode. renderFlags: %d, captureFlags: %d", + if (localParam.renderOpts.renderFlags == NORMAL_MODE || localParam.captureOpts.capturerFlags == NORMAL_MODE) { + DHLOGE("Encode trans normal mode. renderFlags: %d, captureFlags: %d", localParam.renderOpts.renderFlags, localParam.captureOpts.capturerFlags); - processor_ = std::make_shared(); - } else { processor_ = std::make_shared(); } if (audioChannel_ == nullptr) { diff --git a/services/audiotransport/test/unittest/audioctrlchannel/src/audio_ctrl_channel_test.cpp b/services/audiotransport/test/unittest/audioctrlchannel/src/audio_ctrl_channel_test.cpp index b36c3330..a80a315c 100644 --- a/services/audiotransport/test/unittest/audioctrlchannel/src/audio_ctrl_channel_test.cpp +++ b/services/audiotransport/test/unittest/audioctrlchannel/src/audio_ctrl_channel_test.cpp @@ -133,12 +133,12 @@ HWTEST_F(AudioCtrlChannelTest, OnSessionClosed_001, TestSize.Level1) } /** - * @tc.name: OnBytesReceived_001 - * @tc.desc: Verify the OnBytesReceived function. + * @tc.name: SendMsg_001 + * @tc.desc: Verify the SendMsg function. * @tc.type: FUNC * @tc.require: AR000H0E5U */ -HWTEST_F(AudioCtrlChannelTest, OnBytesReceived_001, TestSize.Level1) +HWTEST_F(AudioCtrlChannelTest, SendMsg_001, TestSize.Level1) { std::shared_ptr listener = std::make_shared(); ctrlChannel_->channelListener_ = listener; @@ -155,6 +155,9 @@ HWTEST_F(AudioCtrlChannelTest, OnBytesReceived_001, TestSize.Level1) StreamData *ext; StreamFrameInfo *streamFrameInfo; ctrlChannel_->OnStreamReceived(sessionId, datas, ext, streamFrameInfo); + + string message = "sendMag"; + EXPECT_NE(ERR_DH_AUDIO_CTRL_CHANNEL_SEND_MSG_FAIL, ctrlChannel_->SendMsg(message)); } } // namespace DistributedHardware } // namespace OHOS diff --git a/services/audiotransport/test/unittest/audioctrltransport/src/audio_ctrl_transport_test.cpp b/services/audiotransport/test/unittest/audioctrltransport/src/audio_ctrl_transport_test.cpp index 85f85bbc..db02da25 100644 --- a/services/audiotransport/test/unittest/audioctrltransport/src/audio_ctrl_transport_test.cpp +++ b/services/audiotransport/test/unittest/audioctrltransport/src/audio_ctrl_transport_test.cpp @@ -88,6 +88,7 @@ HWTEST_F(AudioCtrlTransportTest, Release_002, TestSize.Level1) */ HWTEST_F(AudioCtrlTransportTest, Start_001, TestSize.Level1) { + trans->OnSessionOpened(); EXPECT_EQ(ERR_DH_AUDIO_TRANS_NULL_VALUE, trans->Start()); } @@ -112,6 +113,9 @@ HWTEST_F(AudioCtrlTransportTest, Start_002, TestSize.Level1) */ HWTEST_F(AudioCtrlTransportTest, Stop_001, TestSize.Level1) { + AudioEvent event; + trans->OnEventReceived(event); + trans->OnSessionClosed(); EXPECT_EQ(DH_SUCCESS, trans->Stop()); } @@ -179,5 +183,19 @@ HWTEST_F(AudioCtrlTransportTest, RegisterChannelListener_002, TestSize.Level1) std::shared_ptr listener = std::make_shared(); EXPECT_EQ(DH_SUCCESS, trans->RegisterChannelListener()); } + +/** + * @tc.name: InitAudioCtrlTrans_002 + * @tc.desc: Verify the InitAudioCtrlTrans function. + * @tc.type: FUNC + * @tc.require: AR000H0E5U + */ +HWTEST_F(AudioCtrlTransportTest, InitAudioCtrlTrans_002, TestSize.Level1) +{ + std::string peerDevId = "peerDevId"; + const std::string netWorkId = "netWorkId"; + trans->audioChannel_ = std::make_shared(peerDevId); + EXPECT_EQ(DH_SUCCESS, trans->InitAudioCtrlTrans(netWorkId)); +} } // namespace DistributedHardware } // namespace OHOS diff --git a/services/audiotransport/test/unittest/audiodatachannel/src/audio_data_channel_test.cpp b/services/audiotransport/test/unittest/audiodatachannel/src/audio_data_channel_test.cpp index 28c8f393..ee04f28d 100644 --- a/services/audiotransport/test/unittest/audiodatachannel/src/audio_data_channel_test.cpp +++ b/services/audiotransport/test/unittest/audiodatachannel/src/audio_data_channel_test.cpp @@ -81,6 +81,7 @@ HWTEST_F(AudioDataChannelTest, OpenSession_002, TestSize.Level1) dataChannel_->OnStreamReceived(sessionIdTmp, &data, ext, param); delete[] data.buf; + EXPECT_NE(DH_SUCCESS, dataChannel_->CreateSession(channelListener, DATA_SPEAKER_SESSION_NAME)); EXPECT_EQ(ERR_DH_AUDIO_TRANS_ERROR, dataChannel_->OpenSession()); EXPECT_EQ(DH_SUCCESS, dataChannel_->CloseSession()); } diff --git a/services/audiotransport/test/unittest/audiotransportstatus/src/audio_transport_pause_status_test.cpp b/services/audiotransport/test/unittest/audiotransportstatus/src/audio_transport_pause_status_test.cpp index d573af02..f4671539 100644 --- a/services/audiotransport/test/unittest/audiotransportstatus/src/audio_transport_pause_status_test.cpp +++ b/services/audiotransport/test/unittest/audiotransportstatus/src/audio_transport_pause_status_test.cpp @@ -60,6 +60,7 @@ HWTEST_F(AudioTransportPauseStatusTest, transport_pause_test_001, TestSize.Level std::shared_ptr audioChannel_ = std::make_shared(peerDevId); std::shared_ptr processor_ = std::make_shared(); EXPECT_EQ(ERR_DH_AUDIO_TRANS_ILLEGAL_OPERATION, audioStatus_->Start(audioChannel_, processor_)); + EXPECT_EQ(ERR_DH_AUDIO_NULLPTR, audioStatus_->Stop(nullptr, processor_)); } /** @@ -107,12 +108,12 @@ HWTEST_F(AudioTransportPauseStatusTest, transport_pause_test_004, TestSize.Level }, { SOURCE_TYPE_INVALID, - 0 + NORMAL_MODE, }, { CONTENT_TYPE_UNKNOWN, STREAM_USAGE_UNKNOWN, - 0 + NORMAL_MODE, } }; AudioParam testRemoteParaEnc = { @@ -124,18 +125,31 @@ HWTEST_F(AudioTransportPauseStatusTest, transport_pause_test_004, TestSize.Level }, { SOURCE_TYPE_INVALID, - 0 + NORMAL_MODE, }, { CONTENT_TYPE_UNKNOWN, STREAM_USAGE_UNKNOWN, - 0 + NORMAL_MODE, } }; std::string peerDevId = "peerDevId"; + EXPECT_EQ(ERR_DH_AUDIO_NULLPTR, audioStatus_->Restart(testLocalParaEnc, testRemoteParaEnc, nullptr)); + std::shared_ptr audioChannel_ = std::make_shared(peerDevId); std::shared_ptr processor_ = std::make_shared(); EXPECT_EQ(ERR_DH_AUDIO_NULLPTR, audioStatus_->Restart(testLocalParaEnc, testRemoteParaEnc, processor_)); } + +/** + * @tc.name: transport_getstatetype_test_001 + * @tc.desc: Verify pause action when status is start. + * @tc.type: FUNC + * @tc.require: AR000H0E5U + */ +HWTEST_F(AudioTransportPauseStatusTest, transport_getstatetype_test_001, TestSize.Level1) +{ + EXPECT_EQ(TRANSPORT_STATE_PAUSE, audioStatus_->GetStateType()); +} } // namespace DistributedHardware } // namespace OHOS diff --git a/services/audiotransport/test/unittest/audiotransportstatus/src/audio_transport_start_status_test.cpp b/services/audiotransport/test/unittest/audiotransportstatus/src/audio_transport_start_status_test.cpp index aa534aee..2b096dbd 100644 --- a/services/audiotransport/test/unittest/audiotransportstatus/src/audio_transport_start_status_test.cpp +++ b/services/audiotransport/test/unittest/audiotransportstatus/src/audio_transport_start_status_test.cpp @@ -64,34 +64,58 @@ HWTEST_F(AudioTransportStartStatusTest, transport_start_test_001, TestSize.Level } /** - * @tc.name: transport_start_test_002 + * @tc.name: transport_Stop_test_001 + * @tc.desc: Verify stop action when status is stop. + * @tc.type: FUNC + * @tc.require: AR000H0E5U + */ +HWTEST_F(AudioTransportStartStatusTest, transport_Stop_test_001, TestSize.Level1) +{ + EXPECT_EQ(ERR_DH_AUDIO_NULLPTR, audioStatus_->Stop(audioChannel_, processor_)); +} + +/** + * @tc.name: transport_stop_test_002 * @tc.desc: Verify stop action when status is start. * @tc.type: FUNC * @tc.require: AR000H0E5U */ -HWTEST_F(AudioTransportStartStatusTest, transport_start_test_002, TestSize.Level1) +HWTEST_F(AudioTransportStartStatusTest, transport_stop_test_002, TestSize.Level1) { + std::shared_ptr processor_ = std::make_shared(); EXPECT_EQ(ERR_DH_AUDIO_NULLPTR, audioStatus_->Stop(audioChannel_, processor_)); } /** - * @tc.name: transport_start_test_003 + * @tc.name: transport_Pause_test_001 * @tc.desc: Verify pause action when status is start. * @tc.type: FUNC * @tc.require: AR000H0E5U */ -HWTEST_F(AudioTransportStartStatusTest, transport_start_test_003, TestSize.Level1) +HWTEST_F(AudioTransportStartStatusTest, transport_pause_test_001, TestSize.Level1) { EXPECT_EQ(ERR_DH_AUDIO_NULLPTR, audioStatus_->Pause(processor_)); } /** - * @tc.name: transport_start_test_004 + * @tc.name: transport_Pause_test_002 + * @tc.desc: Verify pause action when status is start. + * @tc.type: FUNC + * @tc.require: AR000H0E5U + */ +HWTEST_F(AudioTransportStartStatusTest, transport_Pause_test_002, TestSize.Level1) +{ + processor_ = std::make_shared(); + EXPECT_EQ(ERR_DH_AUDIO_BAD_VALUE, audioStatus_->Pause(processor_)); +} + +/** + * @tc.name: transport_Restart_test_001 * @tc.desc: Verify action when status is start. * @tc.type: FUNC * @tc.require: AR000H0E5U */ -HWTEST_F(AudioTransportStartStatusTest, transport_start_test_004, TestSize.Level1) +HWTEST_F(AudioTransportStartStatusTest, transport_restart_test_001, TestSize.Level1) { AudioParam testLocalParaEnc = { { @@ -102,12 +126,12 @@ HWTEST_F(AudioTransportStartStatusTest, transport_start_test_004, TestSize.Level }, { SOURCE_TYPE_INVALID, - 0 + NORMAL_MODE }, { CONTENT_TYPE_UNKNOWN, STREAM_USAGE_UNKNOWN, - 0 + NORMAL_MODE } }; AudioParam testRemoteParaEnc = { @@ -119,15 +143,26 @@ HWTEST_F(AudioTransportStartStatusTest, transport_start_test_004, TestSize.Level }, { SOURCE_TYPE_INVALID, - 0 + NORMAL_MODE }, { CONTENT_TYPE_UNKNOWN, STREAM_USAGE_UNKNOWN, - 0 + NORMAL_MODE } }; EXPECT_EQ(DH_SUCCESS, audioStatus_->Restart(testLocalParaEnc, testRemoteParaEnc, processor_)); } + +/** + * @tc.name: transport_getstatetype_test_001 + * @tc.desc: Verify pause action when status is start. + * @tc.type: FUNC + * @tc.require: AR000H0E5U + */ +HWTEST_F(AudioTransportStartStatusTest, transport_getstatetype_test_001, TestSize.Level1) +{ + EXPECT_EQ(TRANSPORT_STATE_START, audioStatus_->GetStateType()); +} } // namespace DistributedHardware } // namespace OHOS diff --git a/services/audiotransport/test/unittest/audiotransportstatus/src/audio_transport_stop_status_test.cpp b/services/audiotransport/test/unittest/audiotransportstatus/src/audio_transport_stop_status_test.cpp index b28ae741..36e28788 100644 --- a/services/audiotransport/test/unittest/audiotransportstatus/src/audio_transport_stop_status_test.cpp +++ b/services/audiotransport/test/unittest/audiotransportstatus/src/audio_transport_stop_status_test.cpp @@ -60,7 +60,11 @@ void AudioTransportStopStatusTest::TearDown(void) */ HWTEST_F(AudioTransportStopStatusTest, transport_stop_test_001, TestSize.Level1) { - EXPECT_EQ(ERR_DH_AUDIO_NULLPTR, audioStatus_->Start(audioChannel_, processor_)); + std::string peerDevId = "peerDevId"; + std::shared_ptr audioChannel_ = std::make_shared(peerDevId); + std::shared_ptr processor_ = std::make_shared(); + EXPECT_EQ(ERR_DH_AUDIO_BAD_VALUE, audioStatus_->Start(audioChannel_, processor_)); + EXPECT_EQ(DH_SUCCESS, audioStatus_->Stop(audioChannel_, processor_)); } /** @@ -71,6 +75,7 @@ HWTEST_F(AudioTransportStopStatusTest, transport_stop_test_001, TestSize.Level1) */ HWTEST_F(AudioTransportStopStatusTest, transport_stop_test_002, TestSize.Level1) { + EXPECT_EQ(ERR_DH_AUDIO_NULLPTR, audioStatus_->Start(audioChannel_, nullptr)); EXPECT_EQ(DH_SUCCESS, audioStatus_->Stop(audioChannel_, processor_)); } @@ -102,12 +107,12 @@ HWTEST_F(AudioTransportStopStatusTest, transport_stop_test_004, TestSize.Level1) }, { SOURCE_TYPE_INVALID, - 0 + NORMAL_MODE }, { CONTENT_TYPE_UNKNOWN, STREAM_USAGE_UNKNOWN, - 0 + NORMAL_MODE } }; AudioParam testRemoteParaEnc = { @@ -119,16 +124,27 @@ HWTEST_F(AudioTransportStopStatusTest, transport_stop_test_004, TestSize.Level1) }, { SOURCE_TYPE_INVALID, - 0 + NORMAL_MODE }, { CONTENT_TYPE_UNKNOWN, STREAM_USAGE_UNKNOWN, - 0 + NORMAL_MODE } }; EXPECT_EQ(ERR_DH_AUDIO_TRANS_ILLEGAL_OPERATION, audioStatus_->Restart(testLocalParaEnc, testRemoteParaEnc, processor_)); } + +/** + * @tc.name: transport_getstatetype_test_001 + * @tc.desc: Verify pause action when status is start. + * @tc.type: FUNC + * @tc.require: AR000H0E5U + */ +HWTEST_F(AudioTransportStopStatusTest, transport_getstatetype_test_001, TestSize.Level1) +{ + EXPECT_EQ(TRANSPORT_STATE_STOP, audioStatus_->GetStateType()); +} } // namespace DistributedHardware } // namespace OHOS diff --git a/services/audiotransport/test/unittest/decodetransport/src/decode_transport_test.cpp b/services/audiotransport/test/unittest/decodetransport/src/decode_transport_test.cpp index eecf722b..8153cad9 100644 --- a/services/audiotransport/test/unittest/decodetransport/src/decode_transport_test.cpp +++ b/services/audiotransport/test/unittest/decodetransport/src/decode_transport_test.cpp @@ -71,12 +71,12 @@ HWTEST_F(DecodeTransportTest, decode_transport_test_001, TestSize.Level1) }, { SOURCE_TYPE_INVALID, - 0 + NORMAL_MODE }, { CONTENT_TYPE_UNKNOWN, STREAM_USAGE_UNKNOWN, - 0 + NORMAL_MODE } }; AudioParam testRemoteParaEnc = { @@ -88,12 +88,12 @@ HWTEST_F(DecodeTransportTest, decode_transport_test_001, TestSize.Level1) }, { SOURCE_TYPE_INVALID, - 0 + NORMAL_MODE }, { CONTENT_TYPE_UNKNOWN, STREAM_USAGE_UNKNOWN, - 0 + NORMAL_MODE } }; EXPECT_NE(DH_SUCCESS, decodeTrans_->SetUp(testLocalParaEnc, testRemoteParaEnc, transCallback_, ROLE_TEST)); @@ -115,6 +115,9 @@ HWTEST_F(DecodeTransportTest, decode_transport_test_002, TestSize.Level1) EXPECT_EQ(DH_SUCCESS, decodeTrans_->Release()); decodeTrans_->audioChannel_ = std::make_shared(); + decodeTrans_->context_ = std::make_shared(); + decodeTrans_->capType_ = CAP_MIC; + EXPECT_EQ(ERR_DH_AUDIO_TRANS_SESSION_NOT_OPEN, decodeTrans_->Start()); EXPECT_NE(DH_SUCCESS, decodeTrans_->Release()); } @@ -135,12 +138,12 @@ HWTEST_F(DecodeTransportTest, decode_transport_test_003, TestSize.Level1) }, { SOURCE_TYPE_INVALID, - 0 + NORMAL_MODE }, { CONTENT_TYPE_UNKNOWN, STREAM_USAGE_UNKNOWN, - 0 + NORMAL_MODE } }; AudioParam testRemoteParaEnc = { @@ -152,14 +155,17 @@ HWTEST_F(DecodeTransportTest, decode_transport_test_003, TestSize.Level1) }, { SOURCE_TYPE_INVALID, - 0 + NORMAL_MODE }, { CONTENT_TYPE_UNKNOWN, STREAM_USAGE_UNKNOWN, - 0 + NORMAL_MODE } }; + EXPECT_EQ(ERR_DH_AUDIO_BAD_VALUE, decodeTrans_->RegisterProcessorListener(testLocalParaEnc, testRemoteParaEnc)); + EXPECT_EQ(ERR_DH_AUDIO_TRANS_ERROR, + decodeTrans_->InitAudioDecodeTransport(testLocalParaEnc, testRemoteParaEnc, ROLE_TEST)); EXPECT_EQ(ERR_DH_AUDIO_NULLPTR, decodeTrans_->Pause()); EXPECT_EQ(ERR_DH_AUDIO_TRANS_ERROR, decodeTrans_->Restart(testLocalParaEnc, testRemoteParaEnc)); } @@ -183,5 +189,16 @@ HWTEST_F(DecodeTransportTest, decode_transport_test_004, TestSize.Level1) EXPECT_EQ(DH_SUCCESS, decodeTrans_->FeedAudioData(audioData)); } + +/** + * @tc.name: decode_transport_test_005 + * @tc.desc: Verify the RegisterChannelListener function. + * @tc.type: FUNC + * @tc.require: AR000H0E5U + */ +HWTEST_F(DecodeTransportTest, decode_transport_test_005, TestSize.Level1) +{ + EXPECT_EQ(ERR_DH_AUDIO_TRANS_ERROR, decodeTrans_->RegisterChannelListener(ROLE_TEST)); +} } // namespace DistributedHardware } // namespace OHOS diff --git a/services/audiotransport/test/unittest/encodetransport/src/encode_transport_test.cpp b/services/audiotransport/test/unittest/encodetransport/src/encode_transport_test.cpp index 39a0da7c..31016a83 100644 --- a/services/audiotransport/test/unittest/encodetransport/src/encode_transport_test.cpp +++ b/services/audiotransport/test/unittest/encodetransport/src/encode_transport_test.cpp @@ -74,12 +74,12 @@ HWTEST_F(EncodeTransportTest, encode_transport_test_001, TestSize.Level1) }, { SOURCE_TYPE_INVALID, - 0 + NORMAL_MODE }, { CONTENT_TYPE_UNKNOWN, STREAM_USAGE_UNKNOWN, - 0 + NORMAL_MODE } }; AudioParam testRemoteParaEnc = { @@ -91,12 +91,12 @@ HWTEST_F(EncodeTransportTest, encode_transport_test_001, TestSize.Level1) }, { SOURCE_TYPE_INVALID, - 0 + NORMAL_MODE }, { CONTENT_TYPE_UNKNOWN, STREAM_USAGE_UNKNOWN, - 0 + NORMAL_MODE } }; EXPECT_NE(DH_SUCCESS, encodeTrans_->SetUp(testLocalParaEnc, testRemoteParaEnc, transCallback_, ROLE_TEST)); @@ -140,12 +140,12 @@ HWTEST_F(EncodeTransportTest, encode_transport_test_003, TestSize.Level1) }, { SOURCE_TYPE_INVALID, - 0 + NORMAL_MODE }, { CONTENT_TYPE_UNKNOWN, STREAM_USAGE_UNKNOWN, - 0 + NORMAL_MODE } }; AudioParam testRemoteParaEnc = { @@ -157,14 +157,18 @@ HWTEST_F(EncodeTransportTest, encode_transport_test_003, TestSize.Level1) }, { SOURCE_TYPE_INVALID, - 0 + NORMAL_MODE }, { CONTENT_TYPE_UNKNOWN, STREAM_USAGE_UNKNOWN, - 0 + NORMAL_MODE } }; + + EXPECT_EQ(ERR_DH_AUDIO_TRANS_ERROR, encodeTrans_->RegisterProcessorListener(testLocalParaEnc, testRemoteParaEnc)); + EXPECT_EQ(ERR_DH_AUDIO_TRANS_ERROR, + encodeTrans_->InitAudioEncodeTrans(testLocalParaEnc, testRemoteParaEnc, ROLE_TEST)); encodeTrans_->context_ = std::make_shared(); auto stateContext = std::shared_ptr(encodeTrans_->context_); encodeTrans_->context_->currentState_ = @@ -172,5 +176,36 @@ HWTEST_F(EncodeTransportTest, encode_transport_test_003, TestSize.Level1) EXPECT_EQ(DH_SUCCESS, encodeTrans_->Pause()); EXPECT_EQ(ERR_DH_AUDIO_TRANS_ERROR, encodeTrans_->Restart(testLocalParaEnc, testRemoteParaEnc)); } + +/** + * @tc.name: encode_transport_test_004 + * @tc.desc: Verify encode_transport_test function. + * @tc.type: FUNC + * @tc.require: AR000H0E5U + */ +HWTEST_F(EncodeTransportTest, encode_transport_test_004, TestSize.Level1) +{ + std::shared_ptr audioData = nullptr; + AudioEvent event; + encodeTrans_->OnSessionOpened(); + encodeTrans_->OnSessionClosed(); + encodeTrans_->OnDataReceived(audioData); + encodeTrans_->OnEventReceived(event); + encodeTrans_->OnStateNotify(event); + encodeTrans_->OnAudioDataDone(audioData); + + EXPECT_EQ(ERR_DH_AUDIO_TRANS_NULL_VALUE, encodeTrans_->FeedAudioData(audioData)); +} + +/** + * @tc.name: encode_transport_test_005 + * @tc.desc: Verify RegisterChannelListener function. + * @tc.type: FUNC + * @tc.require: AR000H0E5U + */ +HWTEST_F(EncodeTransportTest, encode_transport_test_005, TestSize.Level1) +{ + EXPECT_EQ(ERR_DH_AUDIO_TRANS_ERROR, encodeTrans_->RegisterChannelListener(ROLE_TEST)); +} } // namespace DistributedHardware } // namespace OHOS diff --git a/services/common/BUILD.gn b/services/common/BUILD.gn index c61316cb..acdc1811 100644 --- a/services/common/BUILD.gn +++ b/services/common/BUILD.gn @@ -16,7 +16,15 @@ import("//build/ohos_var.gni") import( "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") -ohos_shared_library("distributed_audio_utils") { +config("daudio_common_pub_config") { + include_dirs = [ + "audiodata/include", + "audioparam", + "${common_path}/include" + ] +} + +config("daudio_common_private_config") { include_dirs = [ "//base/hiviewdfx/hisysevent/interfaces/native/innerkits/hisysevent/include", "//base/hiviewdfx/hitrace/interfaces/native/innerkits/include/hitrace_meter", @@ -25,12 +33,16 @@ ohos_shared_library("distributed_audio_utils") { ] include_dirs += [ - "audiodata/include", - "audioparam", "taskProcessor/include", "${common_path}/include", "${common_path}/dfx_utils/include", ] +} + +ohos_shared_library("distributed_audio_utils") { + configs = [":daudio_common_private_config"] + + public_configs = [":daudio_common_pub_config"] sources = [ "audiodata/src/audio_data.cpp", diff --git a/services/common/audioparam/audio_event.h b/services/common/audioparam/audio_event.h index 515e4375..6952ae2c 100644 --- a/services/common/audioparam/audio_event.h +++ b/services/common/audioparam/audio_event.h @@ -63,10 +63,6 @@ typedef enum { CHANGE_PLAY_STATUS = 71, - MMAP_START = 81, - MMAP_STOP = 82, - MMAP_START_MIC = 83, - MMAP_STOP_MIC = 84, AUDIO_START = 85, AUDIO_STOP = 86, } AudioEventType; @@ -86,10 +82,6 @@ typedef enum { AUDIO_EVENT_RENDER_STATE_CHANGE = 11, AUDIO_EVENT_MUTE_SET = 12, AUDIO_EVENT_CHANGE_PLAY_STATUS = 13, - AUDIO_EVENT_MMAP_START = 14, - AUDIO_EVENT_MMAP_STOP = 15, - AUDIO_EVENT_MIC_MMAP_START = 16, - AUDIO_EVENT_MIC_MMAP_STOP = 17, AUDIO_EVENT_START = 18, AUDIO_EVENT_STOP = 19, } AudioEventHDF; diff --git a/services/common/audioparam/audio_param.h b/services/common/audioparam/audio_param.h index c41d2cc2..77453d21 100644 --- a/services/common/audioparam/audio_param.h +++ b/services/common/audioparam/audio_param.h @@ -77,6 +77,11 @@ typedef enum { STREAM_USAGE_NOTIFICATION_RINGTONE = 6 } StreamUsage; +typedef enum { + NORMAL_MODE = 0, + MMAP_MODE = 1, +} PortOperationMode; + typedef struct AudioCommonParam { AudioSampleRate sampleRate = SAMPLE_RATE_8000; AudioChannel channelMask = MONO; @@ -85,16 +90,15 @@ typedef struct AudioCommonParam { uint32_t frameSize = 0; } AudioCommonParam; - typedef struct AudioCaptureOptions { SourceType sourceType = SOURCE_TYPE_INVALID; - int32_t capturerFlags = 0; + PortOperationMode capturerFlags = NORMAL_MODE; } AudioCaptureOptions; typedef struct AudioRenderOptions { ContentType contentType = CONTENT_TYPE_UNKNOWN; StreamUsage streamUsage = STREAM_USAGE_UNKNOWN; - int32_t renderFlags = 0; + PortOperationMode renderFlags = NORMAL_MODE; } AudioRenderOptions; typedef struct AudioParamHDF { @@ -104,8 +108,8 @@ typedef struct AudioParamHDF { StreamUsage streamUsage = STREAM_USAGE_UNKNOWN; uint32_t frameSize = 0; uint32_t period = 0; - int32_t renderFlags = 0; - int32_t capturerFlags = 0; + PortOperationMode renderFlags = NORMAL_MODE; + PortOperationMode capturerFlags = NORMAL_MODE; std::string ext; } AudioParamHDF; @@ -126,6 +130,11 @@ typedef enum { CAP_SPK = 1, CAP_MIC = 2, } PortCapType; + +typedef struct { + int64_t tvSec; + int64_t tvNSec; +} CurrentTimeHDF; } // namespace DistributedHardware } // namespace OHOS #endif // OHOS_DAUDIO_AUDIO_PARAM_H diff --git a/services/hdfaudioclient/test/unittest/audio_adapter_internal/audio_adapter_internal_test.h b/services/hdfaudioclient/test/unittest/audio_adapter_internal/audio_adapter_internal_test.h index fe7b9c66..03567108 100644 --- a/services/hdfaudioclient/test/unittest/audio_adapter_internal/audio_adapter_internal_test.h +++ b/services/hdfaudioclient/test/unittest/audio_adapter_internal/audio_adapter_internal_test.h @@ -13,6 +13,9 @@ * limitations under the License. */ +#ifndef DAUDIO_ADAPTER_INTERNAL_TEST_H +#define DAUDIO_ADAPTER_INTERNAL_TEST_H + #include #include "daudio_adapter_internal.h" @@ -133,4 +136,5 @@ public: } }; } // DistributedHardware -} // OHOS \ No newline at end of file +} // OHOS +#endif \ No newline at end of file diff --git a/services/softbusadapter/test/unittest/src/softbus_adapter_test.cpp b/services/softbusadapter/test/unittest/src/softbus_adapter_test.cpp index 31f85b9c..42205527 100644 --- a/services/softbusadapter/test/unittest/src/softbus_adapter_test.cpp +++ b/services/softbusadapter/test/unittest/src/softbus_adapter_test.cpp @@ -148,17 +148,6 @@ HWTEST_F(SoftbusAdapterTest, OnSoftbusSessionOpened_002, TestSize.Level1) int32_t result = 0; EXPECT_EQ(ERR_DH_AUDIO_TRANS_ERROR, softbusAdapter.OnSoftbusSessionOpened(sessionId, result)); -} - -/** - * @tc.name: OnSoftbusSessionClosed_001 - * @tc.desc: Verify the OnSoftbusSessionClosed function. - * @tc.type: FUNC - * @tc.require: AR000H0E5U - */ -HWTEST_F(SoftbusAdapterTest, OnSoftbusSessionClosed_001, TestSize.Level1) -{ - int32_t sessionId = 1; softbusAdapter.OnSoftbusSessionClosed(sessionId); } } // namespace DistributedHardware -- Gitee From d5ff8b58b64714a10e5f1c07b10b27a27be646da Mon Sep 17 00:00:00 2001 From: w30042960 Date: Wed, 12 Apr 2023 11:10:10 +0800 Subject: [PATCH 2/9] modify transport Signed-off-by: w30042960 --- .../decodetransport/src/audio_decode_transport.cpp | 6 +----- .../encodetransport/src/audio_encode_transport.cpp | 6 +----- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/services/audiotransport/decodetransport/src/audio_decode_transport.cpp b/services/audiotransport/decodetransport/src/audio_decode_transport.cpp index 43a153ec..ce6bd135 100644 --- a/services/audiotransport/decodetransport/src/audio_decode_transport.cpp +++ b/services/audiotransport/decodetransport/src/audio_decode_transport.cpp @@ -237,11 +237,7 @@ int32_t AudioDecodeTransport::RegisterChannelListener(const PortCapType capType) int32_t AudioDecodeTransport::RegisterProcessorListener(const AudioParam &localParam, const AudioParam &remoteParam) { DHLOGI("Register processor listener."); - if (localParam.renderOpts.renderFlags == NORMAL_MODE || localParam.captureOpts.capturerFlags == NORMAL_MODE) { - DHLOGE("Decode trans normal mode. renderFlags: %d, captureFlags: %d", - localParam.renderOpts.renderFlags, localParam.captureOpts.capturerFlags); - processor_ = std::make_shared(); - } + processor_ = std::make_shared(); int32_t ret = processor_->ConfigureAudioProcessor(localParam.comParam, remoteParam.comParam, shared_from_this()); if (ret != DH_SUCCESS) { DHLOGE("Configure audio processor failed."); diff --git a/services/audiotransport/encodetransport/src/audio_encode_transport.cpp b/services/audiotransport/encodetransport/src/audio_encode_transport.cpp index 468b0134..8f1bcbf6 100644 --- a/services/audiotransport/encodetransport/src/audio_encode_transport.cpp +++ b/services/audiotransport/encodetransport/src/audio_encode_transport.cpp @@ -187,11 +187,7 @@ int32_t AudioEncodeTransport::RegisterChannelListener(const PortCapType capType) int32_t AudioEncodeTransport::RegisterProcessorListener(const AudioParam &localParam, const AudioParam &remoteParam) { DHLOGI("Register processor listener."); - if (localParam.renderOpts.renderFlags == NORMAL_MODE || localParam.captureOpts.capturerFlags == NORMAL_MODE) { - DHLOGE("Encode trans normal mode. renderFlags: %d, captureFlags: %d", - localParam.renderOpts.renderFlags, localParam.captureOpts.capturerFlags); - processor_ = std::make_shared(); - } + processor_ = std::make_shared(); if (audioChannel_ == nullptr) { DHLOGE("Create audio processor failed."); return ERR_DH_AUDIO_TRANS_ERROR; -- Gitee From 9a128f12eba351e6c124a93b7127c2dda181f856 Mon Sep 17 00:00:00 2001 From: w30042960 Date: Wed, 12 Apr 2023 16:36:07 +0800 Subject: [PATCH 3/9] modify CodeCheck Signed-off-by: w30042960 --- common/include/daudio_util.h | 3 +-- common/src/daudio_util.cpp | 5 ++--- .../audio/v1_0/src/audio_capture_interface_impl.cpp | 2 +- .../audio/v1_0/src/audio_render_interface_impl.cpp | 2 +- .../hdi_service/common/utils/include/daudio_utils.h | 3 +-- .../hdi_service/common/utils/src/daudio_utils.cpp | 7 +++---- .../test/unittest/spkclient/src/dspeaker_client_test.cpp | 2 +- services/audiomanager/managersink/src/daudio_sink_dev.cpp | 4 ++-- .../audiomanager/managersource/src/daudio_source_dev.cpp | 4 ++-- services/audiomanager/servicesink/BUILD.gn | 1 - 10 files changed, 14 insertions(+), 19 deletions(-) diff --git a/common/include/daudio_util.h b/common/include/daudio_util.h index 5b95679e..77f1a6f1 100644 --- a/common/include/daudio_util.h +++ b/common/include/daudio_util.h @@ -43,8 +43,7 @@ int32_t CalculateSampleNum(uint32_t sampleRate, uint32_t timems); int64_t GetCurNano(); int32_t AbsoluteSleep(int64_t nanoTime); int64_t CalculateOffset(const int64_t frameIndex, const int64_t framePeriodNs, const int64_t startTime); -int64_t UpdateTimeOffset(const int64_t frameIndex, const int64_t framePeriodNs, const int64_t updateInterval, - int64_t &startTime); +int64_t UpdateTimeOffset(const int64_t frameIndex, const int64_t framePeriodNs, int64_t &startTime); void GetCurrentTime(int64_t &tvSec, int64_t &tvNSec); bool CheckIsNum(const std::string &jsonString); } // namespace DistributedHardware diff --git a/common/src/daudio_util.cpp b/common/src/daudio_util.cpp index 3babad56..a1dbaa49 100644 --- a/common/src/daudio_util.cpp +++ b/common/src/daudio_util.cpp @@ -270,13 +270,12 @@ int64_t CalculateOffset(const int64_t frameIndex, const int64_t framePeriodNs, c return totalOffset - frameIndex * framePeriodNs; } -int64_t UpdateTimeOffset(const int64_t frameIndex, const int64_t framePeriodNs, const int64_t updateInterval, - int64_t &startTime) +int64_t UpdateTimeOffset(const int64_t frameIndex, const int64_t framePeriodNs, int64_t &startTime) { int64_t timeOffset = 0; if (frameIndex == 0) { startTime = GetCurNano(); - } else if (frameIndex % updateInterval == 0) { + } else if (frameIndex % AUDIO_OFFSET_FRAME_NUM == 0) { timeOffset = CalculateOffset(frameIndex, framePeriodNs, startTime); } return timeOffset; diff --git a/hdf_service/distributed_audio/hdi_service/audio/v1_0/src/audio_capture_interface_impl.cpp b/hdf_service/distributed_audio/hdi_service/audio/v1_0/src/audio_capture_interface_impl.cpp index b0331913..d6e80e8f 100644 --- a/hdf_service/distributed_audio/hdi_service/audio/v1_0/src/audio_capture_interface_impl.cpp +++ b/hdf_service/distributed_audio/hdi_service/audio/v1_0/src/audio_capture_interface_impl.cpp @@ -64,7 +64,7 @@ int32_t AudioCaptureInterfaceImpl::CaptureFrame(std::vector &frame, uint { DHLOGD("Capture frame[sampleRate: %d, channelCount: %d, format: %d, frameSize: %d].", devAttrs_.sampleRate, devAttrs_.channelCount, devAttrs_.format, devAttrs_.frameSize); - int64_t timeOffset = UpdateTimeOffset(frameIndex_, framePeriodNs_, AUDIO_OFFSET_FRAME_NUM, startTime_); + int64_t timeOffset = UpdateTimeOffset(frameIndex_, framePeriodNs_, startTime_); DHLOGD("Capture framIndex: %lld, timeOffset: %lld.", frameIndex_, timeOffset); std::lock_guard captureLck(captureMtx_); diff --git a/hdf_service/distributed_audio/hdi_service/audio/v1_0/src/audio_render_interface_impl.cpp b/hdf_service/distributed_audio/hdi_service/audio/v1_0/src/audio_render_interface_impl.cpp index 83a07389..d0374f55 100644 --- a/hdf_service/distributed_audio/hdi_service/audio/v1_0/src/audio_render_interface_impl.cpp +++ b/hdf_service/distributed_audio/hdi_service/audio/v1_0/src/audio_render_interface_impl.cpp @@ -92,7 +92,7 @@ int32_t AudioRenderInterfaceImpl::RenderFrame(const std::vector &frame, { DHLOGI("Render frame[sampleRate: %d, channelCount: %d, format: %d, frameSize: %d].", devAttrs_.sampleRate, devAttrs_.channelCount, devAttrs_.format, devAttrs_.frameSize); - int64_t timeOffset = UpdateTimeOffset(frameIndex_, framePeriodNs_, AUDIO_OFFSET_FRAME_NUM, startTime_); + int64_t timeOffset = UpdateTimeOffset(frameIndex_, framePeriodNs_, startTime_); DHLOGD("Render frameIndex: %lld, timeOffset: %lld.", frameIndex_, timeOffset); std::lock_guard renderLck(renderMtx_); diff --git a/hdf_service/distributed_audio/hdi_service/common/utils/include/daudio_utils.h b/hdf_service/distributed_audio/hdi_service/common/utils/include/daudio_utils.h index 903d1c27..538b9130 100644 --- a/hdf_service/distributed_audio/hdi_service/common/utils/include/daudio_utils.h +++ b/hdf_service/distributed_audio/hdi_service/common/utils/include/daudio_utils.h @@ -48,8 +48,7 @@ int32_t AbsoluteSleep(int64_t nanoTime); int64_t CalculateOffset(const int64_t frameindex, const int64_t framePeriodNs, const int64_t startTime); -int64_t UpdateTimeOffset(const int64_t frameIndex, const int64_t framePeriodNs, const int64_t updateInterval, - int64_t &startTime); +int64_t UpdateTimeOffset(const int64_t frameIndex, const int64_t framePeriodNs, int64_t &startTime); } // DistributedHardware } // OHOS #endif \ No newline at end of file diff --git a/hdf_service/distributed_audio/hdi_service/common/utils/src/daudio_utils.cpp b/hdf_service/distributed_audio/hdi_service/common/utils/src/daudio_utils.cpp index 68cf9d1b..f9e58d4b 100644 --- a/hdf_service/distributed_audio/hdi_service/common/utils/src/daudio_utils.cpp +++ b/hdf_service/distributed_audio/hdi_service/common/utils/src/daudio_utils.cpp @@ -150,13 +150,12 @@ int64_t CalculateOffset(const int64_t frameIndex, const int64_t framePeriodNs, c return totalOffset - frameIndex * framePeriodNs; } -int64_t UpdateTimeOffset(const int64_t frameIndex, const int64_t framePeriodNs, const int64_t updateInterval, - int64_t &startTime) +int64_t UpdateTimeOffset(const int64_t frameIndex, const int64_t framePeriodNs, int64_t &startTime) { int64_t timeOffset = 0; - if (frameIndex ==0) { + if (frameIndex == 0) { startTime = GetCurNano(); - } else if (frameIndex % updateInterval == 0) { + } else if (frameIndex % AUDIO_OFFSET_FRAME_NUM == 0) { timeOffset = CalculateOffset(frameIndex, framePeriodNs, startTime); } return timeOffset; diff --git a/services/audioclient/test/unittest/spkclient/src/dspeaker_client_test.cpp b/services/audioclient/test/unittest/spkclient/src/dspeaker_client_test.cpp index bc642961..9b71312e 100644 --- a/services/audioclient/test/unittest/spkclient/src/dspeaker_client_test.cpp +++ b/services/audioclient/test/unittest/spkclient/src/dspeaker_client_test.cpp @@ -107,7 +107,7 @@ HWTEST_F(DSpeakerClientTest, StopRender001, TestSize.Level1) speakerClient_->PlayStatusChange(args); speakerClient_->SetAudioParameters(event); speakerClient_->SetMute(event); - for(size_t i =0; i<10; i++) { + for (size_t i =0; i<10; i++) { std::shared_ptr data = std::make_shared(4096); speakerClient_->dataQueue_.push(data); } diff --git a/services/audiomanager/managersink/src/daudio_sink_dev.cpp b/services/audiomanager/managersink/src/daudio_sink_dev.cpp index c549dc86..03d5ef31 100644 --- a/services/audiomanager/managersink/src/daudio_sink_dev.cpp +++ b/services/audiomanager/managersink/src/daudio_sink_dev.cpp @@ -604,8 +604,8 @@ void DAudioSinkDev::OnTaskResult(int32_t resultCode, const std::string &result, void DAudioSinkDev::NotifySourceDev(const AudioEventType type, const std::string dhId, const int32_t result) { - srand(static_cast(time(0))); - const int32_t randomTaskCode = rand(); + std::random_device rd; + const uint32_t randomTaskCode = rd(); json jEvent; jEvent[KEY_DH_ID] = dhId; jEvent[KEY_RESULT] = result; diff --git a/services/audiomanager/managersource/src/daudio_source_dev.cpp b/services/audiomanager/managersource/src/daudio_source_dev.cpp index 177ab262..8b864a39 100644 --- a/services/audiomanager/managersource/src/daudio_source_dev.cpp +++ b/services/audiomanager/managersource/src/daudio_source_dev.cpp @@ -815,8 +815,8 @@ void DAudioSourceDev::OnTaskResult(int32_t resultCode, const std::string &result int32_t DAudioSourceDev::NotifySinkDev(const AudioEventType type, const json Param, const std::string dhId) { - srand(static_cast(time(0))); - const int32_t randomTaskCode = rand(); + std::random_device rd; + const uint32_t randomTaskCode = rd(); constexpr uint32_t eventOffset = 4; json jParam = { { KEY_DH_ID, dhId }, { KEY_EVENT_TYPE, type }, diff --git a/services/audiomanager/servicesink/BUILD.gn b/services/audiomanager/servicesink/BUILD.gn index 2e70adf5..b2ed1059 100755 --- a/services/audiomanager/servicesink/BUILD.gn +++ b/services/audiomanager/servicesink/BUILD.gn @@ -65,7 +65,6 @@ ohos_shared_library("distributed_audio_sink") { "${services_path}/common/audiodata/include", "${services_path}/audiomanager/managersink/include", "${softbusadapter_path}/include", - "//drivers/hdf_core/framework/include/osal", ] sources = [ -- Gitee From 71dc6b71d7f33fe524ec316546df7d54066dd0ee Mon Sep 17 00:00:00 2001 From: w30042960 Date: Wed, 12 Apr 2023 17:02:33 +0800 Subject: [PATCH 4/9] modify CodeCheck Signed-off-by: w30042960 --- services/audiomanager/managersink/src/daudio_sink_dev.cpp | 2 ++ services/audiomanager/managersource/src/daudio_source_dev.cpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/services/audiomanager/managersink/src/daudio_sink_dev.cpp b/services/audiomanager/managersink/src/daudio_sink_dev.cpp index 03d5ef31..294b550e 100644 --- a/services/audiomanager/managersink/src/daudio_sink_dev.cpp +++ b/services/audiomanager/managersink/src/daudio_sink_dev.cpp @@ -15,6 +15,8 @@ #include "daudio_sink_dev.h" +#include + #include "daudio_constants.h" #include "daudio_errorcode.h" #include "daudio_log.h" diff --git a/services/audiomanager/managersource/src/daudio_source_dev.cpp b/services/audiomanager/managersource/src/daudio_source_dev.cpp index 8b864a39..47397aa9 100644 --- a/services/audiomanager/managersource/src/daudio_source_dev.cpp +++ b/services/audiomanager/managersource/src/daudio_source_dev.cpp @@ -15,6 +15,8 @@ #include "daudio_source_dev.h" +#include + #include "daudio_constants.h" #include "daudio_errorcode.h" #include "daudio_hitrace.h" -- Gitee From db2a90d34de89d3d9c7b18a641b031297981b2e7 Mon Sep 17 00:00:00 2001 From: w30042960 Date: Wed, 12 Apr 2023 17:40:38 +0800 Subject: [PATCH 5/9] modify transport Signed-off-by: w30042960 --- .../audio/v1_0/test/unittest/audio_adapter_interface/BUILD.gn | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/audio_adapter_interface/BUILD.gn b/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/audio_adapter_interface/BUILD.gn index 0dc8b0b6..b58f3099 100644 --- a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/audio_adapter_interface/BUILD.gn +++ b/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/audio_adapter_interface/BUILD.gn @@ -48,9 +48,7 @@ ohos_unittest("HDIServiceAudioAdapterTest") { "//third_party/googletest:gtest_main", ] - external_deps = [ - "c_utils:utils", - ] + external_deps = [ "c_utils:utils" ] } group("hdi_service_audio_adapter_test") { -- Gitee From 5f8ca32618608dc9432b71c36296c08cb71257fd Mon Sep 17 00:00:00 2001 From: w30042960 Date: Wed, 12 Apr 2023 20:49:51 +0800 Subject: [PATCH 6/9] modify gn Signed-off-by: w30042960 --- audiohandler/BUILD.gn | 4 +- common/dfx_utils/test/unittest/BUILD.gn | 5 +- common/test_utils/BUILD.gn | 59 ++++--- .../distributed_audio/audio/v1_0/BUILD.gn | 4 +- .../fuzztest/captureframe_fuzzer/BUILD.gn | 10 +- .../fuzztest/createcapture_fuzzer/BUILD.gn | 10 +- .../fuzztest/createrender_fuzzer/BUILD.gn | 10 +- .../fuzztest/destroycapture_fuzzer/BUILD.gn | 6 +- .../fuzztest/destroyrender_fuzzer/BUILD.gn | 6 +- .../fuzztest/getalladapters_fuzzer/BUILD.gn | 4 +- .../fuzztest/getextraparams_fuzzer/BUILD.gn | 6 +- .../test/fuzztest/loadadapter_fuzzer/BUILD.gn | 4 +- .../test/fuzztest/renderframe_fuzzer/BUILD.gn | 10 +- .../fuzztest/setextraparams_fuzzer/BUILD.gn | 6 +- .../fuzztest/unloadadapter_fuzzer/BUILD.gn | 4 +- .../unittest/audio_capture_interface/BUILD.gn | 4 +- .../audio_capture_lowlatency/BUILD.gn | 4 +- .../unittest/audio_render_interface/BUILD.gn | 4 +- .../unittest/audio_render_lowlatency/BUILD.gn | 4 +- .../test/fuzztest/notifyevent_fuzzer/BUILD.gn | 2 +- .../registeraudiodevice_fuzzer/BUILD.gn | 5 +- .../unregisteraudiodevice_fuzzer/BUILD.gn | 5 +- .../distributed_audio/mfc_test/BUILD.gn | 8 +- .../inner_kits/native_cpp/audio_sink/BUILD.gn | 2 +- .../native_cpp/audio_source/BUILD.gn | 2 +- .../native_cpp/test/fuzztest/BUILD.gn | 28 ++-- .../onremotesinksvrdied_fuzzer/BUILD.gn | 5 +- .../sinkhandlerfinishstartsa_fuzzer/BUILD.gn | 5 +- .../sinkhandlerinitsink_fuzzer/BUILD.gn | 5 +- .../BUILD.gn | 5 +- .../BUILD.gn | 5 +- .../BUILD.gn | 5 +- .../BUILD.gn | 5 +- .../sinkproxydaudionotify_fuzzer/BUILD.gn | 5 +- .../sinkproxyinitsink_fuzzer/BUILD.gn | 5 +- .../BUILD.gn | 5 +- .../BUILD.gn | 5 +- .../BUILD.gn | 1 - .../native_cpp/test/unittest/BUILD.gn | 10 +- .../test/unittest/audiosinktest/BUILD.gn | 4 +- .../test/unittest/controlsource/BUILD.gn | 6 +- .../test/unittest/daudio_hdi_handler/BUILD.gn | 4 +- .../unittest/daudio_manager_callback/BUILD.gn | 4 +- services/audiomanager/servicesink/BUILD.gn | 14 +- services/audiomanager/servicesource/BUILD.gn | 8 +- services/audiomanager/test/unittest/BUILD.gn | 6 +- .../test/unittest/managersink/BUILD.gn | 32 ++-- .../test/unittest/servicesink/BUILD.gn | 14 +- .../test/unittest/servicesource/BUILD.gn | 14 +- .../test/unittest/source_device/BUILD.gn | 13 +- .../test/unittest/sourcemanager/BUILD.gn | 3 +- .../audioprocessor/effectcomponent/BUILD.gn | 14 +- .../audioctrltransport/BUILD.gn | 4 +- .../audiotransportstatus/BUILD.gn | 144 ++++++++-------- .../audiotransport/decodetransport/BUILD.gn | 4 +- .../audiotransport/encodetransport/BUILD.gn | 3 +- .../audiotransport/test/unittest/BUILD.gn | 2 +- .../test/unittest/audioctrlchannel/BUILD.gn | 2 +- .../unittest/audiotransportstatus/BUILD.gn | 157 +++++++++--------- .../test/unittest/encodetransport/BUILD.gn | 2 +- services/common/BUILD.gn | 12 +- .../taskProcessor/test/unittest/BUILD.gn | 4 +- .../test/unittest/task_queue/BUILD.gn | 8 +- .../hdfaudioclient/test/unittest/BUILD.gn | 12 +- services/softbusadapter/BUILD.gn | 2 +- 65 files changed, 350 insertions(+), 424 deletions(-) diff --git a/audiohandler/BUILD.gn b/audiohandler/BUILD.gn index e93e1240..84c43d62 100644 --- a/audiohandler/BUILD.gn +++ b/audiohandler/BUILD.gn @@ -38,14 +38,14 @@ ohos_shared_library("distributed_audio_handler") { sources = [ "src/daudio_handler.cpp" ] deps = [ - "${services_path}/common:distributed_audio_utils", "${mediastandard_path}/interfaces/inner_api/native:media_client", + "${services_path}/common:distributed_audio_utils", ] external_deps = [ "c_utils:utils", - "multimedia_audio_framework:audio_client", "multimedia_audio_framework:audio_capturer", + "multimedia_audio_framework:audio_client", ] defines = [ diff --git a/common/dfx_utils/test/unittest/BUILD.gn b/common/dfx_utils/test/unittest/BUILD.gn index d15e775b..bfa27536 100644 --- a/common/dfx_utils/test/unittest/BUILD.gn +++ b/common/dfx_utils/test/unittest/BUILD.gn @@ -76,9 +76,8 @@ config("module_private_config") { ohos_unittest("DAudioDfxTest") { module_out_path = module_out_path - sources = [ - "${common_path}/dfx_utils/test/unittest/src/daudio_hidumper_test.cpp", - ] + sources = + [ "${common_path}/dfx_utils/test/unittest/src/daudio_hidumper_test.cpp" ] configs = [ ":module_private_config" ] diff --git a/common/test_utils/BUILD.gn b/common/test_utils/BUILD.gn index a9ea98a6..85773b6f 100644 --- a/common/test_utils/BUILD.gn +++ b/common/test_utils/BUILD.gn @@ -13,41 +13,40 @@ import("//build/ohos.gni") import("//build/ohos_var.gni") -import("//foundation/distributedhardware/distributed_audio/distributedaudio.gni") import("//drivers/hdf_core/adapter/uhdf2/uhdf.gni") import("//drivers/peripheral/adapter/base/hidl_adapter.gni") +import( + "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") ohos_executable("daudio_test_bin") { - include_dirs = [ - "//foundation/multimedia/audio_framework/interfaces/inner_api/native/audiocommon/include", - "//foundation/multimedia/audio_framework/frameworks/native/common/include", - "//foundation/multinedia/audio_framework/interfaces/inner_api/native/audiocapturer/include", - "${common_path}/include", - "//drivers/peripheral/audio/interfaces/include", - ] + include_dirs = [ + "//foundation/multimedia/audio_framework/interfaces/inner_api/native/audiocommon/include", + "//foundation/multimedia/audio_framework/frameworks/native/common/include", + "//foundation/multinedia/audio_framework/interfaces/inner_api/native/audiocapturer/include", + "${common_path}/include", + "//drivers/peripheral/audio/interfaces/include", + ] - sources = [ - "audio_buffer.cpp", - "daudio_test_utils.cpp", - "local_audio.cpp", - "cycle_test.cpp", - "hdf_audio.cpp", - "audio_base.cpp" - ] + sources = [ + "audio_base.cpp", + "audio_buffer.cpp", + "cycle_test.cpp", + "daudio_test_utils.cpp", + "hdf_audio.cpp", + "local_audio.cpp", + ] - deps = [ - "${services_path}/common:distributed_audio_utils", - ] + deps = [ "${services_path}/common:distributed_audio_utils" ] - external_deps = [ - "c_utils:utils", - "hdf_core:libhdf_utils", - "hiviewdfx_hilog_native:libhilog", - "multimedia_audio_framework:audio_client", - "multimedia_audio_framework:audio_capturer", - "multimedia_audio_framework:audio_renderer", - ] + external_deps = [ + "c_utils:utils", + "hdf_core:libhdf_utils", + "hiviewdfx_hilog_native:libhilog", + "multimedia_audio_framework:audio_capturer", + "multimedia_audio_framework:audio_client", + "multimedia_audio_framework:audio_renderer", + ] - subsystem_name = "distributedhardware" - part_name = "distributed_audio" -} \ No newline at end of file + subsystem_name = "distributedhardware" + part_name = "distributed_audio" +} diff --git a/hdf_interfaces/distributed_audio/audio/v1_0/BUILD.gn b/hdf_interfaces/distributed_audio/audio/v1_0/BUILD.gn index 86d8eff3..05f1c7e2 100644 --- a/hdf_interfaces/distributed_audio/audio/v1_0/BUILD.gn +++ b/hdf_interfaces/distributed_audio/audio/v1_0/BUILD.gn @@ -15,12 +15,12 @@ import("//drivers/hdf_core/adapter/uhdf2/hdi.gni") hdi("daudio") { module_name = "daudio" sources = [ + "AudioTypes.idl", "IAudioAdapter.idl", + "IAudioCallback.idl", "IAudioCapture.idl", "IAudioManager.idl", "IAudioRender.idl", - "AudioTypes.idl", - "IAudioCallback.idl", ] language = "cpp" root = "ohos.hdi://foundation/distributedhardware/distributed_audio/hdf_interfaces/" diff --git a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/captureframe_fuzzer/BUILD.gn b/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/captureframe_fuzzer/BUILD.gn index a75fb098..84e6d2ee 100644 --- a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/captureframe_fuzzer/BUILD.gn +++ b/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/captureframe_fuzzer/BUILD.gn @@ -43,13 +43,9 @@ ohos_fuzztest("CaptureFrameFuzzTest") { "${common_path}/include", ] - deps = [ - "${hdf_ser_aud_path}:libaudio_manager_daudio_primary_service_1.0", - ] + deps = [ "${hdf_ser_aud_path}:libaudio_manager_daudio_primary_service_1.0" ] - external_deps = [ - "c_utils:utils", - ] + external_deps = [ "c_utils:utils" ] defines = [ "HI_LOG_ENABLE", @@ -63,4 +59,4 @@ group("fuzztest") { testonly = true deps = [ ":CaptureFrameFuzzTest" ] } -############################################################################### \ No newline at end of file +############################################################################### diff --git a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/createcapture_fuzzer/BUILD.gn b/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/createcapture_fuzzer/BUILD.gn index 4eba3dcb..0c00d4cd 100644 --- a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/createcapture_fuzzer/BUILD.gn +++ b/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/createcapture_fuzzer/BUILD.gn @@ -43,13 +43,9 @@ ohos_fuzztest("CreateCaptureFuzzTest") { "${common_path}/include", ] - deps = [ - "${hdf_ser_aud_path}:libaudio_manager_daudio_primary_service_1.0", - ] + deps = [ "${hdf_ser_aud_path}:libaudio_manager_daudio_primary_service_1.0" ] - external_deps = [ - "c_utils:utils", - ] + external_deps = [ "c_utils:utils" ] defines = [ "HI_LOG_ENABLE", @@ -63,4 +59,4 @@ group("fuzztest") { testonly = true deps = [ ":CreateCaptureFuzzTest" ] } -############################################################################### \ No newline at end of file +############################################################################### diff --git a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/createrender_fuzzer/BUILD.gn b/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/createrender_fuzzer/BUILD.gn index 404b06cc..3bda1c63 100644 --- a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/createrender_fuzzer/BUILD.gn +++ b/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/createrender_fuzzer/BUILD.gn @@ -43,13 +43,9 @@ ohos_fuzztest("CreateRenderFuzzTest") { "${common_path}/include", ] - deps = [ - "${hdf_ser_aud_path}:libaudio_manager_daudio_primary_service_1.0", - ] + deps = [ "${hdf_ser_aud_path}:libaudio_manager_daudio_primary_service_1.0" ] - external_deps = [ - "c_utils:utils", - ] + external_deps = [ "c_utils:utils" ] defines = [ "HI_LOG_ENABLE", @@ -63,4 +59,4 @@ group("fuzztest") { testonly = true deps = [ ":CreateRenderFuzzTest" ] } -############################################################################### \ No newline at end of file +############################################################################### diff --git a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/destroycapture_fuzzer/BUILD.gn b/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/destroycapture_fuzzer/BUILD.gn index 4a19984a..0473001c 100644 --- a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/destroycapture_fuzzer/BUILD.gn +++ b/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/destroycapture_fuzzer/BUILD.gn @@ -43,9 +43,7 @@ ohos_fuzztest("DestroyCaptureFuzzTest") { "${common_path}/include", ] - deps = [ - "${hdf_ser_aud_path}:libaudio_manager_daudio_primary_service_1.0", - ] + deps = [ "${hdf_ser_aud_path}:libaudio_manager_daudio_primary_service_1.0" ] defines = [ "HI_LOG_ENABLE", @@ -59,4 +57,4 @@ group("fuzztest") { testonly = true deps = [ ":DestroyCaptureFuzzTest" ] } -############################################################################### \ No newline at end of file +############################################################################### diff --git a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/destroyrender_fuzzer/BUILD.gn b/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/destroyrender_fuzzer/BUILD.gn index cca452db..1bf06740 100644 --- a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/destroyrender_fuzzer/BUILD.gn +++ b/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/destroyrender_fuzzer/BUILD.gn @@ -43,9 +43,7 @@ ohos_fuzztest("DestroyRenderFuzzTest") { "${common_path}/include", ] - deps = [ - "${hdf_ser_aud_path}:libaudio_manager_daudio_primary_service_1.0", - ] + deps = [ "${hdf_ser_aud_path}:libaudio_manager_daudio_primary_service_1.0" ] defines = [ "HI_LOG_ENABLE", @@ -59,4 +57,4 @@ group("fuzztest") { testonly = true deps = [ ":DestroyRenderFuzzTest" ] } -############################################################################### \ No newline at end of file +############################################################################### diff --git a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/getalladapters_fuzzer/BUILD.gn b/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/getalladapters_fuzzer/BUILD.gn index 1db61773..af4f35ce 100644 --- a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/getalladapters_fuzzer/BUILD.gn +++ b/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/getalladapters_fuzzer/BUILD.gn @@ -43,9 +43,7 @@ ohos_fuzztest("GetAllAdaptersFuzzTest") { "${common_path}/include", ] - deps = [ - "${hdf_ser_aud_path}:libaudio_manager_daudio_primary_service_1.0", - ] + deps = [ "${hdf_ser_aud_path}:libaudio_manager_daudio_primary_service_1.0" ] external_deps = [ "hdf_core:libhdf_host" ] defines = [ "HI_LOG_ENABLE", diff --git a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/getextraparams_fuzzer/BUILD.gn b/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/getextraparams_fuzzer/BUILD.gn index ca59e377..e05732e2 100644 --- a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/getextraparams_fuzzer/BUILD.gn +++ b/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/getextraparams_fuzzer/BUILD.gn @@ -43,9 +43,7 @@ ohos_fuzztest("GetExtraParamsFuzzTest") { "${common_path}/include", ] - deps = [ - "${hdf_ser_aud_path}:libaudio_manager_daudio_primary_service_1.0", - ] + deps = [ "${hdf_ser_aud_path}:libaudio_manager_daudio_primary_service_1.0" ] defines = [ "HI_LOG_ENABLE", @@ -59,4 +57,4 @@ group("fuzztest") { testonly = true deps = [ ":GetExtraParamsFuzzTest" ] } -############################################################################### \ No newline at end of file +############################################################################### diff --git a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/loadadapter_fuzzer/BUILD.gn b/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/loadadapter_fuzzer/BUILD.gn index b829dc5a..c263c02c 100644 --- a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/loadadapter_fuzzer/BUILD.gn +++ b/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/loadadapter_fuzzer/BUILD.gn @@ -43,9 +43,7 @@ ohos_fuzztest("LoadAdapterFuzzTest") { "${common_path}/include", ] - deps = [ - "${hdf_ser_aud_path}:libaudio_manager_daudio_primary_service_1.0", - ] + deps = [ "${hdf_ser_aud_path}:libaudio_manager_daudio_primary_service_1.0" ] external_deps = [ "c_utils:utils", diff --git a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/renderframe_fuzzer/BUILD.gn b/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/renderframe_fuzzer/BUILD.gn index efaba1b2..51f8355a 100644 --- a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/renderframe_fuzzer/BUILD.gn +++ b/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/renderframe_fuzzer/BUILD.gn @@ -43,13 +43,9 @@ ohos_fuzztest("RenderFrameFuzzTest") { "${common_path}/include", ] - deps = [ - "${hdf_ser_aud_path}:libaudio_manager_daudio_primary_service_1.0", - ] + deps = [ "${hdf_ser_aud_path}:libaudio_manager_daudio_primary_service_1.0" ] - external_deps = [ - "c_utils:utils", - ] + external_deps = [ "c_utils:utils" ] defines = [ "HI_LOG_ENABLE", @@ -63,4 +59,4 @@ group("fuzztest") { testonly = true deps = [ ":RenderFrameFuzzTest" ] } -############################################################################### \ No newline at end of file +############################################################################### diff --git a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/setextraparams_fuzzer/BUILD.gn b/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/setextraparams_fuzzer/BUILD.gn index ff13840f..ff9a2b26 100644 --- a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/setextraparams_fuzzer/BUILD.gn +++ b/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/setextraparams_fuzzer/BUILD.gn @@ -43,9 +43,7 @@ ohos_fuzztest("SetExtraParamsFuzzTest") { "${common_path}/include", ] - deps = [ - "${hdf_ser_aud_path}:libaudio_manager_daudio_primary_service_1.0", - ] + deps = [ "${hdf_ser_aud_path}:libaudio_manager_daudio_primary_service_1.0" ] defines = [ "HI_LOG_ENABLE", @@ -59,4 +57,4 @@ group("fuzztest") { testonly = true deps = [ ":SetExtraParamsFuzzTest" ] } -############################################################################### \ No newline at end of file +############################################################################### diff --git a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/unloadadapter_fuzzer/BUILD.gn b/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/unloadadapter_fuzzer/BUILD.gn index f5a0971b..b0279179 100644 --- a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/unloadadapter_fuzzer/BUILD.gn +++ b/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/unloadadapter_fuzzer/BUILD.gn @@ -43,9 +43,7 @@ ohos_fuzztest("UnloadAdapterFuzzTest") { "${common_path}/include", ] - deps = [ - "${hdf_ser_aud_path}:libaudio_manager_daudio_primary_service_1.0", - ] + deps = [ "${hdf_ser_aud_path}:libaudio_manager_daudio_primary_service_1.0" ] external_deps = [ "hdf_core:libhdf_host" ] defines = [ "HI_LOG_ENABLE", diff --git a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/audio_capture_interface/BUILD.gn b/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/audio_capture_interface/BUILD.gn index 60e6fdf0..e96d7eae 100644 --- a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/audio_capture_interface/BUILD.gn +++ b/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/audio_capture_interface/BUILD.gn @@ -47,9 +47,7 @@ ohos_unittest("HDIServiceCaptureTest") { "//third_party/googletest:gtest_main", ] - external_deps = [ - "c_utils:utils", - ] + external_deps = [ "c_utils:utils" ] } group("hdi_service_audio_capture_test") { diff --git a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/audio_capture_lowlatency/BUILD.gn b/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/audio_capture_lowlatency/BUILD.gn index 1892b8d4..e6c956d0 100644 --- a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/audio_capture_lowlatency/BUILD.gn +++ b/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/audio_capture_lowlatency/BUILD.gn @@ -47,9 +47,7 @@ ohos_unittest("HDIServiceCaptureLowlatencyTest") { "//third_party/googletest:gtest_main", ] - external_deps = [ - "c_utils:utils", - ] + external_deps = [ "c_utils:utils" ] } group("hdi_service_audio_capture_lowlatency_test") { diff --git a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/audio_render_interface/BUILD.gn b/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/audio_render_interface/BUILD.gn index b1d7f8ca..ebaa6350 100644 --- a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/audio_render_interface/BUILD.gn +++ b/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/audio_render_interface/BUILD.gn @@ -48,9 +48,7 @@ ohos_unittest("HDIServiceRenderTest") { "//third_party/googletest:gtest_main", ] - external_deps = [ - "c_utils:utils", - ] + external_deps = [ "c_utils:utils" ] } group("hdi_service_audio_render_test") { diff --git a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/audio_render_lowlatency/BUILD.gn b/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/audio_render_lowlatency/BUILD.gn index d937a21d..f015298a 100644 --- a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/audio_render_lowlatency/BUILD.gn +++ b/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/audio_render_lowlatency/BUILD.gn @@ -47,9 +47,7 @@ ohos_unittest("HDIServiceRenderLowlatencyTest") { "//third_party/googletest:gtest_main", ] - external_deps = [ - "c_utils:utils", - ] + external_deps = [ "c_utils:utils" ] } group("hdi_service_audio_render_lowlatency_test") { diff --git a/hdf_service/distributed_audio/hdi_service/audio_ext/v1_0/test/fuzztest/notifyevent_fuzzer/BUILD.gn b/hdf_service/distributed_audio/hdi_service/audio_ext/v1_0/test/fuzztest/notifyevent_fuzzer/BUILD.gn index 67788145..b636acd4 100644 --- a/hdf_service/distributed_audio/hdi_service/audio_ext/v1_0/test/fuzztest/notifyevent_fuzzer/BUILD.gn +++ b/hdf_service/distributed_audio/hdi_service/audio_ext/v1_0/test/fuzztest/notifyevent_fuzzer/BUILD.gn @@ -45,8 +45,8 @@ ohos_fuzztest("NotifyEventFuzzTest") { ] deps = [ - "${hdf_ser_aud_ext_path}:libdaudio_manager_daudio_ext_service_1.0", "${hdf_interfaces_path}/audioext/v1_0:libdaudioext_stub_1.0", + "${hdf_ser_aud_ext_path}:libdaudio_manager_daudio_ext_service_1.0", ] external_deps = [ diff --git a/hdf_service/distributed_audio/hdi_service/audio_ext/v1_0/test/fuzztest/registeraudiodevice_fuzzer/BUILD.gn b/hdf_service/distributed_audio/hdi_service/audio_ext/v1_0/test/fuzztest/registeraudiodevice_fuzzer/BUILD.gn index 36c34cc7..601f57d9 100644 --- a/hdf_service/distributed_audio/hdi_service/audio_ext/v1_0/test/fuzztest/registeraudiodevice_fuzzer/BUILD.gn +++ b/hdf_service/distributed_audio/hdi_service/audio_ext/v1_0/test/fuzztest/registeraudiodevice_fuzzer/BUILD.gn @@ -20,7 +20,8 @@ import( ##############################fuzztest########################################## ohos_fuzztest("RegisterAudioDeviceFuzzTest") { module_out_path = "distributed_audio/registeraudiodevice_fuzzer" - fuzz_config_file = "${hdf_ser_aud_ext_path}/test/fuzztest/registeraudiodevice_fuzzer" + fuzz_config_file = + "${hdf_ser_aud_ext_path}/test/fuzztest/registeraudiodevice_fuzzer" cflags = [ "-g", @@ -45,8 +46,8 @@ ohos_fuzztest("RegisterAudioDeviceFuzzTest") { ] deps = [ - "${hdf_ser_aud_ext_path}:libdaudio_manager_daudio_ext_service_1.0", "${hdf_interfaces_path}/audioext/v1_0:libdaudioext_stub_1.0", + "${hdf_ser_aud_ext_path}:libdaudio_manager_daudio_ext_service_1.0", ] external_deps = [ diff --git a/hdf_service/distributed_audio/hdi_service/audio_ext/v1_0/test/fuzztest/unregisteraudiodevice_fuzzer/BUILD.gn b/hdf_service/distributed_audio/hdi_service/audio_ext/v1_0/test/fuzztest/unregisteraudiodevice_fuzzer/BUILD.gn index 3a200ee5..2b390313 100644 --- a/hdf_service/distributed_audio/hdi_service/audio_ext/v1_0/test/fuzztest/unregisteraudiodevice_fuzzer/BUILD.gn +++ b/hdf_service/distributed_audio/hdi_service/audio_ext/v1_0/test/fuzztest/unregisteraudiodevice_fuzzer/BUILD.gn @@ -20,7 +20,8 @@ import( ##############################fuzztest########################################## ohos_fuzztest("UnRegisterAudioDeviceFuzzTest") { module_out_path = "distributed_audio/unregisteraudiodevice_fuzzer" - fuzz_config_file = "${hdf_ser_aud_ext_path}/test/fuzztest/unregisteraudiodevice_fuzzer" + fuzz_config_file = + "${hdf_ser_aud_ext_path}/test/fuzztest/unregisteraudiodevice_fuzzer" cflags = [ "-g", @@ -45,8 +46,8 @@ ohos_fuzztest("UnRegisterAudioDeviceFuzzTest") { ] deps = [ - "${hdf_ser_aud_ext_path}:libdaudio_manager_daudio_ext_service_1.0", "${hdf_interfaces_path}/audioext/v1_0:libdaudioext_stub_1.0", + "${hdf_ser_aud_ext_path}:libdaudio_manager_daudio_ext_service_1.0", ] external_deps = [ diff --git a/hdf_service/distributed_audio/mfc_test/BUILD.gn b/hdf_service/distributed_audio/mfc_test/BUILD.gn index e89b2d1f..f2732b6c 100644 --- a/hdf_service/distributed_audio/mfc_test/BUILD.gn +++ b/hdf_service/distributed_audio/mfc_test/BUILD.gn @@ -23,9 +23,7 @@ ohos_executable("audio_test_distributed_fifo") { "//foundation/distributedhardware/distributed_audio/hdf_service/distributed_audio/hdi_service/common/include", ] - sources = [ - "distributedaudiotest.cpp", - ] + sources = [ "distributedaudiotest.cpp" ] deps = [ "$hdf_uhdf_path/utils:libhdf_utils", @@ -35,7 +33,7 @@ ohos_executable("audio_test_distributed_fifo") { external_deps = [ "c_utils:utils", "hiviewdfx_hilog_native:libhilog", -] + ] defines = [ "HI_LOG_ENABLE", @@ -47,4 +45,4 @@ ohos_executable("audio_test_distributed_fifo") { install_images = [ chipset_base_dir ] subsystem_name = "distributedhardware" part_name = "distributed_audio" -} \ No newline at end of file +} diff --git a/interfaces/inner_kits/native_cpp/audio_sink/BUILD.gn b/interfaces/inner_kits/native_cpp/audio_sink/BUILD.gn index 8128726b..57c67d93 100755 --- a/interfaces/inner_kits/native_cpp/audio_sink/BUILD.gn +++ b/interfaces/inner_kits/native_cpp/audio_sink/BUILD.gn @@ -37,7 +37,7 @@ ohos_shared_library("distributed_audio_sink_sdk") { "src/daudio_sink_proxy.cpp", ] - deps = [ "${services_path}/common:distributed_audio_utils", ] + deps = [ "${services_path}/common:distributed_audio_utils" ] external_deps = [ "c_utils:utils", diff --git a/interfaces/inner_kits/native_cpp/audio_source/BUILD.gn b/interfaces/inner_kits/native_cpp/audio_source/BUILD.gn index 86999a07..9eb731ad 100755 --- a/interfaces/inner_kits/native_cpp/audio_source/BUILD.gn +++ b/interfaces/inner_kits/native_cpp/audio_source/BUILD.gn @@ -39,7 +39,7 @@ ohos_shared_library("distributed_audio_source_sdk") { "src/daudio_source_proxy.cpp", ] - deps = [ "${services_path}/common:distributed_audio_utils", ] + deps = [ "${services_path}/common:distributed_audio_utils" ] external_deps = [ "c_utils:utils", diff --git a/interfaces/inner_kits/native_cpp/test/fuzztest/BUILD.gn b/interfaces/inner_kits/native_cpp/test/fuzztest/BUILD.gn index f45625a7..96b639ae 100644 --- a/interfaces/inner_kits/native_cpp/test/fuzztest/BUILD.gn +++ b/interfaces/inner_kits/native_cpp/test/fuzztest/BUILD.gn @@ -20,6 +20,20 @@ group("fuzztest") { testonly = true deps = [ + "${hdf_ser_aud_ext_path}/test/fuzztest/notifyevent_fuzzer:fuzztest", + "${hdf_ser_aud_ext_path}/test/fuzztest/registeraudiodevice_fuzzer:fuzztest", + "${hdf_ser_aud_ext_path}/test/fuzztest/unregisteraudiodevice_fuzzer:fuzztest", + "${hdf_ser_aud_path}/test/fuzztest/captureframe_fuzzer:fuzztest", + "${hdf_ser_aud_path}/test/fuzztest/createcapture_fuzzer:fuzztest", + "${hdf_ser_aud_path}/test/fuzztest/createrender_fuzzer:fuzztest", + "${hdf_ser_aud_path}/test/fuzztest/destroycapture_fuzzer:fuzztest", + "${hdf_ser_aud_path}/test/fuzztest/destroyrender_fuzzer:fuzztest", + "${hdf_ser_aud_path}/test/fuzztest/getalladapters_fuzzer:fuzztest", + "${hdf_ser_aud_path}/test/fuzztest/getextraparams_fuzzer:fuzztest", + "${hdf_ser_aud_path}/test/fuzztest/loadadapter_fuzzer:fuzztest", + "${hdf_ser_aud_path}/test/fuzztest/renderframe_fuzzer:fuzztest", + "${hdf_ser_aud_path}/test/fuzztest/setextraparams_fuzzer:fuzztest", + "${hdf_ser_aud_path}/test/fuzztest/unloadadapter_fuzzer:fuzztest", "onremotesinksvrdied_fuzzer:fuzztest", "onremotesourcesvrdied_fuzzer:fuzztest", "sinkhandlerfinishstartsa_fuzzer:fuzztest", @@ -46,19 +60,5 @@ group("fuzztest") { "sourceproxyinitsource_fuzzer:fuzztest", "sourceproxyregisterdistributedhardware_fuzzer:fuzztest", "sourceproxyunregisterdistributedhardware_fuzzer:fuzztest", - "${hdf_ser_aud_ext_path}/test/fuzztest/notifyevent_fuzzer:fuzztest", - "${hdf_ser_aud_ext_path}/test/fuzztest/unregisteraudiodevice_fuzzer:fuzztest", - "${hdf_ser_aud_ext_path}/test/fuzztest/registeraudiodevice_fuzzer:fuzztest", - "${hdf_ser_aud_path}/test/fuzztest/captureframe_fuzzer:fuzztest", - "${hdf_ser_aud_path}/test/fuzztest/getalladapters_fuzzer:fuzztest", - "${hdf_ser_aud_path}/test/fuzztest/loadadapter_fuzzer:fuzztest", - "${hdf_ser_aud_path}/test/fuzztest/unloadadapter_fuzzer:fuzztest", - "${hdf_ser_aud_path}/test/fuzztest/renderframe_fuzzer:fuzztest", - "${hdf_ser_aud_path}/test/fuzztest/createrender_fuzzer:fuzztest", - "${hdf_ser_aud_path}/test/fuzztest/destroycapture_fuzzer:fuzztest", - "${hdf_ser_aud_path}/test/fuzztest/destroyrender_fuzzer:fuzztest", - "${hdf_ser_aud_path}/test/fuzztest/createcapture_fuzzer:fuzztest", - "${hdf_ser_aud_path}/test/fuzztest/setextraparams_fuzzer:fuzztest", - "${hdf_ser_aud_path}/test/fuzztest/getextraparams_fuzzer:fuzztest", ] } diff --git a/interfaces/inner_kits/native_cpp/test/fuzztest/onremotesinksvrdied_fuzzer/BUILD.gn b/interfaces/inner_kits/native_cpp/test/fuzztest/onremotesinksvrdied_fuzzer/BUILD.gn index 0af18d3d..8b5383b1 100755 --- a/interfaces/inner_kits/native_cpp/test/fuzztest/onremotesinksvrdied_fuzzer/BUILD.gn +++ b/interfaces/inner_kits/native_cpp/test/fuzztest/onremotesinksvrdied_fuzzer/BUILD.gn @@ -47,9 +47,8 @@ ohos_fuzztest("OnRemoteSinkSvrDiedFuzzTest") { "${innerkits_path}/native_cpp/audio_sink/include", ] - deps = [ - "${innerkits_path}/native_cpp/audio_sink:distributed_audio_sink_sdk", - ] + deps = + [ "${innerkits_path}/native_cpp/audio_sink:distributed_audio_sink_sdk" ] defines = [ "HI_LOG_ENABLE", diff --git a/interfaces/inner_kits/native_cpp/test/fuzztest/sinkhandlerfinishstartsa_fuzzer/BUILD.gn b/interfaces/inner_kits/native_cpp/test/fuzztest/sinkhandlerfinishstartsa_fuzzer/BUILD.gn index fc41aa42..fb782d02 100755 --- a/interfaces/inner_kits/native_cpp/test/fuzztest/sinkhandlerfinishstartsa_fuzzer/BUILD.gn +++ b/interfaces/inner_kits/native_cpp/test/fuzztest/sinkhandlerfinishstartsa_fuzzer/BUILD.gn @@ -46,9 +46,8 @@ ohos_fuzztest("SinkHandlerFinishStartSAFuzzTest") { "${innerkits_path}/native_cpp/audio_sink/include", ] - deps = [ - "${innerkits_path}/native_cpp/audio_sink:distributed_audio_sink_sdk", - ] + deps = + [ "${innerkits_path}/native_cpp/audio_sink:distributed_audio_sink_sdk" ] defines = [ "HI_LOG_ENABLE", diff --git a/interfaces/inner_kits/native_cpp/test/fuzztest/sinkhandlerinitsink_fuzzer/BUILD.gn b/interfaces/inner_kits/native_cpp/test/fuzztest/sinkhandlerinitsink_fuzzer/BUILD.gn index b7ad6bfb..ce603e6e 100755 --- a/interfaces/inner_kits/native_cpp/test/fuzztest/sinkhandlerinitsink_fuzzer/BUILD.gn +++ b/interfaces/inner_kits/native_cpp/test/fuzztest/sinkhandlerinitsink_fuzzer/BUILD.gn @@ -47,9 +47,8 @@ ohos_fuzztest("SinkHandlerInitSinkFuzzTest") { "${innerkits_path}/native_cpp/audio_sink/include", ] - deps = [ - "${innerkits_path}/native_cpp/audio_sink:distributed_audio_sink_sdk", - ] + deps = + [ "${innerkits_path}/native_cpp/audio_sink:distributed_audio_sink_sdk" ] defines = [ "HI_LOG_ENABLE", diff --git a/interfaces/inner_kits/native_cpp/test/fuzztest/sinkhandlersubscribelocalhardware_fuzzer/BUILD.gn b/interfaces/inner_kits/native_cpp/test/fuzztest/sinkhandlersubscribelocalhardware_fuzzer/BUILD.gn index 69a28ce9..33818772 100755 --- a/interfaces/inner_kits/native_cpp/test/fuzztest/sinkhandlersubscribelocalhardware_fuzzer/BUILD.gn +++ b/interfaces/inner_kits/native_cpp/test/fuzztest/sinkhandlersubscribelocalhardware_fuzzer/BUILD.gn @@ -46,9 +46,8 @@ ohos_fuzztest("SinkHandlerSubscribeLocalHardwareFuzzTest") { "${innerkits_path}/native_cpp/audio_sink/include", ] - deps = [ - "${innerkits_path}/native_cpp/audio_sink:distributed_audio_sink_sdk", - ] + deps = + [ "${innerkits_path}/native_cpp/audio_sink:distributed_audio_sink_sdk" ] defines = [ "HI_LOG_ENABLE", diff --git a/interfaces/inner_kits/native_cpp/test/fuzztest/sinkhandlerunsubscribelocalhardware_fuzzer/BUILD.gn b/interfaces/inner_kits/native_cpp/test/fuzztest/sinkhandlerunsubscribelocalhardware_fuzzer/BUILD.gn index 74ed9ffe..101d6c04 100755 --- a/interfaces/inner_kits/native_cpp/test/fuzztest/sinkhandlerunsubscribelocalhardware_fuzzer/BUILD.gn +++ b/interfaces/inner_kits/native_cpp/test/fuzztest/sinkhandlerunsubscribelocalhardware_fuzzer/BUILD.gn @@ -46,9 +46,8 @@ ohos_fuzztest("SinkHandlerUnsubscribeLocalHardwareFuzzTest") { "${innerkits_path}/native_cpp/audio_sink/include", ] - deps = [ - "${innerkits_path}/native_cpp/audio_sink:distributed_audio_sink_sdk", - ] + deps = + [ "${innerkits_path}/native_cpp/audio_sink:distributed_audio_sink_sdk" ] defines = [ "HI_LOG_ENABLE", diff --git a/interfaces/inner_kits/native_cpp/test/fuzztest/sinkonloadsystemabilityfail_fuzzer/BUILD.gn b/interfaces/inner_kits/native_cpp/test/fuzztest/sinkonloadsystemabilityfail_fuzzer/BUILD.gn index 999aa237..219c0063 100755 --- a/interfaces/inner_kits/native_cpp/test/fuzztest/sinkonloadsystemabilityfail_fuzzer/BUILD.gn +++ b/interfaces/inner_kits/native_cpp/test/fuzztest/sinkonloadsystemabilityfail_fuzzer/BUILD.gn @@ -45,9 +45,8 @@ ohos_fuzztest("SinkOnLoadSystemAbilityFailFuzzTest") { "${innerkits_path}/native_cpp/audio_sink/include", ] - deps = [ - "${innerkits_path}/native_cpp/audio_sink:distributed_audio_sink_sdk", - ] + deps = + [ "${innerkits_path}/native_cpp/audio_sink:distributed_audio_sink_sdk" ] defines = [ "HI_LOG_ENABLE", diff --git a/interfaces/inner_kits/native_cpp/test/fuzztest/sinkonloadsystemabilitysuccess_fuzzer/BUILD.gn b/interfaces/inner_kits/native_cpp/test/fuzztest/sinkonloadsystemabilitysuccess_fuzzer/BUILD.gn index 4e6e6f89..08c3f29d 100755 --- a/interfaces/inner_kits/native_cpp/test/fuzztest/sinkonloadsystemabilitysuccess_fuzzer/BUILD.gn +++ b/interfaces/inner_kits/native_cpp/test/fuzztest/sinkonloadsystemabilitysuccess_fuzzer/BUILD.gn @@ -45,9 +45,8 @@ ohos_fuzztest("SinkOnLoadSystemAbilitySuccessFuzzTest") { "${innerkits_path}/native_cpp/audio_sink/include", ] - deps = [ - "${innerkits_path}/native_cpp/audio_sink:distributed_audio_sink_sdk", - ] + deps = + [ "${innerkits_path}/native_cpp/audio_sink:distributed_audio_sink_sdk" ] defines = [ "HI_LOG_ENABLE", diff --git a/interfaces/inner_kits/native_cpp/test/fuzztest/sinkproxydaudionotify_fuzzer/BUILD.gn b/interfaces/inner_kits/native_cpp/test/fuzztest/sinkproxydaudionotify_fuzzer/BUILD.gn index ba5c0d9b..8af9740c 100755 --- a/interfaces/inner_kits/native_cpp/test/fuzztest/sinkproxydaudionotify_fuzzer/BUILD.gn +++ b/interfaces/inner_kits/native_cpp/test/fuzztest/sinkproxydaudionotify_fuzzer/BUILD.gn @@ -46,9 +46,8 @@ ohos_fuzztest("SinkProxyDAudioNotifyFuzzTest") { "${innerkits_path}/native_cpp/audio_sink/include", ] - deps = [ - "${innerkits_path}/native_cpp/audio_sink:distributed_audio_sink_sdk", - ] + deps = + [ "${innerkits_path}/native_cpp/audio_sink:distributed_audio_sink_sdk" ] defines = [ "HI_LOG_ENABLE", diff --git a/interfaces/inner_kits/native_cpp/test/fuzztest/sinkproxyinitsink_fuzzer/BUILD.gn b/interfaces/inner_kits/native_cpp/test/fuzztest/sinkproxyinitsink_fuzzer/BUILD.gn index 0fabb6ba..a3c4e6c7 100755 --- a/interfaces/inner_kits/native_cpp/test/fuzztest/sinkproxyinitsink_fuzzer/BUILD.gn +++ b/interfaces/inner_kits/native_cpp/test/fuzztest/sinkproxyinitsink_fuzzer/BUILD.gn @@ -46,9 +46,8 @@ ohos_fuzztest("SinkProxyInitSinkFuzzTest") { "${innerkits_path}/native_cpp/audio_sink/include", ] - deps = [ - "${innerkits_path}/native_cpp/audio_sink:distributed_audio_sink_sdk", - ] + deps = + [ "${innerkits_path}/native_cpp/audio_sink:distributed_audio_sink_sdk" ] defines = [ "HI_LOG_ENABLE", diff --git a/interfaces/inner_kits/native_cpp/test/fuzztest/sinkproxysubscribelocalhardware_fuzzer/BUILD.gn b/interfaces/inner_kits/native_cpp/test/fuzztest/sinkproxysubscribelocalhardware_fuzzer/BUILD.gn index 04558eb1..7309a909 100755 --- a/interfaces/inner_kits/native_cpp/test/fuzztest/sinkproxysubscribelocalhardware_fuzzer/BUILD.gn +++ b/interfaces/inner_kits/native_cpp/test/fuzztest/sinkproxysubscribelocalhardware_fuzzer/BUILD.gn @@ -45,9 +45,8 @@ ohos_fuzztest("SinkProxySubscribeLocalHardwareFuzzTest") { "${innerkits_path}/native_cpp/audio_sink/include", ] - deps = [ - "${innerkits_path}/native_cpp/audio_sink:distributed_audio_sink_sdk", - ] + deps = + [ "${innerkits_path}/native_cpp/audio_sink:distributed_audio_sink_sdk" ] defines = [ "HI_LOG_ENABLE", diff --git a/interfaces/inner_kits/native_cpp/test/fuzztest/sinkproxyunsubscribelocalhardware_fuzzer/BUILD.gn b/interfaces/inner_kits/native_cpp/test/fuzztest/sinkproxyunsubscribelocalhardware_fuzzer/BUILD.gn index 70d513f6..e5dc3c4e 100755 --- a/interfaces/inner_kits/native_cpp/test/fuzztest/sinkproxyunsubscribelocalhardware_fuzzer/BUILD.gn +++ b/interfaces/inner_kits/native_cpp/test/fuzztest/sinkproxyunsubscribelocalhardware_fuzzer/BUILD.gn @@ -45,9 +45,8 @@ ohos_fuzztest("SinkProxyUnsubscribeLocalHardwareFuzzTest") { "${innerkits_path}/native_cpp/audio_sink/include", ] - deps = [ - "${innerkits_path}/native_cpp/audio_sink:distributed_audio_sink_sdk", - ] + deps = + [ "${innerkits_path}/native_cpp/audio_sink:distributed_audio_sink_sdk" ] defines = [ "HI_LOG_ENABLE", diff --git a/interfaces/inner_kits/native_cpp/test/fuzztest/sourcehandlerregisterdistributedhardware_fuzzer/BUILD.gn b/interfaces/inner_kits/native_cpp/test/fuzztest/sourcehandlerregisterdistributedhardware_fuzzer/BUILD.gn index 416fdaec..0745818e 100755 --- a/interfaces/inner_kits/native_cpp/test/fuzztest/sourcehandlerregisterdistributedhardware_fuzzer/BUILD.gn +++ b/interfaces/inner_kits/native_cpp/test/fuzztest/sourcehandlerregisterdistributedhardware_fuzzer/BUILD.gn @@ -38,7 +38,6 @@ ohos_fuzztest("SourceHandlerRegisterDistributedHardwareFuzzTest") { "${fwk_common_path}/log/include", "${fwk_common_path}/utils/include", "//foundation/communication/ipc/interfaces/innerkits/ipc_core/include", - ] include_dirs += [ diff --git a/interfaces/inner_kits/native_cpp/test/unittest/BUILD.gn b/interfaces/inner_kits/native_cpp/test/unittest/BUILD.gn index e693f9da..e4de8336 100644 --- a/interfaces/inner_kits/native_cpp/test/unittest/BUILD.gn +++ b/interfaces/inner_kits/native_cpp/test/unittest/BUILD.gn @@ -19,19 +19,19 @@ import( group("unittest") { testonly = true deps = [ + "${distributedaudio_path}/audiohandler/test/unittest:audio_handler_test", + "${hdf_service_path}/hdi_service/audio/v1_0/test/unittest:hdi_service_audio_test", + "${hdf_service_path}/hdi_service/audio_ext/v1_0/test/unittest:hdi_service_audio_ext_test", "${interfaces_path}/inner_kits/native_cpp/test/unittest/audiosinktest:audio_sink_test", "${interfaces_path}/inner_kits/native_cpp/test/unittest/audiosourcetest:audio_source_test", - "${distributedaudio_path}/audiohandler/test/unittest:audio_handler_test", "${services_path}/audioclient/test/unittest:daudio_client_test", "${services_path}/audiocontrol/test/unittest:daudio_control_test", "${services_path}/audiohdiproxy/test/unittest:daudio_hdi_proxy_test", + "${services_path}/audiomanager/test/unittest:daudio_manager_test", "${services_path}/audioprocessor/test/unittest:daudio_processor_test", "${services_path}/audiotransport/test/unittest:daudio_transport_test", - "${services_path}/audiomanager/test/unittest:daudio_manager_test", - "${services_path}/softbusadapter/test/unittest:audio_soft_bus_adapter_test", "${services_path}/common/taskProcessor/test/unittest:task_processor_test", "${services_path}/hdfaudioclient/test/unittest:audio_adapter_hdi_test", - "${hdf_service_path}/hdi_service/audio/v1_0/test/unittest:hdi_service_audio_test", - "${hdf_service_path}/hdi_service/audio_ext/v1_0/test/unittest:hdi_service_audio_ext_test", + "${services_path}/softbusadapter/test/unittest:audio_soft_bus_adapter_test", ] } diff --git a/interfaces/inner_kits/native_cpp/test/unittest/audiosinktest/BUILD.gn b/interfaces/inner_kits/native_cpp/test/unittest/audiosinktest/BUILD.gn index 47c6adf2..2f8d18fc 100755 --- a/interfaces/inner_kits/native_cpp/test/unittest/audiosinktest/BUILD.gn +++ b/interfaces/inner_kits/native_cpp/test/unittest/audiosinktest/BUILD.gn @@ -41,8 +41,8 @@ ohos_unittest("AudioSinkTest") { sources = [ "${interfaces_path}/inner_kits/native_cpp/test/unittest/audiosinktest/src/daudio_sink_handler_test.cpp", - "${interfaces_path}/inner_kits/native_cpp/test/unittest/audiosinktest/src/daudio_sink_proxy_test.cpp" - ] + "${interfaces_path}/inner_kits/native_cpp/test/unittest/audiosinktest/src/daudio_sink_proxy_test.cpp", + ] configs = [ ":module_private_config" ] diff --git a/services/audiocontrol/test/unittest/controlsource/BUILD.gn b/services/audiocontrol/test/unittest/controlsource/BUILD.gn index f9142d4d..9d53f54c 100644 --- a/services/audiocontrol/test/unittest/controlsource/BUILD.gn +++ b/services/audiocontrol/test/unittest/controlsource/BUILD.gn @@ -53,11 +53,11 @@ ohos_unittest("ControlSourceTest") { deps = [ "${services_path}/audiomanager/servicesource:distributed_audio_source", - "//third_party/googletest:gmock", - "//third_party/googletest:gtest_main", - "//base/security/access_token/interfaces/innerkits/token_setproc:libtoken_setproc", "//base/security/access_token/interfaces/innerkits/accesstoken:libaccesstoken_sdk", "//base/security/access_token/interfaces/innerkits/nativetoken:libnativetoken", + "//base/security/access_token/interfaces/innerkits/token_setproc:libtoken_setproc", + "//third_party/googletest:gmock", + "//third_party/googletest:gtest_main", ] } diff --git a/services/audiohdiproxy/test/unittest/daudio_hdi_handler/BUILD.gn b/services/audiohdiproxy/test/unittest/daudio_hdi_handler/BUILD.gn index 176e65f6..d4a11cc8 100644 --- a/services/audiohdiproxy/test/unittest/daudio_hdi_handler/BUILD.gn +++ b/services/audiohdiproxy/test/unittest/daudio_hdi_handler/BUILD.gn @@ -50,9 +50,7 @@ ohos_unittest("DAudioHdiHandlerTest") { "//third_party/googletest:gtest_main", ] - external_deps = [ - "c_utils:utils", - ] + external_deps = [ "c_utils:utils" ] } group("daudio_hdi_handler_test") { diff --git a/services/audiohdiproxy/test/unittest/daudio_manager_callback/BUILD.gn b/services/audiohdiproxy/test/unittest/daudio_manager_callback/BUILD.gn index ca683f5a..59470557 100644 --- a/services/audiohdiproxy/test/unittest/daudio_manager_callback/BUILD.gn +++ b/services/audiohdiproxy/test/unittest/daudio_manager_callback/BUILD.gn @@ -55,9 +55,7 @@ ohos_unittest("DAudioManagerCallbackTest") { "//third_party/googletest:gtest_main", ] - external_deps = [ - "c_utils:utils", - ] + external_deps = [ "c_utils:utils" ] } group("daudio_manager_callback_test") { diff --git a/services/audiomanager/servicesink/BUILD.gn b/services/audiomanager/servicesink/BUILD.gn index b2ed1059..4ad33c20 100755 --- a/services/audiomanager/servicesink/BUILD.gn +++ b/services/audiomanager/servicesink/BUILD.gn @@ -68,17 +68,17 @@ ohos_shared_library("distributed_audio_sink") { ] sources = [ - "src/daudio_sink_service.cpp", - "src/daudio_sink_stub.cpp", - "${audio_client_path}/spkclient/src/dspeaker_client.cpp", "${audio_client_path}/micclient/src/dmic_client.cpp", + "${audio_client_path}/spkclient/src/dspeaker_client.cpp", "${audio_control_path}/controlsink/src/daudio_sink_dev_ctrl_manager.cpp", "${innerkits_path}/native_cpp/audio_sink/src/daudio_sink_handler.cpp", - "${innerkits_path}/native_cpp/audio_sink/src/daudio_sink_proxy.cpp", "${innerkits_path}/native_cpp/audio_sink/src/daudio_sink_load_callback.cpp", + "${innerkits_path}/native_cpp/audio_sink/src/daudio_sink_proxy.cpp", "${innerkits_path}/native_cpp/audio_source/src/daudio_source_proxy.cpp", "${services_path}/audiomanager/managersink/src/daudio_sink_dev.cpp", "${services_path}/audiomanager/managersink/src/daudio_sink_manager.cpp", + "src/daudio_sink_service.cpp", + "src/daudio_sink_stub.cpp", ] deps = [ @@ -95,11 +95,11 @@ ohos_shared_library("distributed_audio_sink") { "hdf_core:libhdi", "hitrace_native:hitrace_meter", "ipc:ipc_core", - "safwk:system_ability_fwk", - "samgr:samgr_proxy", - "multimedia_audio_framework:audio_client", "multimedia_audio_framework:audio_capturer", + "multimedia_audio_framework:audio_client", "multimedia_audio_framework:audio_renderer", + "safwk:system_ability_fwk", + "samgr:samgr_proxy", ] defines = [ diff --git a/services/audiomanager/servicesource/BUILD.gn b/services/audiomanager/servicesource/BUILD.gn index 87d5e197..795ab5ce 100755 --- a/services/audiomanager/servicesource/BUILD.gn +++ b/services/audiomanager/servicesource/BUILD.gn @@ -66,9 +66,6 @@ ohos_shared_library("distributed_audio_source") { ] sources = [ - "src/daudio_ipc_callback_proxy.cpp", - "src/daudio_source_service.cpp", - "src/daudio_source_stub.cpp", "${audio_control_path}/controlsource/src/daudio_source_dev_ctrl_manager.cpp", "${audio_hdi_proxy_path}/src/daudio_hdf_operate.cpp", "${audio_hdi_proxy_path}/src/daudio_hdi_handler.cpp", @@ -81,6 +78,9 @@ ohos_shared_library("distributed_audio_source") { "${services_path}/audiomanager/managersource/src/daudio_source_mgr_callback.cpp", "${services_path}/audiomanager/managersource/src/dmic_dev.cpp", "${services_path}/audiomanager/managersource/src/dspeaker_dev.cpp", + "src/daudio_ipc_callback_proxy.cpp", + "src/daudio_source_service.cpp", + "src/daudio_source_stub.cpp", ] deps = [ @@ -89,8 +89,8 @@ ohos_shared_library("distributed_audio_source") { "${audio_transport_path}/encodetransport:distributed_audio_encode_transport", "${distributedaudio_path}/audiohandler:distributed_audio_handler", "${hdf_interfaces_path}/audioext/v1_0:libdaudioext_proxy_1.0", - "${services_path}/hdfaudioclient:daudio_client", "${services_path}/common:distributed_audio_utils", + "${services_path}/hdfaudioclient:daudio_client", ] external_deps = [ diff --git a/services/audiomanager/test/unittest/BUILD.gn b/services/audiomanager/test/unittest/BUILD.gn index 71cc54a9..ec07f3a9 100644 --- a/services/audiomanager/test/unittest/BUILD.gn +++ b/services/audiomanager/test/unittest/BUILD.gn @@ -19,12 +19,12 @@ import( group("daudio_manager_test") { testonly = true deps = [ - "${services_path}/audiomanager/test/unittest/managersink:manager_sink_test", - "${services_path}/audiomanager/test/unittest/source_device:daudio_source_dev_test", - "${services_path}/audiomanager/test/unittest/sourcemanager:daudio_source_mgr_test", "${common_path}/dfx_utils/test/unittest:DAudioDfxTest", + "${services_path}/audiomanager/test/unittest/managersink:manager_sink_test", "${services_path}/audiomanager/test/unittest/servicesink:DaudioSinkServiceTest", "${services_path}/audiomanager/test/unittest/servicesource:DaudioSourceServiceTest", + "${services_path}/audiomanager/test/unittest/source_device:daudio_source_dev_test", + "${services_path}/audiomanager/test/unittest/sourcemanager:daudio_source_mgr_test", "${services_path}/common/test/unittest/audiodata:audio_data_test", ] } diff --git a/services/audiomanager/test/unittest/managersink/BUILD.gn b/services/audiomanager/test/unittest/managersink/BUILD.gn index 9457215f..c0baa4d0 100644 --- a/services/audiomanager/test/unittest/managersink/BUILD.gn +++ b/services/audiomanager/test/unittest/managersink/BUILD.gn @@ -22,7 +22,7 @@ module_out_path = "distributed_audio/services/audiomanager/manager_sink_test" config("module_private_config") { visibility = [ ":*" ] - include_dirs = [ + include_dirs = [ "//third_party/json/include", "//foundation/multimedia/audio_framework/services/audio_service/client/include", "${audio_framework_path}/audiopolicy/include", @@ -67,31 +67,29 @@ config("module_private_config") { ohos_unittest("DaudioSinkDevTest") { module_out_path = module_out_path - sources = [ - "${services_path}/audiomanager/test/unittest/managersink/src/daudio_sink_dev_test.cpp", - ] + sources = [ "${services_path}/audiomanager/test/unittest/managersink/src/daudio_sink_dev_test.cpp" ] configs = [ ":module_private_config" ] deps = [ + "${services_path}/audiomanager/servicesink:distributed_audio_sink", "//third_party/googletest:gmock", "//third_party/googletest:gtest_main", - "${services_path}/audiomanager/servicesink:distributed_audio_sink", ] external_deps = [ "c_utils:utils", "drivers_interface_audio:libaudio_proxy_1.0", "hdf_core:libhdf_ipc_adapter", + "hdf_core:libhdf_utils", "hdf_core:libhdi", "hitrace_native:hitrace_meter", - "hdf_core:libhdf_utils", "ipc:ipc_core", - "safwk:system_ability_fwk", - "samgr:samgr_proxy", - "multimedia_audio_framework:audio_client", "multimedia_audio_framework:audio_capturer", + "multimedia_audio_framework:audio_client", "multimedia_audio_framework:audio_renderer", + "safwk:system_ability_fwk", + "samgr:samgr_proxy", ] } @@ -99,38 +97,36 @@ ohos_unittest("DaudioSinkDevTest") { ohos_unittest("DAudioSinkManagerTest") { module_out_path = module_out_path - sources = [ - "${services_path}/audiomanager/test/unittest/managersink/src/daudio_sink_manager_test.cpp", - ] + sources = [ "${services_path}/audiomanager/test/unittest/managersink/src/daudio_sink_manager_test.cpp" ] configs = [ ":module_private_config" ] deps = [ + "${services_path}/audiomanager/servicesink:distributed_audio_sink", "//third_party/googletest:gmock", "//third_party/googletest:gtest_main", - "${services_path}/audiomanager/servicesink:distributed_audio_sink", ] external_deps = [ "c_utils:utils", "drivers_interface_audio:libaudio_proxy_1.0", "hdf_core:libhdf_ipc_adapter", + "hdf_core:libhdf_utils", "hdf_core:libhdi", "hitrace_native:hitrace_meter", - "hdf_core:libhdf_utils", "ipc:ipc_core", - "safwk:system_ability_fwk", - "samgr:samgr_proxy", - "multimedia_audio_framework:audio_client", "multimedia_audio_framework:audio_capturer", + "multimedia_audio_framework:audio_client", "multimedia_audio_framework:audio_renderer", + "safwk:system_ability_fwk", + "samgr:samgr_proxy", ] } group("manager_sink_test") { testonly = true deps = [ - ":DaudioSinkDevTest", ":DAudioSinkManagerTest", + ":DaudioSinkDevTest", ] } diff --git a/services/audiomanager/test/unittest/servicesink/BUILD.gn b/services/audiomanager/test/unittest/servicesink/BUILD.gn index be48b818..c5888e5d 100644 --- a/services/audiomanager/test/unittest/servicesink/BUILD.gn +++ b/services/audiomanager/test/unittest/servicesink/BUILD.gn @@ -22,7 +22,7 @@ module_out_path = "distributed_audio/services/audiomanager/service_sink_test" config("module_private_config") { visibility = [ ":*" ] - include_dirs = [ + include_dirs = [ "//foundation/multimedia/audio_framework/services/audio_service/client/include", "${audio_framework_path}/audiopolicy/include", @@ -79,27 +79,25 @@ config("module_private_config") { ohos_unittest("DaudioSinkServiceTest") { module_out_path = module_out_path - sources = [ - "${services_path}/audiomanager/test/unittest/servicesink/src/daudio_sink_service_test.cpp", - ] + sources = [ "${services_path}/audiomanager/test/unittest/servicesink/src/daudio_sink_service_test.cpp" ] configs = [ ":module_private_config" ] deps = [ + "${services_path}/audiomanager/servicesink:distributed_audio_sink", "//third_party/googletest:gmock", "//third_party/googletest:gtest_main", - "${services_path}/audiomanager/servicesink:distributed_audio_sink", ] external_deps = [ "c_utils:utils", "hitrace_native:hitrace_meter", "ipc:ipc_core", - "safwk:system_ability_fwk", - "samgr:samgr_proxy", - "multimedia_audio_framework:audio_client", "multimedia_audio_framework:audio_capturer", + "multimedia_audio_framework:audio_client", "multimedia_audio_framework:audio_renderer", + "safwk:system_ability_fwk", + "samgr:samgr_proxy", ] } diff --git a/services/audiomanager/test/unittest/servicesource/BUILD.gn b/services/audiomanager/test/unittest/servicesource/BUILD.gn index 055058dc..c4903405 100644 --- a/services/audiomanager/test/unittest/servicesource/BUILD.gn +++ b/services/audiomanager/test/unittest/servicesource/BUILD.gn @@ -22,7 +22,7 @@ module_out_path = "distributed_audio/services/audiomanager/service_source_test" config("module_private_config") { visibility = [ ":*" ] - include_dirs = [ + include_dirs = [ "//foundation/multimedia/audio_framework/services/audio_service/client/include", "${audio_framework_path}/audiopolicy/include", @@ -89,27 +89,25 @@ config("module_private_config") { ohos_unittest("DaudioSourceServiceTest") { module_out_path = module_out_path - sources = [ - "${services_path}/audiomanager/test/unittest/servicesource/src/daudio_source_service_test.cpp", - ] + sources = [ "${services_path}/audiomanager/test/unittest/servicesource/src/daudio_source_service_test.cpp" ] configs = [ ":module_private_config" ] deps = [ + "${services_path}/audiomanager/servicesource:distributed_audio_source", "//third_party/googletest:gmock", "//third_party/googletest:gtest_main", - "${services_path}/audiomanager/servicesource:distributed_audio_source", ] external_deps = [ "c_utils:utils", "hitrace_native:hitrace_meter", "ipc:ipc_core", - "safwk:system_ability_fwk", - "samgr:samgr_proxy", - "multimedia_audio_framework:audio_client", "multimedia_audio_framework:audio_capturer", + "multimedia_audio_framework:audio_client", "multimedia_audio_framework:audio_renderer", + "safwk:system_ability_fwk", + "samgr:samgr_proxy", ] } diff --git a/services/audiomanager/test/unittest/source_device/BUILD.gn b/services/audiomanager/test/unittest/source_device/BUILD.gn index 67a6422c..f081a21d 100644 --- a/services/audiomanager/test/unittest/source_device/BUILD.gn +++ b/services/audiomanager/test/unittest/source_device/BUILD.gn @@ -15,8 +15,7 @@ import("//build/test.gni") import( "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") -module_out_path = - "distributed_audio/services/audiomanager/source_device_test" +module_out_path = "distributed_audio/services/audiomanager/source_device_test" config("module_private_config") { visibility = [ ":*" ] @@ -75,8 +74,8 @@ ohos_unittest("DaudioSourceDevTest") { configs = [ ":module_private_config" ] deps = [ - "${services_path}/audiomanager/servicesource:distributed_audio_source", "${hdf_interfaces_path}/audioext/v1_0:libdaudioext_proxy_1.0", + "${services_path}/audiomanager/servicesource:distributed_audio_source", "//third_party/googletest:gmock", "//third_party/googletest:gtest_main", ] @@ -92,8 +91,8 @@ ohos_unittest("DMicDevTest") { deps = [ "${audio_transport_path}/decodetransport:distributed_audio_decode_transport", - "${services_path}/audiomanager/servicesource:distributed_audio_source", "${hdf_interfaces_path}/audioext/v1_0:libdaudioext_proxy_1.0", + "${services_path}/audiomanager/servicesource:distributed_audio_source", "//third_party/googletest:gmock", "//third_party/googletest:gtest_main", ] @@ -109,8 +108,8 @@ ohos_unittest("DSpeakerDevTest") { deps = [ "${audio_transport_path}/encodetransport:distributed_audio_encode_transport", - "${services_path}/audiomanager/servicesource:distributed_audio_source", "${hdf_interfaces_path}/audioext/v1_0:libdaudioext_proxy_1.0", + "${services_path}/audiomanager/servicesource:distributed_audio_source", "//third_party/googletest:gmock", "//third_party/googletest:gtest_main", ] @@ -118,9 +117,9 @@ ohos_unittest("DSpeakerDevTest") { group("daudio_source_dev_test") { testonly = true - deps = [ - ":DaudioSourceDevTest", + deps = [ ":DMicDevTest", ":DSpeakerDevTest", + ":DaudioSourceDevTest", ] } diff --git a/services/audiomanager/test/unittest/sourcemanager/BUILD.gn b/services/audiomanager/test/unittest/sourcemanager/BUILD.gn index cebcf389..865db41c 100644 --- a/services/audiomanager/test/unittest/sourcemanager/BUILD.gn +++ b/services/audiomanager/test/unittest/sourcemanager/BUILD.gn @@ -15,8 +15,7 @@ import("//build/test.gni") import( "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") -module_out_path = - "distributed_audio/services/audiomanager/source_manager_test" +module_out_path = "distributed_audio/services/audiomanager/source_manager_test" config("module_private_config") { visibility = [ ":*" ] diff --git a/services/audioprocessor/effectcomponent/BUILD.gn b/services/audioprocessor/effectcomponent/BUILD.gn index 21fc2663..e0d890bf 100644 --- a/services/audioprocessor/effectcomponent/BUILD.gn +++ b/services/audioprocessor/effectcomponent/BUILD.gn @@ -13,10 +13,10 @@ import("//build/ohos.gni") import("//build/ohos_var.gni") -import("//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import( + "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") -ohos_shared_library("daudio_effect_component") -{ +ohos_shared_library("daudio_effect_component") { include_dirs = [ "./audiopipeline/include", "./pipelinemanager/include", @@ -29,18 +29,16 @@ ohos_shared_library("daudio_effect_component") sources = [ "${services_path}/audioprocessor/effectcomponent/audiopipeline/src/pipeline_impl.cpp", - "${services_path}/audioprocessor/effectcomponent/pipelinemanager/src/pipeline_manager.cpp", "${services_path}/audioprocessor/effectcomponent/element_factoy/src/element_factory.cpp", "${services_path}/audioprocessor/effectcomponent/elements/src/down_stream_element.cpp", "${services_path}/audioprocessor/effectcomponent/elements/src/render_sink_element.cpp", "${services_path}/audioprocessor/effectcomponent/elements/src/source_element.cpp", + "${services_path}/audioprocessor/effectcomponent/pipelinemanager/src/pipeline_manager.cpp", ] - deps = [ "${services_path}/common:distributed_audio_utils", ] + deps = [ "${services_path}/common:distributed_audio_utils" ] - external_deps = [ - "c_utils:utils", - ] + external_deps = [ "c_utils:utils" ] defines = [ "HI_LOG_ENABLE", diff --git a/services/audiotransport/audioctrltransport/BUILD.gn b/services/audiotransport/audioctrltransport/BUILD.gn index 3b56c31f..1cc7e557 100644 --- a/services/audiotransport/audioctrltransport/BUILD.gn +++ b/services/audiotransport/audioctrltransport/BUILD.gn @@ -37,9 +37,9 @@ ohos_shared_library("distributed_audio_control") { "${audio_transport_path}/audiochannel/audioctrlchannel/include", ] - sources = [ - "src/audio_ctrl_transport.cpp", + sources = [ "${audio_transport_path}/audiochannel/audioctrlchannel/src/audio_ctrl_channel.cpp", + "src/audio_ctrl_transport.cpp", ] deps = [ diff --git a/services/audiotransport/audiotransportstatus/BUILD.gn b/services/audiotransport/audiotransportstatus/BUILD.gn index 9678df29..b99fc76c 100644 --- a/services/audiotransport/audiotransportstatus/BUILD.gn +++ b/services/audiotransport/audiotransportstatus/BUILD.gn @@ -1,73 +1,73 @@ -# Copyright (c) 2022 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and # limitations under the License. - -import("//build/ohos.gni") -import("//build/ohos_var.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") - -ohos_shared_library("distributed_audio_transport_status") { - include_dirs = [ - "//base/hiviewdfx/hisysevent/interfaces/native/innerkits/hisysevent/include", - "//base/hiviewdfx/hitrace/interfaces/native/innerkits/include/hitrace_meter", - "//foundation/communication/dsoftbus/interfaces/kits/transport", - "${fwk_common_path}/utils/include", - "${mediastandard_path}/interfaces/innerkits/native/media/include", - "${mediastandardfwk_path}/audiocommon/include", - "//third_party/json/include", - ] - - include_dirs += [ - "include", - "interface", - "${common_path}/include", - "${audio_processor_path}/decoder/include", - "${audio_processor_path}/decodeprocessor/include", - "${audio_processor_path}/interface", - "${audio_transport_path}/audiochannel/interface", - "${audio_transport_path}/audiochannel/audiodatachannel/include", - "${audio_transport_path}/audiotransportstatus/include", - "${audio_transport_path}/audiotransportstatus/interface", - "${audio_transport_path}/audiotransportstatus/interface", - "${services_path}/common/audioparam", - "${services_path}/common/audiodata/include", - ] - - sources = [ - "${audio_transport_path}/audiotransportstatus/src/audio_transport_context.cpp", - "${audio_transport_path}/audiotransportstatus/src/audio_transport_pause_status.cpp", - "${audio_transport_path}/audiotransportstatus/src/audio_transport_start_status.cpp", - "${audio_transport_path}/audiotransportstatus/src/audio_transport_status_factory.cpp", - "${audio_transport_path}/audiotransportstatus/src/audio_transport_stop_status.cpp", - ] - - deps = [ - "${audio_transport_path}/audiochannel/audiodatachannel:distributed_audio_data_channel", - "${services_path}/common:distributed_audio_utils", - ] - - external_deps = [ - "c_utils:utils", - "hitrace_native:hitrace_meter", - "multimedia_player_framework:media_client", - ] - - defines = [ - "HI_LOG_ENABLE", - "LOG_DOMAIN=0xD004100", - ] - - subsystem_name = "distributedhardware" - - part_name = "distributed_audio" -} + +import("//build/ohos.gni") +import("//build/ohos_var.gni") +import( + "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") + +ohos_shared_library("distributed_audio_transport_status") { + include_dirs = [ + "//base/hiviewdfx/hisysevent/interfaces/native/innerkits/hisysevent/include", + "//base/hiviewdfx/hitrace/interfaces/native/innerkits/include/hitrace_meter", + "//foundation/communication/dsoftbus/interfaces/kits/transport", + "${fwk_common_path}/utils/include", + "${mediastandard_path}/interfaces/innerkits/native/media/include", + "${mediastandardfwk_path}/audiocommon/include", + "//third_party/json/include", + ] + + include_dirs += [ + "include", + "interface", + "${common_path}/include", + "${audio_processor_path}/decoder/include", + "${audio_processor_path}/decodeprocessor/include", + "${audio_processor_path}/interface", + "${audio_transport_path}/audiochannel/interface", + "${audio_transport_path}/audiochannel/audiodatachannel/include", + "${audio_transport_path}/audiotransportstatus/include", + "${audio_transport_path}/audiotransportstatus/interface", + "${audio_transport_path}/audiotransportstatus/interface", + "${services_path}/common/audioparam", + "${services_path}/common/audiodata/include", + ] + + sources = [ + "${audio_transport_path}/audiotransportstatus/src/audio_transport_context.cpp", + "${audio_transport_path}/audiotransportstatus/src/audio_transport_pause_status.cpp", + "${audio_transport_path}/audiotransportstatus/src/audio_transport_start_status.cpp", + "${audio_transport_path}/audiotransportstatus/src/audio_transport_status_factory.cpp", + "${audio_transport_path}/audiotransportstatus/src/audio_transport_stop_status.cpp", + ] + + deps = [ + "${audio_transport_path}/audiochannel/audiodatachannel:distributed_audio_data_channel", + "${services_path}/common:distributed_audio_utils", + ] + + external_deps = [ + "c_utils:utils", + "hitrace_native:hitrace_meter", + "multimedia_player_framework:media_client", + ] + + defines = [ + "HI_LOG_ENABLE", + "LOG_DOMAIN=0xD004100", + ] + + subsystem_name = "distributedhardware" + + part_name = "distributed_audio" +} diff --git a/services/audiotransport/decodetransport/BUILD.gn b/services/audiotransport/decodetransport/BUILD.gn index fc26df0c..c56ab209 100644 --- a/services/audiotransport/decodetransport/BUILD.gn +++ b/services/audiotransport/decodetransport/BUILD.gn @@ -45,11 +45,11 @@ ohos_shared_library("distributed_audio_decode_transport") { ] sources = [ - "src/audio_decode_transport.cpp", + "${audio_processor_path}/decodeprocessor/src/audio_decoder_processor.cpp", "${audio_processor_path}/decoder/src/audio_decoder.cpp", "${audio_processor_path}/decoder/src/audio_decoder_callback.cpp", - "${audio_processor_path}/decodeprocessor/src/audio_decoder_processor.cpp", "${services_path}/common/audiodata/src/audio_data.cpp", + "src/audio_decode_transport.cpp", ] deps = [ diff --git a/services/audiotransport/encodetransport/BUILD.gn b/services/audiotransport/encodetransport/BUILD.gn index c3d399cb..d544e795 100644 --- a/services/audiotransport/encodetransport/BUILD.gn +++ b/services/audiotransport/encodetransport/BUILD.gn @@ -45,11 +45,11 @@ ohos_shared_library("distributed_audio_encode_transport") { ] sources = [ - "src/audio_encode_transport.cpp", "${audio_processor_path}/encodeprocessor/src/audio_encoder_processor.cpp", "${audio_processor_path}/encoder/src/audio_encoder.cpp", "${audio_processor_path}/encoder/src/audio_encoder_callback.cpp", "${services_path}/common/audiodata/src/audio_data.cpp", + "src/audio_encode_transport.cpp", ] deps = [ @@ -64,7 +64,6 @@ ohos_shared_library("distributed_audio_encode_transport") { "multimedia_player_framework:media_client", ] - defines = [ "HI_LOG_ENABLE", "LOG_DOMAIN=0xD004100", diff --git a/services/audiotransport/test/unittest/BUILD.gn b/services/audiotransport/test/unittest/BUILD.gn index 3b18ab01..2170f9f3 100644 --- a/services/audiotransport/test/unittest/BUILD.gn +++ b/services/audiotransport/test/unittest/BUILD.gn @@ -22,8 +22,8 @@ group("daudio_transport_test") { "${audio_transport_path}/test/unittest/audioctrlchannel:audio_ctrl_channel_test", "${audio_transport_path}/test/unittest/audioctrltransport:audio_ctrl_transport_test", "${audio_transport_path}/test/unittest/audiodatachannel:audio_data_channel_test", + "${audio_transport_path}/test/unittest/audiotransportstatus:transport_status_test", "${audio_transport_path}/test/unittest/decodetransport:decode_transport_test", "${audio_transport_path}/test/unittest/encodetransport:encode_transport_test", - "${audio_transport_path}/test/unittest/audiotransportstatus:transport_status_test", ] } diff --git a/services/audiotransport/test/unittest/audioctrlchannel/BUILD.gn b/services/audiotransport/test/unittest/audioctrlchannel/BUILD.gn index f2d152c7..99596291 100644 --- a/services/audiotransport/test/unittest/audioctrlchannel/BUILD.gn +++ b/services/audiotransport/test/unittest/audioctrlchannel/BUILD.gn @@ -50,8 +50,8 @@ ohos_unittest("AudioCtrlChannelTest") { configs = [ ":module_private_config" ] deps = [ - "${services_path}/common:distributed_audio_utils", "${audio_transport_path}/audioctrltransport:distributed_audio_control", + "${services_path}/common:distributed_audio_utils", "//third_party/googletest:gmock", "//third_party/googletest:gtest_main", ] diff --git a/services/audiotransport/test/unittest/audiotransportstatus/BUILD.gn b/services/audiotransport/test/unittest/audiotransportstatus/BUILD.gn index 4564fd4b..6529a501 100644 --- a/services/audiotransport/test/unittest/audiotransportstatus/BUILD.gn +++ b/services/audiotransport/test/unittest/audiotransportstatus/BUILD.gn @@ -1,79 +1,80 @@ -# Copyright (c) 2022 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and # limitations under the License. - -import("//build/ohos.gni") -import("//build/ohos_var.gni") -import("//build/test.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") - -module_output_path = - "distributed_audio/services/audiotransport/transport_status_test" - -config("module_private_config") { - visibility = [ ":*" ] - - include_dirs = [ - "//base/hiviewdfx/hisysevent/interfaces/native/innerkits/hisysevent/include", - "//base/hiviewdfx/hitrace/interfaces/native/innerkits/include/hitrace_meter", - "//foundation/communication/dsoftbus/interfaces/kits/transport", - "${fwk_common_path}/utils/include", - "${mediastandard_path}/interfaces/innerkits/native/media/include", - "${mediastandardfwk_path}/audiocommon/include", - "//third_party/json/include", - ] - - include_dirs += [ - "include", - "${common_path}/include", - "${audio_processor_path}/decoder/include", - "${audio_processor_path}/decodeprocessor/include", - "${audio_processor_path}/interface", - "${audio_transport_path}/audiochannel/interface", - "${audio_transport_path}/audiochannel/audiodatachannel/include", - "${audio_transport_path}/audiotransportstatus/include", - "${audio_transport_path}/audiotransportstatus/interface", - "${audio_transport_path}/test/unittest/audiotranstestutils/include", - "${services_path}/common/audioparam", - "${services_path}/common/audiodata/include", - ] -} - -ohos_unittest("TransportStatusTest") { - module_out_path = module_output_path - - sources = [ "src/audio_transport_pause_status_test.cpp", - "src/audio_transport_stop_status_test.cpp", - "src/audio_transport_start_status_test.cpp", - ] - - configs = [ ":module_private_config" ] - - deps = [ - "${audio_transport_path}/audiochannel/audiodatachannel:distributed_audio_data_channel", - "${audio_transport_path}/audiotransportstatus:distributed_audio_transport_status", - "${services_path}/common:distributed_audio_utils", - "//third_party/googletest:gtest_main", - ] - - defines = [ - "HI_LOG_ENABLE", - "DH_LOG_TAG=\"daudio_trans_test\"", - "LOG_DOMAIN=0xD004100", - ] -} - -group("transport_status_test") { - testonly = true - deps = [ ":TransportStatusTest" ] -} + +import("//build/ohos.gni") +import("//build/ohos_var.gni") +import("//build/test.gni") +import( + "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") + +module_output_path = + "distributed_audio/services/audiotransport/transport_status_test" + +config("module_private_config") { + visibility = [ ":*" ] + + include_dirs = [ + "//base/hiviewdfx/hisysevent/interfaces/native/innerkits/hisysevent/include", + "//base/hiviewdfx/hitrace/interfaces/native/innerkits/include/hitrace_meter", + "//foundation/communication/dsoftbus/interfaces/kits/transport", + "${fwk_common_path}/utils/include", + "${mediastandard_path}/interfaces/innerkits/native/media/include", + "${mediastandardfwk_path}/audiocommon/include", + "//third_party/json/include", + ] + + include_dirs += [ + "include", + "${common_path}/include", + "${audio_processor_path}/decoder/include", + "${audio_processor_path}/decodeprocessor/include", + "${audio_processor_path}/interface", + "${audio_transport_path}/audiochannel/interface", + "${audio_transport_path}/audiochannel/audiodatachannel/include", + "${audio_transport_path}/audiotransportstatus/include", + "${audio_transport_path}/audiotransportstatus/interface", + "${audio_transport_path}/test/unittest/audiotranstestutils/include", + "${services_path}/common/audioparam", + "${services_path}/common/audiodata/include", + ] +} + +ohos_unittest("TransportStatusTest") { + module_out_path = module_output_path + + sources = [ + "src/audio_transport_pause_status_test.cpp", + "src/audio_transport_start_status_test.cpp", + "src/audio_transport_stop_status_test.cpp", + ] + + configs = [ ":module_private_config" ] + + deps = [ + "${audio_transport_path}/audiochannel/audiodatachannel:distributed_audio_data_channel", + "${audio_transport_path}/audiotransportstatus:distributed_audio_transport_status", + "${services_path}/common:distributed_audio_utils", + "//third_party/googletest:gtest_main", + ] + + defines = [ + "HI_LOG_ENABLE", + "DH_LOG_TAG=\"daudio_trans_test\"", + "LOG_DOMAIN=0xD004100", + ] +} + +group("transport_status_test") { + testonly = true + deps = [ ":TransportStatusTest" ] +} diff --git a/services/audiotransport/test/unittest/encodetransport/BUILD.gn b/services/audiotransport/test/unittest/encodetransport/BUILD.gn index e3121a42..8e3984b9 100644 --- a/services/audiotransport/test/unittest/encodetransport/BUILD.gn +++ b/services/audiotransport/test/unittest/encodetransport/BUILD.gn @@ -55,8 +55,8 @@ ohos_unittest("EncodeTransportTest") { configs = [ ":module_private_config" ] deps = [ - "${audio_transport_path}/encodetransport:distributed_audio_encode_transport", "${audio_transport_path}/audiotransportstatus:distributed_audio_transport_status", + "${audio_transport_path}/encodetransport:distributed_audio_encode_transport", "${services_path}/common:distributed_audio_utils", "//third_party/googletest:gtest_main", ] diff --git a/services/common/BUILD.gn b/services/common/BUILD.gn index acdc1811..6155cf6f 100644 --- a/services/common/BUILD.gn +++ b/services/common/BUILD.gn @@ -20,7 +20,7 @@ config("daudio_common_pub_config") { include_dirs = [ "audiodata/include", "audioparam", - "${common_path}/include" + "${common_path}/include", ] } @@ -40,18 +40,18 @@ config("daudio_common_private_config") { } ohos_shared_library("distributed_audio_utils") { - configs = [":daudio_common_private_config"] + configs = [ ":daudio_common_private_config" ] - public_configs = [":daudio_common_pub_config"] + public_configs = [ ":daudio_common_pub_config" ] sources = [ - "audiodata/src/audio_data.cpp", - "taskProcessor/src/task_impl.cpp", - "taskProcessor/src/task_queue.cpp", "${common_path}/dfx_utils/src/daudio_hisysevent.cpp", "${common_path}/dfx_utils/src/daudio_hitrace.cpp", "${common_path}/src/daudio_log.cpp", "${common_path}/src/daudio_util.cpp", + "audiodata/src/audio_data.cpp", + "taskProcessor/src/task_impl.cpp", + "taskProcessor/src/task_queue.cpp", ] external_deps = [ diff --git a/services/common/taskProcessor/test/unittest/BUILD.gn b/services/common/taskProcessor/test/unittest/BUILD.gn index 295971e0..190814d0 100644 --- a/services/common/taskProcessor/test/unittest/BUILD.gn +++ b/services/common/taskProcessor/test/unittest/BUILD.gn @@ -18,7 +18,5 @@ import( group("task_processor_test") { testonly = true - deps = [ - "${services_path}/common/taskProcessor/test/unittest/task_queue:task_queue_test", - ] + deps = [ "${services_path}/common/taskProcessor/test/unittest/task_queue:task_queue_test" ] } diff --git a/services/common/taskProcessor/test/unittest/task_queue/BUILD.gn b/services/common/taskProcessor/test/unittest/task_queue/BUILD.gn index dbb9fd2e..a86914dc 100644 --- a/services/common/taskProcessor/test/unittest/task_queue/BUILD.gn +++ b/services/common/taskProcessor/test/unittest/task_queue/BUILD.gn @@ -22,7 +22,7 @@ module_out_path = "distributed_audio/services/common/taskProcessor/test" config("module_private_config") { visibility = [ ":*" ] - include_dirs = [ "//third_party/json/include", ] + include_dirs = [ "//third_party/json/include" ] include_dirs += [ "${common_path}/include", @@ -37,16 +37,14 @@ config("module_private_config") { ohos_unittest("TaskQueueTest") { module_out_path = module_out_path - sources = [ - "${services_path}/common/taskProcessor/test/unittest/task_queue/src/task_queue_test.cpp", - ] + sources = [ "${services_path}/common/taskProcessor/test/unittest/task_queue/src/task_queue_test.cpp" ] configs = [ ":module_private_config" ] deps = [ + "${services_path}/common:distributed_audio_utils", "//third_party/googletest:gmock", "//third_party/googletest:gtest_main", - "${services_path}/common:distributed_audio_utils", ] } diff --git a/services/hdfaudioclient/test/unittest/BUILD.gn b/services/hdfaudioclient/test/unittest/BUILD.gn index cbf3abc0..0d2b763f 100644 --- a/services/hdfaudioclient/test/unittest/BUILD.gn +++ b/services/hdfaudioclient/test/unittest/BUILD.gn @@ -125,15 +125,13 @@ ohos_unittest("AudioAdapterInternalTest") { sources = [ "audio_adapter_internal/audio_adapter_internal_test.cpp" ] deps = [ - "${services_path}/hdfaudioclient:daudio_client", "${hdf_interfaces_path}/audio/v1_0:libdaudio_proxy_1.0", + "${services_path}/hdfaudioclient:daudio_client", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] - external_deps = [ - "c_utils:utils", - ] + external_deps = [ "c_utils:utils" ] defines = [ "HI_LOG_ENABLE", @@ -155,8 +153,8 @@ group("audio_adapter_hdi_test") { testonly = true deps = [ ":AudioAdapterHdiTest", - ":AudioRenderInternalTest", - ":AudioCaptureInternalTest", ":AudioAdapterInternalTest", - ] + ":AudioCaptureInternalTest", + ":AudioRenderInternalTest", + ] } diff --git a/services/softbusadapter/BUILD.gn b/services/softbusadapter/BUILD.gn index 8a5815d1..f159bf0b 100644 --- a/services/softbusadapter/BUILD.gn +++ b/services/softbusadapter/BUILD.gn @@ -36,7 +36,7 @@ ohos_shared_library("distributed_audio_softbus_adapter") { "src/softbus_adapter.cpp", ] - deps = [ "${services_path}/common:distributed_audio_utils", ] + deps = [ "${services_path}/common:distributed_audio_utils" ] external_deps = [ "c_utils:utils", -- Gitee From 00f0a09b6da1f922b4b1bc5f76ba7e251d5136ae Mon Sep 17 00:00:00 2001 From: w30042960 Date: Thu, 13 Apr 2023 11:28:39 +0800 Subject: [PATCH 7/9] modify codecheck Signed-off-by: w30042960 --- common/test_utils/BUILD.gn | 52 -- common/test_utils/aec_test.cpp | 61 --- common/test_utils/aec_test.h | 38 -- common/test_utils/audio_base.cpp | 213 --------- common/test_utils/audio_base.h | 81 ---- common/test_utils/audio_buffer.cpp | 83 ---- common/test_utils/audio_buffer.h | 59 --- common/test_utils/cycle_test.cpp | 136 ------ common/test_utils/cycle_test.h | 51 -- common/test_utils/daudio_test_utils.cpp | 217 --------- common/test_utils/daudio_test_utils.h | 42 -- common/test_utils/hdf_audio.cpp | 354 -------------- common/test_utils/hdf_audio.h | 62 --- common/test_utils/local_audio.cpp | 224 --------- common/test_utils/local_audio.h | 61 --- .../include/audio_capture_lowlatency_impl.h | 102 ---- .../include/audio_render_lowlatency_impl.h | 117 ----- .../src/audio_capture_lowlatency_impl.cpp | 344 -------------- .../v1_0/src/audio_render_lowlatency_impl.cpp | 443 ------------------ .../audio_capture_lowlatency/BUILD.gn | 56 --- .../audio_capture_lowlatency_impl_test.h | 58 --- .../audio_capture_lowlatency_impl_test.cpp | 205 -------- .../unittest/audio_render_lowlatency/BUILD.gn | 56 --- .../audio_render_lowlatency_impl_test.h | 58 --- .../src/audio_render_lowlatency_impl_test.cpp | 236 ---------- .../test/unittest/controlsource/BUILD.gn | 9 +- .../audioprocessor/effectcomponent/BUILD.gn | 51 -- .../audiopipeline/include/ipipeline.h | 40 -- .../audiopipeline/include/life_cycle.h | 33 -- .../audiopipeline/include/pipeline_impl.h | 46 -- .../audiopipeline/src/pipeline_impl.cpp | 106 ----- .../element_factoy/include/element_factory.h | 43 -- .../element_factoy/src/element_factory.cpp | 48 -- .../elements/include/capture_sink_element.h | 43 -- .../elements/include/down_stream_element.h | 48 -- .../elements/include/ielement.h | 35 -- .../elements/include/render_sink_element.h | 43 -- .../elements/include/source_element.h | 43 -- .../elements/src/capture_sink_element.cpp | 127 ----- .../elements/src/down_stream_element.cpp | 36 -- .../elements/src/render_sink_element.cpp | 130 ----- .../elements/src/source_element.cpp | 128 ----- .../include/pipeline_manager.h | 51 -- .../pipelinemanager/src/pipeline_manager.cpp | 94 ---- .../include/audio_lowlatency_processor.h | 49 -- .../src/audio_lowlatency_processor.cpp | 76 --- .../audiotransportstatus/BUILD.gn | 7 +- .../unittest/audiotransportstatus/BUILD.gn | 7 +- 48 files changed, 12 insertions(+), 4690 deletions(-) delete mode 100644 common/test_utils/BUILD.gn delete mode 100644 common/test_utils/aec_test.cpp delete mode 100644 common/test_utils/aec_test.h delete mode 100644 common/test_utils/audio_base.cpp delete mode 100644 common/test_utils/audio_base.h delete mode 100644 common/test_utils/audio_buffer.cpp delete mode 100644 common/test_utils/audio_buffer.h delete mode 100644 common/test_utils/cycle_test.cpp delete mode 100644 common/test_utils/cycle_test.h delete mode 100644 common/test_utils/daudio_test_utils.cpp delete mode 100644 common/test_utils/daudio_test_utils.h delete mode 100644 common/test_utils/hdf_audio.cpp delete mode 100644 common/test_utils/hdf_audio.h delete mode 100644 common/test_utils/local_audio.cpp delete mode 100644 common/test_utils/local_audio.h delete mode 100644 hdf_service/distributed_audio/hdi_service/audio/v1_0/include/audio_capture_lowlatency_impl.h delete mode 100644 hdf_service/distributed_audio/hdi_service/audio/v1_0/include/audio_render_lowlatency_impl.h delete mode 100644 hdf_service/distributed_audio/hdi_service/audio/v1_0/src/audio_capture_lowlatency_impl.cpp delete mode 100644 hdf_service/distributed_audio/hdi_service/audio/v1_0/src/audio_render_lowlatency_impl.cpp delete mode 100644 hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/audio_capture_lowlatency/BUILD.gn delete mode 100644 hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/audio_capture_lowlatency/include/audio_capture_lowlatency_impl_test.h delete mode 100644 hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/audio_capture_lowlatency/src/audio_capture_lowlatency_impl_test.cpp delete mode 100644 hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/audio_render_lowlatency/BUILD.gn delete mode 100644 hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/audio_render_lowlatency/include/audio_render_lowlatency_impl_test.h delete mode 100644 hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/audio_render_lowlatency/src/audio_render_lowlatency_impl_test.cpp delete mode 100644 services/audioprocessor/effectcomponent/BUILD.gn delete mode 100644 services/audioprocessor/effectcomponent/audiopipeline/include/ipipeline.h delete mode 100644 services/audioprocessor/effectcomponent/audiopipeline/include/life_cycle.h delete mode 100644 services/audioprocessor/effectcomponent/audiopipeline/include/pipeline_impl.h delete mode 100644 services/audioprocessor/effectcomponent/audiopipeline/src/pipeline_impl.cpp delete mode 100644 services/audioprocessor/effectcomponent/element_factoy/include/element_factory.h delete mode 100644 services/audioprocessor/effectcomponent/element_factoy/src/element_factory.cpp delete mode 100644 services/audioprocessor/effectcomponent/elements/include/capture_sink_element.h delete mode 100644 services/audioprocessor/effectcomponent/elements/include/down_stream_element.h delete mode 100644 services/audioprocessor/effectcomponent/elements/include/ielement.h delete mode 100644 services/audioprocessor/effectcomponent/elements/include/render_sink_element.h delete mode 100644 services/audioprocessor/effectcomponent/elements/include/source_element.h delete mode 100644 services/audioprocessor/effectcomponent/elements/src/capture_sink_element.cpp delete mode 100644 services/audioprocessor/effectcomponent/elements/src/down_stream_element.cpp delete mode 100644 services/audioprocessor/effectcomponent/elements/src/render_sink_element.cpp delete mode 100644 services/audioprocessor/effectcomponent/elements/src/source_element.cpp delete mode 100644 services/audioprocessor/effectcomponent/pipelinemanager/include/pipeline_manager.h delete mode 100644 services/audioprocessor/effectcomponent/pipelinemanager/src/pipeline_manager.cpp delete mode 100644 services/audioprocessor/lowlatencyprocessor/include/audio_lowlatency_processor.h delete mode 100644 services/audioprocessor/lowlatencyprocessor/src/audio_lowlatency_processor.cpp diff --git a/common/test_utils/BUILD.gn b/common/test_utils/BUILD.gn deleted file mode 100644 index 85773b6f..00000000 --- a/common/test_utils/BUILD.gn +++ /dev/null @@ -1,52 +0,0 @@ -# Copyright (c) 2023 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import("//build/ohos.gni") -import("//build/ohos_var.gni") -import("//drivers/hdf_core/adapter/uhdf2/uhdf.gni") -import("//drivers/peripheral/adapter/base/hidl_adapter.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") - -ohos_executable("daudio_test_bin") { - include_dirs = [ - "//foundation/multimedia/audio_framework/interfaces/inner_api/native/audiocommon/include", - "//foundation/multimedia/audio_framework/frameworks/native/common/include", - "//foundation/multinedia/audio_framework/interfaces/inner_api/native/audiocapturer/include", - "${common_path}/include", - "//drivers/peripheral/audio/interfaces/include", - ] - - sources = [ - "audio_base.cpp", - "audio_buffer.cpp", - "cycle_test.cpp", - "daudio_test_utils.cpp", - "hdf_audio.cpp", - "local_audio.cpp", - ] - - deps = [ "${services_path}/common:distributed_audio_utils" ] - - external_deps = [ - "c_utils:utils", - "hdf_core:libhdf_utils", - "hiviewdfx_hilog_native:libhilog", - "multimedia_audio_framework:audio_capturer", - "multimedia_audio_framework:audio_client", - "multimedia_audio_framework:audio_renderer", - ] - - subsystem_name = "distributedhardware" - part_name = "distributed_audio" -} diff --git a/common/test_utils/aec_test.cpp b/common/test_utils/aec_test.cpp deleted file mode 100644 index 12aa736a..00000000 --- a/common/test_utils/aec_test.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "aec_test.h" - -#include -#include "daudio_errorcode.h" - -using namespace std; - -namespace OHOS { -namespace DistributedHardware { -int32_t AecTest::Init() -{ - cout << "Input file path: "; - string path; - cin >> path; - cout << endl; - - size_t pos = path.find(".pcm"); - if (pos != string::npos) { - if (render_.ReadPcmFile(path, info_) != DH_SUCCESS) { - return ERR_DH_AUDIO_FAILED; - } - } else { - cout << "File path is wrong." << endl; - return ERR_DH_AUDIO_FAILED; - } - - render_.Init(info_); - capture_.Init(info_); - return DH_SUCCESS; -} - -int32_t AecTest::Process() -{ - capture_.StartCaptureFrame(render_.GetPeriod()); - render_.StartRenderFrame(); - capture_.StopCaptureFrame(); - return DH_SUCCESS; -} - -void AecTest::Release() -{ - render_.Release(); - capture_.Release(); -} -} // namespace DistributedHardware -} // namespace OHOS \ No newline at end of file diff --git a/common/test_utils/aec_test.h b/common/test_utils/aec_test.h deleted file mode 100644 index 383327ef..00000000 --- a/common/test_utils/aec_test.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef OHOS_AEC_TEST_H -#define OHOS_AEC_TEST_H - -#include "local_audio.h" - -namespace OHOS { -namespace DistributedHardware { -class AecTest { -public: - AecTest() = default; - ~AecTest() = default; - - int32_t Init(); - int32_t Process(); - void Release(); -private: - AudioRenderObj render_; - AudioCaptureObj capture_; - AudioBufferInfo info_; -}; -} // namespace DistributedHardware -} // namespace OHOS -#endif // OHOS_AEC_TEST_H \ No newline at end of file diff --git a/common/test_utils/audio_base.cpp b/common/test_utils/audio_base.cpp deleted file mode 100644 index ec826809..00000000 --- a/common/test_utils/audio_base.cpp +++ /dev/null @@ -1,213 +0,0 @@ -/* - * Copyright (c) 2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "audio_base.h" - -#include -#include -#include "audio_info.h" -#include "audio_buffer.h" -#include "daudio_errorcode.h" - -constexpr int32_t OFFSET_1 = 256; -constexpr int32_t OFFSET_2 = 65536; -constexpr int32_t OFFSET_3 = 16777216; -constexpr int32_t INT8_SIZE = 1; -constexpr int32_t INT16_SIZE = 2; -constexpr int32_t INT32_SIZE = 4; - -using namespace std; - -namespace OHOS { -namespace DistributedHardware { -int32_t AudioObject::CmdReadInt() -{ - int32_t cmd = 0; - cin >> cmd; - cout << endl; - return cmd; -} - -int32_t AudioObject::ReadAudioInfo(AudioBufferInfo &info) -{ - constexpr int32_t cmd1 = 1; - constexpr int32_t cmd2 = 2; - cout << "Input sample rate: " << endl << "[1] 16000" << endl << "[2] 48000" << endl; - int32_t cmd = CmdReadInt(); - if (cmd == cmd1) { - info.sampleRate = (int32_t)OHOS::AudioStandard::AudioSamplingRate::SAMPLE_RATE_16000; - } else if (cmd == cmd2) { - info.sampleRate = (int32_t)OHOS::AudioStandard::AudioSamplingRate::SAMPLE_RATE_48000; - } else { - cout << "Sample rate not support." << endl; - return ERR_DH_AUDIO_FAILED; - } - - cout << "Input channel number: " << endl << "[1] 1Ch" << endl << "[2] 2Ch" << endl; - cmd = CmdReadInt(); - if (cmd == cmd1) { - info.channel = (int32_t)OHOS::AudioStandard::AudioChannel::MONO; - } else if (cmd == cmd2) { - info.channel = (int32_t)OHOS::AudioStandard::AudioChannel::STEREO; - } else { - cout << "Channel number not support." << endl; - return ERR_DH_AUDIO_FAILED; - } - info.format = (int32_t)OHOS::AudioStandard::AudioSampleFormat::SAMPLE_S16LE; - - cout << "======================================" << endl - << "information:" << endl - << "sample_rate: " << info.sampleRate << endl - << "channels: " << info.channel << endl - << "format: " << info.format << endl - << "======================================" << endl; - return DH_SUCCESS; -} - -int32_t AudioObject::ReadInt32(FILE *fd) -{ - char tmp[INT32_SIZE]; - fread(tmp, INT8_SIZE, INT32_SIZE, fd); - int32_t res = - (int32_t)tmp[0] + (int32_t)tmp[1] * OFFSET_1 + (int32_t)tmp[2] * OFFSET_2 + (int32_t)tmp[3] * OFFSET_3; - return res; -} - -int32_t AudioObject::ReadInt16(FILE *fd) -{ - char tmp[INT16_SIZE]; - fread(tmp, INT8_SIZE, INT16_SIZE, fd); - int32_t res = (int32_t)tmp[0] + (int32_t)tmp[1] * OFFSET_1; - return res; -} - -int32_t AudioObject::ReadWavFile(const std::string &path, AudioBufferInfo &info) -{ - FILE *fd = fopen(path.c_str(), "rb"); - if (fd == nullptr) { - cout << "File not exist." << endl; - return ERR_DH_AUDIO_FAILED; - } - - constexpr int32_t WAV_OFFSET_4 = 4; - constexpr int32_t WAV_OFFSET_22 = 22; - constexpr int32_t WAV_OFFSET_24 = 24; - constexpr int32_t WAV_OFFSET_44 = 44; - - rewind(fd); - fseek(fd, WAV_OFFSET_4, SEEK_SET); - info.size = ReadInt32(fd) - WAV_SIZE_OFFSET; - fseek(fd, WAV_OFFSET_22, SEEK_SET); - info.channel = ReadInt16(fd); - fseek(fd, WAV_OFFSET_24, SEEK_SET); - info.sampleRate = ReadInt32(fd); - info.format = (int32_t)OHOS::AudioStandard::AudioSampleFormat::SAMPLE_S16LE; - cout << "======================================" << endl - << path << " information:" << endl - << "channels: " << info.channel << endl - << "sample_rate: " << info.sampleRate << endl - << "length: " << info.size << endl - << "======================================" << endl; - - data_ = std::make_unique(info); - fseek(fd, WAV_OFFSET_44, SEEK_SET); - fread(data_->Data(), 1, info.size, fd); - fclose(fd); - - return DH_SUCCESS; -} - -int32_t AudioObject::ReadPcmFile(const std::string &path, AudioBufferInfo &info) -{ - FILE *fd = fopen(path.c_str(), "rb"); - if (fd == nullptr) { - cout << "File not exist." << endl; - return ERR_DH_AUDIO_FAILED; - } - fseek(fd, 0, SEEK_END); - info.size = ftell(fd); - rewind(fd); - - int32_t res = ReadAudioInfo(info); - if (res != DH_SUCCESS) { - fclose(fd); - return res; - } - data_ = std::make_unique(info); - fread(data_->Data(), 1, info.size, fd); - fclose(fd); - return DH_SUCCESS; -} - -int32_t AudioObject::SaveAudioData(const std::string &path) -{ - if (data_ == nullptr) { - return ERR_DH_AUDIO_NULLPTR; - } - int32_t res = data_->WirteBufferToFile(path); - cout << "[*]Save file in: " << path << endl; - if (res != DH_SUCCESS) { - cout << "Write audio file failed." << endl; - return ERR_DH_AUDIO_FAILED; - } - return DH_SUCCESS; -} - -int32_t GetEnvNoise(const std::shared_ptr &data) -{ - int32_t max = 0; - for (int32_t i = 0; i < data->GetInfo().size / (int32_t)sizeof(int16_t); i++) { - int16_t f = abs((reinterpret_castdata->Data())[i]); - if (f > max) { - max = f; - } - } - return max; -} - -bool IsFrameHigh(const int16_t *data, const int32_t size, int32_t threshhold) -{ - int32_t max = 0; - for (int32_t i = 0; i < size; i++) { - int16_t f = abs(data[i]); - if (f > max) { - max = f; - } - } - return (max >= threshhold ? true : false); -} - -int64_t GetNowTimeUs() -{ - std::chrono::microseconds nowUs = - std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()); - return nowUs.count(); -} - -int64_t RecordBeepTime(const uint8_t *base, const AudioBufferInfo &info, bool &status) -{ - int32_t threshhold = 10000; - if (IsFrameHigh(reinterpret_castbase, info.sizePerFrame / sizeof(int16_t), threshhold) == true && - status == true) { - status = false; - return GetNowTimeUs(); - } else if (IsFrameHigh(reinterpret_castbase, info.sizePerFrame / sizeof(int16_t), threshhold) == false) { - status = true; - } - - return 0; -} -} // namespace DistributedHardware -} // namespace OHOS \ No newline at end of file diff --git a/common/test_utils/audio_base.h b/common/test_utils/audio_base.h deleted file mode 100644 index 36f14779..00000000 --- a/common/test_utils/audio_base.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef OHOS_AUDIO_BASE_H -#define OHOS_AUDIO_BASE_H - -#include -#include -#include - -#include "audio_buffer.h" - -namespace OHOS { -namespace DistributedHardware { - -constexpr int32_t FRAME_PER_SEC = 50; -constexpr int32_t BIT_FORMAT_16 = 2; -constexpr int32_t SECOND_ONE = 1; -constexpr int32_t MILLISECONDS_PER_SECOND = 1000; -constexpr int32_t MICROSECONDS_PER_MILLISECOND = 1000; -constexpr int32_t CAPTURE_TIME_MAX = 600; -constexpr int32_t WAV_SIZE_OFFSET = 36; - -class AudioObject { -public: - AudioObject() = default; - virtual ~AudioObject() = default; - virtual int32_t Init(const AudioBufferInfo &info) = 0; - virtual void Release() = 0; - virtual void RunThread() = 0; - virtual void Start() = 0; - virtual void Stop() = 0; - virtual int32_t CaptureFrame(const int32_t time) = 0; - int32_t ReadAudioInfo(AudioBufferInfo &info); - int32_t ReadWavFile(const std::string &path, AudioBufferInfo &info); - int32_t ReadPcmFile(const std::string &path, AudioBufferInfo &info); - int32_t SaveAudioData(const std::string &path); - std::shared_ptr GetData() const - { - return data_; - } - int32_t GetPeriod() const - { - return info_.period; - } - std::vector GetBeepTime() const - { - return beepTime_; - } - -protected: - AudioBufferInfo info_; - std::thread runThread_; - std::shared_ptr data_ = nullptr; - std::vector beepTime_; - -private: - int32_t CmdReadInt(); - int32_t ReadInt32(FILE *fd); - int32_t ReadInt16(FILE *fd); -}; - -int32_t GetEnvNoise(const std::shared_ptr &data); -bool IsFrameHigh(const int16_t *data, const int32_t size, int32_t threshhold); -int64_t RecordBeepTime(const uint8_t *base, const AudioBufferInfo &info, bool &status); -int64_t GetNowTimeUs(); -} // namespace DistributedHardware -} // namespace OHOS -#endif // OHOS_AUDIO_BASE_H \ No newline at end of file diff --git a/common/test_utils/audio_buffer.cpp b/common/test_utils/audio_buffer.cpp deleted file mode 100644 index c7367403..00000000 --- a/common/test_utils/audio_buffer.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "audio_buffer.h" - -#include - -#include "daudio_errorcode.h" - -namespace OHOS { -namespace DistributedHardware { - -constexpr int32_t MAX_SIZE = 3840 * 50 * 6000; - -AudioBuffer::AudioBuffer(const int32_t size) -{ - if (size > 0 && size < MAX_SIZE) { - data_ = new (std::nothrow) uint8_t[size] {0}; - if (data_ != nullptr) { - param_.size = size; - param_.channel = 0; - param_.format = 0; - param_.sampleRate = 0; - } - } -} - -AudioBuffer::AudioBuffer(const AudioBufferInfo &info) -{ - if (info.size > 0 && info.size < MAX_SIZE) { - param_ = info; - data_ = new (std::nothrow) uint8_t[info.size] { 0 }; - } -} - -int32_t AudioBuffer::Size() const -{ - return param_.size; -} - -uint8_t *AudioBuffer::Data() const -{ - return data_; -} - -AudioBuffer::~AudioBuffer() -{ - if (data_ != nullptr) { - delete[] data_; - data_ = nullptr; - } - param_.size = 0; -} - -int32_t AudioBuffer::WirteBufferToFile(const std::string &path) -{ - if (data_ == nullptr || param_.size == 0) { - return ERR_DH_AUDIO_FAILED; - } - - FILE *fd = fopen(path.c_str(), "wb"); - if (fd == nullptr) { - std::cout << "Open file failed." << std::endl; - return ERR_DH_AUDIO_FAILED; - } - fwrite(data_, sizeof(uint8_t), param_.size, fd); - fclose(fd); - return DH_SUCCESS; -} -} // namespace DistributedHardware -} // namespace OHOS diff --git a/common/test_utils/audio_buffer.h b/common/test_utils/audio_buffer.h deleted file mode 100644 index 2d901538..00000000 --- a/common/test_utils/audio_buffer.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef OHOS_AUDIO_DATA_H -#define OHOS_AUDIO_DATA_H - -#include - -namespace OHOS { -namespace DistributedHardware { -typedef struct { - int32_t sampleRate; - int32_t channel; - int32_t format; - int32_t size; - int32_t frames; - int32_t period; - int32_t sizePerFrame; - std::string filePath; -} AudioBufferInfo; - -class AudioBuffer { -public: - AudioBuffer() = default; - ~AudioBuffer(); - explicit AudioBuffer(const int32_t size); - explicit AudioBuffer(const AudioBufferInfo &info); - - int32_t Size() const; - uint8_t *Data() const; - AudioBufferInfo GetInfo() const - { - return param_; - } - - int32_t WirteBufferToFile(const std::string &path); - -private: - AudioBuffer(const AudioBuffer &) = delete; - AudioBuffer &operator = (const AudioBuffer &) = delete; - - AudioBufferInfo param_; - uint8_t *data_ = nullptr; -}; -} // namespace DistributedHardware -} // namespace OHOS -#endif // OHOS_AUDIO_DATA_H \ No newline at end of file diff --git a/common/test_utils/cycle_test.cpp b/common/test_utils/cycle_test.cpp deleted file mode 100644 index d0ec8ade..00000000 --- a/common/test_utils/cycle_test.cpp +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright (c) 2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "cycle_test.h" - -#include - -#include "local_audio.h" -#include "hdf_audio.h" -#include "daudio_errorcode.h" - -using namespace std; - -namespace OHOS { -namespace DistributedHardware { -void CycleTest::GetMode() -{ - cout << "Input audio cycle test mode: " << endl - << "[1] Use Audio FrameWork play, Audio FrameWork capture." << endl - << "[2] Use Audio HDF play, Audio HDF capture." << endl; - int32_t mode; - cin >> mode; - cout << endl; - if (mode != MODE_LR_LC && mode != MODE_HR_HC) { - cout << "Mode is invalid." << endl; - return; - } - mode_ = static_cast(mode); - - cout << "Input speaker file path(/data/): "; - cin >> spkFile_; - cout << endl; - cout << "Input mic file path(/data/): "; - cin >> micFile_; - cout << endl; - - string dir = "/data/"; - spkFile_ = dir + spkFile_; - micFile_ = dir + micFile_; - return; -} - -int32_t CycleTest::Init() -{ - GetMode(); - switch (static_cast(mode_)) { - case MODE_INVALID: - render_ = make_unique(); - capture_ = make_unique(); - break; - case MODE_LR_LC: - render_ = make_unique(); - capture_ = make_unique(); - break; - case MODE_HR_HC: - render_ = make_unique(); - capture_ = make_unique(); - break; - default: - break; - } - - bool ready = false; - size_t pos = spkFile_.find(".pcm"); - if (pos != string::npos) { - if (render_->ReadPcmFile(spkFile_, info_) != DH_SUCCESS) { - return ERR_DH_AUDIO_FAILED; - } - ready = true; - } - pos = spkFile_.find(".wav"); - if (pos != string::npos) { - if (render_->ReadWavFile(spkFile_, info_) != DH_SUCCESS) { - return ERR_DH_AUDIO_FAILED; - } - ready = true; - } - if (ready != true) { - cout << "File path is wrong." << endl; - return ERR_DH_AUDIO_FAILED; - } - - render_->Init(info_); - capture_->Init(info_); - return DH_SUCCESS; -} - -int32_t CycleTest::Process() -{ - if (capture_ == nullptr || render_ == nullptr) { - return ERR_DH_AUDIO_NULLPTR; - } - capture_->CaptureFrame(render_->GetPeriod()); - capture_->Start(); - render_->Start(); - capture_->Stop(); - capture_->SaveAudioData(micFile_); - - auto start = render_->GetBeepTime(); - auto stop = capture_->GetBeepTime(); - if (start.size() != stop.size()) { - cout << "Record num is not equal(" << start.size() << " " << stop.size() << ")." << endl; - return ERR_DH_AUDIO_FAILED; - } - - for (size_t i = 0; i < start.size(); i++) { - cout << "Send: " << start[i] << " Received: " << stop[i] << endl; - cout << "Time is: " << stop[i] - start[i] << endl; - } - return DH_SUCCESS; -} - -void CycleTest::Release() -{ - if (capture_ != nullptr) { - capture_->Release(); - } - - if (render_ != nullptr) { - render_->Release(); - } -} -} // namespace DistributedHardware -} // namespace OHOS \ No newline at end of file diff --git a/common/test_utils/cycle_test.h b/common/test_utils/cycle_test.h deleted file mode 100644 index 3d34c1ba..00000000 --- a/common/test_utils/cycle_test.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef OHOS_CYCLE_TEST_H -#define OHOS_CYCLE_TEST_H - -#include -#include "audio_base.h" -#include "audio_buffer.h" - -namespace OHOS { -namespace DistributedHardware { -typedef enum { - MODE_INVALID = 0, - MODE_LR_LC = 1, - MODE_HR_HC = 2, -} CYCLE_MODE; -class CycleTest { -public: - CycleTest() = default; - ~CycleTest() = default; - - int32_t Init(); - int32_t Process(); - void Release(); -private: - void GetMode(); - -private: - CYCLE_MODE mode_ = MODE_INVALID; - std::string spkFile_; - std::string micFile_; - std::unique_ptr render_; - std::unique_ptr capture_; - AudioBufferInfo info_; -}; -} // namespace DistributedHardware -} // namespace OHOS -#endif // OHOS_CYCLE_TEST_H \ No newline at end of file diff --git a/common/test_utils/daudio_test_utils.cpp b/common/test_utils/daudio_test_utils.cpp deleted file mode 100644 index 52a40285..00000000 --- a/common/test_utils/daudio_test_utils.cpp +++ /dev/null @@ -1,217 +0,0 @@ -/* - * Copyright (c) 2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "daudio_test_utils.h" - -#include -#include - -#include "audio_buffer.h" -#include "cycle_test.h" -#include "daudio_errorcode.h" -#include "local_audio.h" -#include "hdf_audio.h" - -using namespace std; - -const string CMD_QUIT = "quit"; -const string CMD_QUIT_EXT = "0"; -const string CMD_LOCAL_CAPTURE = "lmic"; -const string CMD_LOCAL_CAPTURE_EXT = "20"; -const string CMD_LOCAL_RENDER = "lspk"; -const string CMD_LOCAL_RENDER_EXT = "21"; -const string CMD_CYCLE_TEST = "cycle"; -const string CMD_CYCLE_TEST_EXT = "22"; -const string CMD_HDF_CAPTURE = "hmic"; -const string CMD_HDF_CAPTURE_EXT = "23"; -const string CMD_HDF_RENDER = "hspk"; -const string CMD_HDF_RENDER_EXT = "24"; -namespace OHOS { -namespace DistributedHardware { - -void DAudioTestUtils::DoAudioTest() -{ - bool running = true; - string cmd = ""; - while (running) { - cout << endl <<"Input test command: "; - cin >> cmd; - cout <> time_; - cout << endl; - capture.CaptureFrame(time_); - capture.Start(); - capture.Stop(); - capture.SaveAudioData("/data/mic.pcm"); - capture.Release(); -} - -void DAudioTestUtils::LocalRender() -{ - cout << "[LocalRender]" << endl; - AudioRenderObj render; - AudioBufferInfo info; - - cout << "Input file path: "; - cin >> path_; - cout << endl; - - size_t pos = path_.find(".wav"); - if (pos != string::npos) { - if (render.ReadWavFile(path_, info) != DH_SUCCESS) { - return; - } - } - pos = path_.find(".pcm"); - if (pos != string::npos) { - if (render.ReadPcmFile(path_, info) != DH_SUCCESS) { - return; - } - } - - int32_t res = render.Init(info); - if (res != DH_SUCCESS) { - return; - } - render.Start(); - render.Stop(); - render.Release(); -} - -void DAudioTestUtils::AudioCycleTest() -{ - cout << "[CycleTest]" << endl; - CycleTest test; - int32_t res = test.Init(); - if (res != DH_SUCCESS) { - return; - } - test.Process(); - test.Release(); -} - -void DAudioTestUtils::HDFCapture() -{ - cout << "[HDFCapture]" << endl; - HDFAudioCaptureObj capture; - AudioBufferInfo info; - int32_t res = capture.ReadAudioInfo(info); - if (res != DH_SUCCESS) { - return; - } - res = capture.Init(info); - if (res != DH_SUCCESS) { - return; - } - cout << "Input capture time(s): "; - cin >> time_; - cout << endl; - capture.CaptureFrame(time_); - capture.Start(); - capture.Stop(); - capture.SaveAudioData("/data/mic.pcm"); - capture.Release(); -} - -void DAudioTestUtils::HDFRender() -{ - cout << "[HDFRender]" << endl; - HDFAudioRenderObj render; - AudioBufferInfo info; - - cout << "Input file path: "; - cin >> path_; - cout << endl; - - size_t pos = path_.find(".wav"); - if (pos != string::npos) { - if (render.ReadWavFile(path_, info) != DH_SUCCESS) { - return; - } - } - pos = path_.find(".pcm"); - if (pos != string::npos) { - if (render.ReadPcmFile(path_, info) != DH_SUCCESS) { - return; - } - } - - int32_t res = render.Init(info); - if (res != DH_SUCCESS) { - return; - } - render.Start(); - render.Stop(); - render.Release(); -} -} // namespace DistributedHardware -} // namespace OHOS - -int32_t main() -{ - cout << "**********************************************************************************" << endl - << "Distributed Audio Test Demo Bin." << endl - << "**********************************************************************************" << endl; - OHOS::DistributedHardware::DAudioTestUtils testBin; - testBin.DoAudioTest(); - return 0; -} \ No newline at end of file diff --git a/common/test_utils/daudio_test_utils.h b/common/test_utils/daudio_test_utils.h deleted file mode 100644 index 15d71f6a..00000000 --- a/common/test_utils/daudio_test_utils.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef OHOS_DAUDIO_TEST_UTILS_H -#define OHOS_DAUDIO_TEST_UTILS_H - -#include -namespace OHOS { -namespace DistributedHardware { -class DAudioTestUtils { -public: - DAudioTestUtils() = default; - ~DAudioTestUtils() = default; - void DoAudioTest(); - -private: - void LocalCapture(); - void LocalRender(); - void AudioCycleTest(); - void HDFCapture(); - void HDFRender(); - -private: - int32_t time_ = 0; - std::string path_; -}; -} // namespace DistributedHardware -} // namespace OHOS - -#endif // OHOS_DAUDIO_TEST_UTILS_H \ No newline at end of file diff --git a/common/test_utils/hdf_audio.cpp b/common/test_utils/hdf_audio.cpp deleted file mode 100644 index 0cab5286..00000000 --- a/common/test_utils/hdf_audio.cpp +++ /dev/null @@ -1,354 +0,0 @@ -/* - * Copyright (c) 2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "hdf_audio.h" - -#include -#include -#include -#include -#include - -#include "audio_adapter.h" -#include "audio_manager.h" -#include "audio_types.h" -#include "daudio_errorcode.h" - -using namespace std; - -namespace OHOS { -namespace DistributedHardware { - -static struct AudioManager *g_audioManager; -static struct AudioAdapter *g_audioAdapter; -static struct AudioCapture *g_audioCapture; -static struct AudioRender *g_audioRender; -static bool g_micInUse = false; -static bool g_spkInUse = false; -static void *g_handle = nullptr; -static constexpr const char* RENDER_RUN_THREAD = "hdfSpkRunTh"; -static constexpr const char* CAPTURE_RUN_THREAD = "hdfMicRunTh"; - -static int32_t GetAudioManager() -{ - struct AudioManager *(*func)() = nullptr; - string audioMgrPath = "/system/lib64/libhdi_audio_client.z.so"; - g_handle = dlopen(audioMgrPath.c_str(), RTLD_LAZY); - if (g_handle == nullptr) { - cout << "Open " << audioMgrPath << " failed." <(dlsym(g_handle, "GetAudioManagerFuncs")); - if (func == nullptr) { - cout << "Dlsym GetAudioManagerFuncs failed." <GetAllAdapters(g_audioManager, &descs, &size); - if (size > adpMaxNum || size == 0 || descs == nullptr || ret != 0) { - cout << "Get audio adapters failed." << endl; - return ERR_DH_AUDIO_FAILED; - } - struct AudioAdapterDescriptor *primaryDesc = nullptr; - for (int32_t index = 0; index < size; index++) { - auto desc = &descs[index]; - if (desc == nullptr || desc->adapterName == nullptr) { - continue; - } - if (!strcmp(desc->adapterName, "primary")) { - primaryDesc = desc; - break; - } - } - if (primaryDesc == nullptr) { - cout << "Find primary adapter failed." << endl; - return ERR_DH_AUDIO_FAILED; - } - ret = g_audioManager->LoadAdapter(g_audioManager, primaryDesc, &g_audioAdapter); - if (ret != DH_SUCCESS || g_audioAdapter == nullptr) { - cout << "Load primary adapter failed." << endl; - return ERR_DH_AUDIO_FAILED; - } - return DH_SUCCESS; -} - -static void ReleaseHDFAudioDevice() -{ - if (g_micInUse != false && g_spkInUse != false) { - return; - } - if (g_audioManager != nullptr) { - g_audioManager->UnloadAdapter(g_audioManager, g_audioAdapter); - } - g_audioManager = nullptr; - g_audioAdapter = nullptr; - (void)dlclose(g_handle); -} - -static int32_t InitHDFAudioDevice() -{ - if (g_micInUse != false || g_spkInUse != false) { - return DH_SUCCESS; - } - - if (GetAudioManager() != DH_SUCCESS) { - ReleaseHDFAudioDevice(); - return ERR_DH_AUDIO_FAILED; - } - - if (GetAdapter() != DH_SUCCESS) { - ReleaseHDFAudioDevice(); - return ERR_DH_AUDIO_FAILED; - } - return DH_SUCCESS; -} - -HDFAudioCaptureObj::HDFAudioCaptureObj() -{ - int32_t period = 1024; - int32_t streamId = 1; - captureDesc_.pins = AudioPortPin::PIN_IN_MIC; - captureDesc_.desc = nullptr; - captureAttr_.format = AUDIO_FORMAT_TYPE_PCM_16_BIT; - captureAttr_.interleaved = true; - captureAttr_.streamId = streamId; - captureAttr_.type = AUDIO_IN_MEDIA; - captureAttr_.period = period; - captureAttr_.isBigEndian = false; - captureAttr_.isSignedData = true; - captureAttr_.stopThreshold = 0x7fffffff; -} - -int32_t HDFAudioCaptureObj::Init(const AudioBufferInfo &info) -{ - cout << "[1]Create hdf audio capture." << endl; - if (InitHDFAudioDevice() != DH_SUCCESS) { - return ERR_DH_AUDIO_FAILED; - } - - info_ = info; - captureAttr_.channelCount = info.channel; - captureAttr_.sampleRate = info.sampleRate; - int32_t ret = g_audioAdapter->CreateCapture(g_audioAdapter, &captureDesc_, &captureAttr_, &g_audioCapture); - if (ret != DH_SUCCESS || g_audioCapture == nullptr) { - cout << "[1]CreateCapture failed, ret: " << ret << endl; - return ERR_DH_AUDIO_FAILED; - } - g_micInUse = true; - cout << "[1]Create hdf audio capture success."<< endl; - return DH_SUCCESS; -} - -void HDFAudioCaptureObj::Release() -{ - cout << "[4]Release hdf audio capture." << endl; - while (runThread_.joinable()) { - runThread_.join(); - } - if (g_audioAdapter != nullptr) { - g_audioAdapter->DestroyCapture(g_audioAdapter, g_audioCapture); - } - g_micInUse = false; - ReleaseHDFAudioDevice(); - cout << "[4]Release hdf audio capture success." << endl; -} - -int32_t HDFAudioCaptureObj::CaptureFrame(const int32_t time) -{ - if (g_audioCapture == nullptr) { - return ERR_DH_AUDIO_NULLPTR; - } - info_.period = time; - if (info_.period <= 0 || info_.period >= CAPTURE_TIME_MAX) { - cout << "Capture time is invalid." << endl; - return ERR_DH_AUDIO_FAILED; - } - info_.size = info_.sampleRate * info_.channel * BIT_FORMAT_16 * info_.period; - info_.frames = FRAME_PER_SEC * info_.period; - info_.sizePerFrame = info_.sampleRate * info_.channel * BIT_FORMAT_16 / FRAME_PER_SEC; - data_ = make_unique(info_); - - return DH_SUCCESS; -} - -void HDFAudioCaptureObj::RunThread() -{ - if (g_audioCapture == nullptr || data_ == nullptr || data_->Data() == nullptr) { - cout << "Capture or data is null." << endl; - return; - } - - if (pthread_setname_np(pthread_self(), CAPTURE_RUN_THREAD) != DH_SUCCESS) { - cout << "Hdf capture run thread setname failed." << endl; - } - int32_t playIndex = 0; - uint64_t size = 0; - uint8_t *base = data_->Data(); - auto data = make_unique(info_.sizePerFrame); - while (playIndex < info_.frames) { - g_audioCapture->CaptureFrame(g_audioCapture, data->Data(), info_.sizePerFrame, &size); - if (memcpy_s(base, data_->Size(), data->Data(), data->Size()) != EOK) { - cout << "Copy buffer failed." << endl; - break; - } - base += info_.sizePerFrame; - playIndex++; - } - cout << "[*]Capture frame number is: " << info_.frames << endl; -} - -void HDFAudioCaptureObj::Start() -{ - cout << "[2]Start hdf capture thread." << endl; - if (g_audioCapture == nullptr) { - return; - } - g_audioCapture->control.Start((AudioHandle)g_audioCapture); - runThread_ = thread(&HDFAudioCaptureObj::RunThread, this); - while (!runThread_.joinable()) { - } - cout << "[2]Start hdf capture thread success." << endl; -} - -void HDFAudioCaptureObj::Stop() -{ - usleep(MILLISECONDS_PER_SECOND * MICROSECONDS_PER_MILLISECOND * (info_.period + SECOND_ONE)); - if (g_audioCapture != nullptr) { - g_audioCapture->control.Stop((AudioHandle)g_audioCapture); - } - cout << "[3]Stop hdf capture thread success." << endl; -} - -HDFAudioRenderObj::HDFAudioRenderObj() -{ - int32_t period = 1024; - int32_t streamId = 0; - renderDesc_.pins = AudioPortPin::PIN_OUT_SPEAKER; - renderDesc_.desc = nullptr; - renderAttr_.interleaved = true; - renderAttr_.streamId = streamId; - renderAttr_.type = AUDIO_IN_MEDIA; - renderAttr_.period = period; - renderAttr_.isBigEndian = false; - renderAttr_.isSignedData = true; - renderAttr_.stopThreshold = 0x7fffffff; - renderAttr_.silenceThreshold = 0; - renderAttr_.format = AUDIO_FORMAT_TYPE_PCM_32_BIT; -} - -int32_t HDFAudioRenderObj::Init(const AudioBufferInfo &info) -{ - cout << "[1]Create hdf audio render." << endl; - if (InitHDFAudioDevice() != DH_SUCCESS) { - return ERR_DH_AUDIO_FAILED; - } - - renderAttr_.sampleRate = info.sampleRate; - renderAttr_.channelCount = info.channel; - info_ = info; - info_.sizePerFrame = info_.sampleRate * info_.channel * BIT_FORMAT_16 / FRAME_PER_SEC; - info_.frames = info_.size / info_.sizePerFrame; - info_.period = info_.frames / FRAME_PER_SEC; - int32_t ret = g_audioAdapter->CreateRender(g_audioAdapter, &renderDesc_, &renderAttr_, &g_audioRender); - if (ret != DH_SUCCESS || g_audioRender == nullptr) { - std::cout<<"[1]CreateRender failed, ret: "<< ret << std::endl; - return ERR_DH_AUDIO_FAILED; - } - g_spkInUse = true; - cout << "[1]Create hdf audio render success." << endl; - return DH_SUCCESS; -} - -void HDFAudioRenderObj::Release() -{ - cout << "[4]Release hdf audio render." << endl; - while (runThread_.joinable()) { - runThread_.join(); - } - if (g_audioAdapter != nullptr) { - g_audioAdapter->DestroyRender(g_audioAdapter, g_audioRender); - } - g_spkInUse = false; - ReleaseHDFAudioDevice(); - cout << "[4]Release hdf audio render success." << endl; -} - -void HDFAudioRenderObj::RunThread() -{ - if (g_audioRender == nullptr || data_ == nullptr || data_->Data() == nullptr) { - return; - } - - if (pthread_setname_np(pthread_self(), RENDER_RUN_THREAD) != DH_SUCCESS) { - cout << "Hdf render run thread setname failed."<< endl; - } - int32_t playIndex = 0; - int32_t offset = 65535; - uint64_t size = 0; - int32_t dataSize = info_.sizePerFrame * sizeof(int32_t) / sizeof(int16_t); - uint8_t *base = data_->Data(); - auto data = std::make_unique(dataSize); - while (playIndex < info_.frames) { - for (int32_t i = 0; i < info_.sizePerFrame; i++) { - (reinterpret_cast(data->Data()))[i] = (reinterpret_cast(base))[i] * offset; - } - g_audioRender->RenderFrame(g_audioRender, data->Data(), dataSize, &size); - base += info_.sizePerFrame; - playIndex++; - } - cout << "[*]Render frame number is: " << info_.frames << endl; -} - -void HDFAudioRenderObj::Start() -{ - cout << "[2]Start hdf paly thread." << endl; - if (g_audioRender == nullptr) { - return; - } - g_audioRender->control.Start((AudioHandle)g_audioRender); - runThread_ = std::thread(&HDFAudioRenderObj::RunThread, this); - while (!runThread_.joinable()) { - } - cout << "[2]Start hdf play thread success." << endl; -} - -void HDFAudioRenderObj::Stop() -{ - usleep(MILLISECONDS_PER_SECOND * MICROSECONDS_PER_MILLISECOND * (info_.period + SECOND_ONE)); - if (g_audioRender != nullptr) { - g_audioRender->control.Stop((AudioHandle)g_audioRender); - } - cout << "[2]Stop hdf play thread success." << endl; -} - -int32_t HDFAudioRenderObj::CaptureFrame(const int32_t time) -{ - (void) time; - return DH_SUCCESS; -} -} // namespace DistributedHardware -} // namespace OHOS \ No newline at end of file diff --git a/common/test_utils/hdf_audio.h b/common/test_utils/hdf_audio.h deleted file mode 100644 index 2625a306..00000000 --- a/common/test_utils/hdf_audio.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef OHOS_HDF_AUDIO_H -#define OHOS_HDF_AUDIO_H - -#include - -#include "audio_types.h" -#include "audio_capturer.h" -#include "audio_renderer.h" -#include "audio_base.h" -#include "audio_buffer.h" - -namespace OHOS { -namespace DistributedHardware { -class HDFAudioCaptureObj : public AudioObject { -public: - HDFAudioCaptureObj(); - ~HDFAudioCaptureObj() override = default; - int32_t Init(const AudioBufferInfo &info) override; - void Release() override; - void RunThread() override; - void Start() override; - void Stop() override; - int32_t CaptureFrame(const int32_t time) override; -private: - - struct AudioDeviceDescriptor captureDesc_; - struct AudioSampleAttributes captureAttr_; -}; - -class HDFAudioRenderObj : public AudioObject { -public: - HDFAudioRenderObj(); - ~HDFAudioRenderObj() override = default; - int32_t Init(const AudioBufferInfo &info) override; - void Release() override; - void RunThread() override; - void Start() override; - void Stop() override; - int32_t CaptureFrame(const int32_t time) override;; -private: - - struct AudioDeviceDescriptor renderDesc_; - struct AudioSampleAttributes renderAttr_; -}; -} // namespace DistributedHardware -} // namespace OHOS -#endif // OHOS_HDF_AUDIO_H \ No newline at end of file diff --git a/common/test_utils/local_audio.cpp b/common/test_utils/local_audio.cpp deleted file mode 100644 index 843a764d..00000000 --- a/common/test_utils/local_audio.cpp +++ /dev/null @@ -1,224 +0,0 @@ -/* - * Copyright (c) 2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "local_audio.h" - -#include - -#include -#include "daudio_errorcode.h" - -using namespace std; -namespace OHOS { -namespace DistributedHardware { -static constexpr const char* RENDER_RUN_THREAD = "localSpkRunTh"; -static constexpr const char* CAPTURE_RUN_THREAD = "localMicRunTh"; -AudioCaptureObj::AudioCaptureObj() -{ - opts_.capturerInfo.sourceType = OHOS::AudioStandard::SourceType::SOURCE_TYPE_MIC; - opts_.streamInfo.encoding = OHOS::AudioStandard::AudioEncodingType::ENCODING_PCM; - opts_.capturerInfo.capturerFlags = 0; -} - -int32_t AudioCaptureObj::Init(const AudioBufferInfo &info) -{ - cout << "[1]Create local audio capturer." << endl; - info_ = info; - opts_.streamInfo.samplingRate = (OHOS::AudioStandard::AudioSamplingRate)info.sampleRate; - opts_.streamInfo.channels = (OHOS::AudioStandard::AudioChannel)info.channel; - opts_.streamInfo.format = (OHOS::AudioStandard::AudioSampleFormat)info.format; - capturer_ = OHOS::AudioStandard::AudioCapturer::Create(opts_); - if (capturer_ == nullptr) { - cout << "[1]Create local audio capturer failed." << endl; - return ERR_DH_AUDIO_NULLPTR; - } - cout << "[1]Create local audio capturer success." << endl; - return DH_SUCCESS; -} - -void AudioCaptureObj::Release() -{ - cout << "[4]Release local audio capturer." << endl; - while (runThread_.joinable()) { - runThread_.join(); - } - if (capturer_ != nullptr) { - capturer_->Release(); - } - cout << "[4]Release local audio capturer success." << endl; -} - -int32_t AudioCaptureObj::CaptureFrame(const int32_t time) -{ - info_.period = time; - if (info_.period <= 0 || info_.period >= CAPTURE_TIME_MAX) { - cout << "Capture time is invalid." << endl; - return ERR_DH_AUDIO_FAILED; - } - info_.size = info_.sampleRate * info_.channel * BIT_FORMAT_16 * info_.period; - info_.frames = FRAME_PER_SEC * info_.period; - info_.sizePerFrame = info_.sampleRate * info_.channel * BIT_FORMAT_16 / FRAME_PER_SEC; - data_ = std::make_unique(info_); - return DH_SUCCESS; -} - -void AudioCaptureObj::Start() -{ - cout << "[2]Start local capture thread." << endl; - if (capturer_ == nullptr) { - return; - } - capturer_->Start(); - runThread_ = std::thread(&AudioCaptureObj::RunThread, this); - while (!runThread_.joinable()) { - } - cout << "[2]Start local capture thread success." << endl; -} - -void AudioCaptureObj::Stop() -{ - usleep(MILLISECONDS_PER_SECOND * MICROSECONDS_PER_MILLISECOND * (info_.period + SECOND_ONE)); - if (capturer_ != nullptr) { - capturer_->Stop(); - } - cout << "[3]Stop local capture thread success." << endl; -} - -void AudioCaptureObj::RunThread() -{ - if (capturer_ == nullptr || data_ == nullptr || data_->Data() == nullptr) { - return; - } - - if (pthread_setname_np(pthread_self(), CAPTURE_RUN_THREAD) != DH_SUCCESS) { - cout << "Local capture run thread setname failed."<< endl; - } - int32_t playIndex = 0; - uint8_t *base = data_->Data(); - auto data = std::make_unique(info_.sizePerFrame); - while (playIndex < info_.frames) { - int32_t readOffSet = 0; - while (readOffSet < info_.sizePerFrame) { - int32_t len = capturer_->Read(*(data->Data() + readOffSet), info_.sizePerFrame - readOffSet, true); - readOffSet += len; - } - if (memcpy_s(base, data_->Size(), data->Data(), data->Size()) != EOK) { - cout << "Copy buffer failed." << endl; - break; - } - base += info_.sizePerFrame; - playIndex++; - } - cout << "[*]Capture frame number is: " << info_.frames << endl; -} - -AudioRenderObj::AudioRenderObj() -{ - opts_.streamInfo.encoding = OHOS::AudioStandard::AudioEncodingType::ENCODING_PCM; - opts_.rendererInfo.contentType = OHOS::AudioStandard::ContentType::CONTENT_TYPE_MUSIC; - opts_.rendererInfo.streamUsage = OHOS::AudioStandard::StreamUsage::STREAM_USAGE_MEDIA; - opts_.rendererInfo.rendererFlags = 0; -} - -int32_t AudioRenderObj::Init(const AudioBufferInfo &info) -{ - cout << "[1]Create local audio render." << endl; - - info_ = info; - info_.sizePerFrame = info_.sampleRate * info_.channel * BIT_FORMAT_16 / FRAME_PER_SEC; - info_.frames = info_.size / info_.sizePerFrame; - info_.period = info_.frames / FRAME_PER_SEC; - - opts_.streamInfo.samplingRate = (OHOS::AudioStandard::AudioSamplingRate)info_.sampleRate; - opts_.streamInfo.channels = (OHOS::AudioStandard::AudioChannel)info_.channel; - opts_.streamInfo.format = (OHOS::AudioStandard::AudioSampleFormat)info_.format; - render_ = OHOS::AudioStandard::AudioRenderer::Create(opts_); - if (render_ == nullptr) { - cout << "[1]Create local audio render failed." << endl; - return ERR_DH_AUDIO_NULLPTR; - } - cout << "[1]Create local audio render success." << endl; - return DH_SUCCESS; -} - -void AudioRenderObj::Release() -{ - cout << "[4]Release local audio render." << endl; - while (runThread_.joinable()) { - runThread_.join(); - } - if (render_ != nullptr) { - render_->Release(); - } - cout << "[4]Release local audio render success." << endl; -} - -void AudioRenderObj::Start() -{ - cout << "[2]Start local play thread." << endl; - if (render_ == nullptr) { - return; - } - render_->Start(); - runThread_ = std::thread(&AudioRenderObj::RunThread, this); - while (!runThread_.joinable()) { - } - cout << "[2]Start local play thread success." << endl; -} - -void AudioRenderObj::Stop() -{ - usleep(MILLISECONDS_PER_SECOND * MICROSECONDS_PER_MILLISECOND * (info_.period + SECOND_ONE)); - if (render_ != nullptr) { - render_->Stop(); - } - cout << "[2]Stop local play thread success." << endl; -} - -void AudioRenderObj::RunThread() -{ - if (render_ == nullptr || data_ == nullptr || data_->Data() == nullptr) { - return; - } - - if (pthread_setname_np(pthread_self(), RENDER_RUN_THREAD) != DH_SUCCESS) { - cout << "Local render run thread setname failed."<< endl; - } - int32_t playIndex = 0; - uint8_t *base = data_->Data(); - auto data = std::make_unique(info_.sizePerFrame); - while (playIndex < info_.frames) { - if (memcpy_s(data->Data(), data->Size(), base, info_.sizePerFrame) != EOK) { - cout << "Copy buffer failed." << endl; - break; - } - int32_t writeOffSet = 0; - while (writeOffSet < info_.sizePerFrame) { - int32_t writeLen = render_->Write(data->Data() + writeOffSet, info_.sizePerFrame - writeOffSet); - writeOffSet += writeLen; - } - base += info_.sizePerFrame; - playIndex++; - } - cout << "[*]Render frame number is: " << info_.frames << endl; -} - -int32_t AudioRenderObj::CaptureFrame(const int32_t time) -{ - (void) time; - return DH_SUCCESS; -} -} // namespace DistributedHardware -} // namespace OHOS \ No newline at end of file diff --git a/common/test_utils/local_audio.h b/common/test_utils/local_audio.h deleted file mode 100644 index 01c9234f..00000000 --- a/common/test_utils/local_audio.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef OHOS_LOCAL_AUDIO_H -#define OHOS_LOCAL_AUDIO_H - -#include - -#include "audio_capturer.h" -#include "audio_renderer.h" -#include "audio_info.h" -#include "audio_base.h" - -namespace OHOS { -namespace DistributedHardware { -class AudioCaptureObj : public AudioObject { -public: - AudioCaptureObj(); - ~AudioCaptureObj() override = default; - int32_t Init(const AudioBufferInfo &info) override; - void Release() override; - void RunThread() override; - void Start() override; - void Stop() override; - int32_t CaptureFrame(const int32_t time) override; -private: - OHOS::AudioStandard::AudioCapturerOptions opts_; - std::unique_ptr capturer_ = nullptr; -}; - -class AudioRenderObj : public AudioObject { -public: - AudioRenderObj(); - ~AudioRenderObj() override = default; - int32_t Init(const AudioBufferInfo &info) override; - void Release() override; - void RunThread() override; - void Start() override; - void Stop() override; - int32_t CaptureFrame(const int32_t time) override; -private: - - OHOS::AudioStandard::AudioRendererOptions opts_; - std::unique_ptr render_ = nullptr; -}; - -} // namespace DistributedHardware -} // namespace OHOS -#endif // OHOS_LOCAL_AUDIO_H \ No newline at end of file diff --git a/hdf_service/distributed_audio/hdi_service/audio/v1_0/include/audio_capture_lowlatency_impl.h b/hdf_service/distributed_audio/hdi_service/audio/v1_0/include/audio_capture_lowlatency_impl.h deleted file mode 100644 index c6b2e008..00000000 --- a/hdf_service/distributed_audio/hdi_service/audio/v1_0/include/audio_capture_lowlatency_impl.h +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (c) 2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef OHOS_AUDIO_CAPTURE_LOWLATENCY_IMPL_H -#define OHOS_AUDIO_CAPTURE_LOWLATENCY_IMPL_H - -#include -#include -#include - -#include -#include -#include - -#include "ashmem.h" -#include "audio_capture_interface_impl.h" -#include "audio_capture_interface_impl_base.h" - -namespace OHOS { -namespace HDI { -namespace DistributedAudio { -namespace Audio { -namespace V1_0 { -using OHOS::HDI::DistributedAudio::Audioext::V1_0::AudioData; -using OHOS::HDI::DistributedAudio::Audioext::V1_0::AudioParameter; -using OHOS::HDI::DistributedAudio::Audioext::V1_0::DAudioEvent; -using OHOS::HDI::DistributedAudio::Audioext::V1_0::IDAudioCallback; -class AudioCaptureLowLatencyImpl : public AudioCaptureInterfaceImplBase { -public: - AudioCaptureLowLatencyImpl(const std::string &adpName, const AudioDeviceDescriptor &desc, - const AudioSampleAttributes &attrs, const sptr &callback); - ~AudioCaptureLowLatencyImpl() override; - - int32_t CaptureFrame(std::vector &frame, uint64_t requestBytes) override; - int32_t GetCapturePosition(uint64_t &frames, AudioTimeStamp &time) override; - int32_t CheckSceneCapability(const AudioSceneDescriptor &scene, bool &supported) override; - int32_t SelectScene(const AudioSceneDescriptor &scene) override; - int32_t SetMute(bool mute) override; - int32_t GetMute(bool &mute) override; - int32_t SetVolume(float volume) override; - int32_t GetVolume(float &volume) override; - int32_t GetGainThreshold(float &min, float &max) override; - int32_t GetGain(float &gain) override; - int32_t SetGain(float gain) override; - int32_t GetFrameSize(uint64_t &size) override; - int32_t GetFrameCount(uint64_t &count) override; - int32_t SetSampleAttributes(const AudioSampleAttributes &attrs) override; - int32_t GetSampleAttributes(AudioSampleAttributes &attrs) override; - int32_t GetCurrentChannelId(uint32_t &channelId) override; - int32_t SetExtraParams(const std::string &keyValueList) override; - int32_t GetExtraParams(std::string &keyValueList) override; - int32_t ReqMmapBuffer(int32_t reqSize, AudioMmapBufferDescriptor &desc) override; - int32_t GetMmapPosition(uint64_t &frames, AudioTimeStamp &time) override; - int32_t AddAudioEffect(uint64_t effectid) override; - int32_t RemoveAudioEffect(uint64_t effectid) override; - int32_t GetFrameBufferSize(uint64_t &bufferSize) override; - int32_t Start() override; - int32_t Stop() override; - int32_t Pause() override; - int32_t Resume() override; - int32_t Flush() override; - int32_t TurnStandbyMode() override; - int32_t AudioDevDump(int32_t range, int32_t fd) override; - int32_t IsSupportsPauseAndResume(bool &supportPause, bool &supportResume) override; - -private: - int32_t InitAshmem(int32_t ashmemLength); - void UnInitAshmem(); -private: - std::string adapterName_; - AudioDeviceDescriptor devDesc_; - AudioSampleAttributes devAttrs_; - uint32_t timeInterval_ = 5; - uint32_t minTimeInterval_ = 30; - uint32_t maxTimeInterval_ = 80; - - std::mutex captureMtx_; - AudioCaptureStatus captureStatus_ = CAPTURE_STATUS_CLOSE; - sptr audioExtCallback_ = nullptr; - OHOS::sptr ashmem_ = nullptr; - int32_t ashmemLength_; - int32_t lengthPerTrans_; - int32_t fd_; -}; -} // V1_0 -} // Audio -} // Distributedaudio -} // HDI -} // OHOS -#endif // OHOS_AUDIO_CAPTURE_LOWLATENCY_IMPL_H \ No newline at end of file diff --git a/hdf_service/distributed_audio/hdi_service/audio/v1_0/include/audio_render_lowlatency_impl.h b/hdf_service/distributed_audio/hdi_service/audio/v1_0/include/audio_render_lowlatency_impl.h deleted file mode 100644 index a198b1de..00000000 --- a/hdf_service/distributed_audio/hdi_service/audio/v1_0/include/audio_render_lowlatency_impl.h +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (c) 2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef OHOS_AUDIO_RENDER_LOWLATENCY_IMPL_H -#define OHOS_AUDIO_RENDER_LOWLATENCY_IMPL_H - -#include -#include -#include - -#include "ashmem.h" -#include "audio_render_interface_impl.h" -#include "audio_render_interface_impl_base.h" - -#include -#include -#include - -namespace OHOS { -namespace HDI { -namespace DistributedAudio { -namespace Audio { -namespace V1_0 { -using OHOS::HDI::DistributedAudio::Audioext::V1_0::AudioData; -using OHOS::HDI::DistributedAudio::Audioext::V1_0::AudioParameter; -using OHOS::HDI::DistributedAudio::Audioext::V1_0::DAudioEvent; -using OHOS::HDI::DistributedAudio::Audioext::V1_0::IDAudioCallback; -class AudioRenderLowLatencyImpl : public AudioRenderInterfaceImplBase { -public: - AudioRenderLowLatencyImpl(const std::string &adpName, const AudioDeviceDescriptor &desc, - const AudioSampleAttributes &attrs, const sptr &callback); - ~AudioRenderLowLatencyImpl() override; - - int32_t GetLatency(uint32_t &ms) override; - int32_t RenderFrame(const std::vector &frame, uint64_t &replyBytes) override; - int32_t GetRenderPosition(uint64_t &frames, AudioTimeStamp &time) override; - int32_t SetRenderSpeed(float speed) override; - int32_t GetRenderSpeed(float &speed) override; - int32_t SetChannelMode(AudioChannelMode mode) override; - int32_t GetChannelMode(AudioChannelMode &mode) override; - int32_t RegCallback(const sptr &audioCallback, int8_t cookie) override; - int32_t DrainBuffer(AudioDrainNotifyType &type) override; - int32_t IsSupportsDrain(bool &support) override; - int32_t CheckSceneCapability(const AudioSceneDescriptor &scene, bool &supported) override; - int32_t SelectScene(const AudioSceneDescriptor &scene) override; - int32_t SetMute(bool mute) override; - int32_t GetMute(bool &mute) override; - int32_t SetVolume(float volume) override; - int32_t GetVolume(float &volume) override; - int32_t GetGainThreshold(float &min, float &max) override; - int32_t SetGain(float gain) override; - int32_t GetGain(float &gain) override; - int32_t GetFrameSize(uint64_t &size) override; - int32_t GetFrameCount(uint64_t &count) override; - int32_t SetSampleAttributes(const AudioSampleAttributes &attrs) override; - int32_t GetSampleAttributes(AudioSampleAttributes &attrs) override; - int32_t GetCurrentChannelId(uint32_t &channelId) override; - int32_t SetExtraParams(const std::string &keyValueList) override; - int32_t GetExtraParams(std::string &keyValueList) override; - int32_t ReqMmapBuffer(int32_t reqSize, AudioMmapBufferDescriptor &desc) override; - int32_t GetMmapPosition(uint64_t &frames, AudioTimeStamp &time) override; - int32_t AddAudioEffect(uint64_t effectid) override; - int32_t RemoveAudioEffect(uint64_t effectid) override; - int32_t GetFrameBufferSize(uint64_t &bufferSize) override; - int32_t Start() override; - int32_t Stop() override; - int32_t Pause() override; - int32_t Resume() override; - int32_t Flush() override; - int32_t TurnStandbyMode() override; - int32_t AudioDevDump(int32_t range, int32_t fd) override; - int32_t IsSupportsPauseAndResume(bool &supportPause, bool &supportResume) override; - -private: - float GetFadeRate(uint32_t currentIndex, const uint32_t durationIndex); - int32_t FadeInProcess(const uint32_t durationFrame, int8_t* frameData, const size_t frameLength); - int32_t InitAshmem(int32_t ashmemLength); - void UnInitAshmem(); - -private: - std::string adapterName_; - AudioDeviceDescriptor devDesc_; - AudioSampleAttributes devAttrs_; - - uint32_t timeInterval_ = 5; - uint32_t minTimeInterval_ = 30; - uint32_t maxTimeInterval_ = 80; - float renderSpeed_ = 0; - uint32_t currentFrame_ = 0; - std::mutex renderMtx_; - AudioChannelMode channelMode_ = AUDIO_CHANNEL_NORMAL; - AudioRenderStatus renderStatus_ = RENDER_STATUS_CLOSE; - sptr audioExtCallback_ = nullptr; - sptr renderCallback_ = nullptr; - OHOS::sptr ashmem_ = nullptr; - int32_t ashmemLength_ = 0; - int32_t lengthPerTrans_ = 0; - int fd_ = 0; -}; -} // V1_0 -} // Audio -} // Distributedaudio -} // HDI -} // OHOS -#endif // OHOS_AUDIO_RENDER_LOWLATENCY_IMPL_H diff --git a/hdf_service/distributed_audio/hdi_service/audio/v1_0/src/audio_capture_lowlatency_impl.cpp b/hdf_service/distributed_audio/hdi_service/audio/v1_0/src/audio_capture_lowlatency_impl.cpp deleted file mode 100644 index 773fc6c6..00000000 --- a/hdf_service/distributed_audio/hdi_service/audio/v1_0/src/audio_capture_lowlatency_impl.cpp +++ /dev/null @@ -1,344 +0,0 @@ -/* - * Copyright (c) 2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "audio_capture_lowlatency_impl.h" - -#include -#include -#include -#include - -#include "daudio_constants.h" -#include "daudio_events.h" -#include "daudio_log.h" -#include "daudio_utils.h" - -#undef DH_LOG_TAG -#define DH_LOG_TAG "AudioCaptureLowLatencyImpl" - -using namespace OHOS::DistributedHardware; -namespace OHOS { -namespace HDI { -namespace DistributedAudio { -namespace Audio { -namespace V1_0 { -AudioCaptureLowLatencyImpl::AudioCaptureLowLatencyImpl(const std::string &adpName, const AudioDeviceDescriptor &desc, - const AudioSampleAttributes &attrs, const sptr &callback) - : AudioCaptureInterfaceImplBase(desc), adapterName_(adpName), devDesc_(desc), - devAttrs_(attrs), audioExtCallback_(callback) -{ - devAttrs_.frameSize = CalculateFrameSize(attrs.sampleRate, attrs.channelCount, attrs.format, timeInterval_, true); - DHLOGI("Distributed lowlatency capture constructed, id(%d). framesize(%d)", desc.pins, devAttrs_.frameSize); -} - -AudioCaptureLowLatencyImpl::~AudioCaptureLowLatencyImpl() -{ - UnInitAshmem(); - DHLOGD("Distributed lowlatency capture destructed, id(%d).", devDesc_.pins); -} - -int32_t AudioCaptureLowLatencyImpl::InitAshmem(int32_t ashmemLength) -{ - std::string memory_name = "Capture ShareMemory"; - if (ashmemLength < DAUDIO_MIN_ASHMEM_LEN || ashmemLength > DAUDIO_MAX_ASHMEM_LEN) { - DHLOGE("Init ashmem failed. length is illegal"); - return HDF_FAILURE; - } - ashmem_ = OHOS::Ashmem::CreateAshmem(memory_name.c_str(), ashmemLength); - if (ashmem_ == nullptr) { - DHLOGE("Create ashmem failed."); - return HDF_FAILURE; - } - if (!ashmem_->MapReadAndWriteAshmem()) { - DHLOGE("Mmap ashmem failed."); - return HDF_FAILURE; - } - fd_ = ashmem_->GetAshmemFd(); - DHLOGI("Init Ashmem success, fd: %d, length: %d", fd_, ashmemLength); - return HDF_SUCCESS; -} - -void AudioCaptureLowLatencyImpl::UnInitAshmem() -{ - if (ashmem_ != nullptr) { - ashmem_->UnmapAshmem(); - ashmem_->CloseAshmem(); - ashmem_ = nullptr; - DHLOGI("UnInitAshmem success."); - } -} - -int32_t AudioCaptureLowLatencyImpl::GetCapturePosition(uint64_t &frames, AudioTimeStamp &time) -{ - DHLOGI("Get capture position, not support yet."); - (void)frames; - (void)time; - return HDF_SUCCESS; -} - -int32_t AudioCaptureLowLatencyImpl::CaptureFrame(std::vector &frame, uint64_t requestBytes) -{ - DHLOGI("Render frame. not support in low-latency capture"); - (void)devAttrs_.sampleRate; - (void)devAttrs_.channelCount; - (void)devAttrs_.format; - return HDF_SUCCESS; -} - -int32_t AudioCaptureLowLatencyImpl::Start() -{ - DHLOGI("Start capture mmap."); - DAudioEvent event = { HDF_AUDIO_EVENT_MMAP_START_MIC, "" }; - if (audioExtCallback_ == nullptr) { - DHLOGE("Callback is nullptr."); - return HDF_FAILURE; - } - int32_t ret = audioExtCallback_->NotifyEvent(adapterName_, devDesc_.pins, event); - if (ret != HDF_SUCCESS) { - DHLOGE("Start capture mmap failed."); - return HDF_FAILURE; - } - return HDF_SUCCESS; -} - -int32_t AudioCaptureLowLatencyImpl::Stop() -{ - DHLOGI("Stop capture mmap."); - DAudioEvent event = { HDF_AUDIO_EVENT_MMAP_STOP_MIC, "" }; - int32_t ret = audioExtCallback_->NotifyEvent(adapterName_, devDesc_.pins, event); - if (ret != HDF_SUCCESS) { - DHLOGE("Stop capture mmap failed."); - return HDF_FAILURE; - } - return HDF_SUCCESS; -} - -int32_t AudioCaptureLowLatencyImpl::Pause() -{ - DHLOGI("Pause capture."); - std::lock_guard captureLck(captureMtx_); - captureStatus_ = CAPTURE_STATUS_PAUSE; - return HDF_SUCCESS; -} - -int32_t AudioCaptureLowLatencyImpl::Resume() -{ - return HDF_SUCCESS; -} - -int32_t AudioCaptureLowLatencyImpl::Flush() -{ - return HDF_SUCCESS; -} - -int32_t AudioCaptureLowLatencyImpl::TurnStandbyMode() -{ - DHLOGI("Turn stand by mode, not support yet."); - return HDF_SUCCESS; -} - -int32_t AudioCaptureLowLatencyImpl::AudioDevDump(int32_t range, int32_t fd) -{ - DHLOGI("Dump audio info, not support yet."); - (void)range; - (void)fd; - return HDF_SUCCESS; -} - -int32_t AudioCaptureLowLatencyImpl::IsSupportsPauseAndResume(bool &supportPause, bool &supportResume) -{ - DHLOGI("Check whether pause and resume is supported, not support yet."); - (void)supportPause; - (void)supportResume; - return HDF_SUCCESS; -} - -int32_t AudioCaptureLowLatencyImpl::CheckSceneCapability(const AudioSceneDescriptor &scene, bool &supported) -{ - DHLOGI("Check scene capability."); - (void)scene; - supported = false; - return HDF_SUCCESS; -} - -int32_t AudioCaptureLowLatencyImpl::SelectScene(const AudioSceneDescriptor &scene) -{ - DHLOGI("Select audio scene, not support yet."); - (void)scene; - return HDF_SUCCESS; -} - -int32_t AudioCaptureLowLatencyImpl::SetMute(bool mute) -{ - DHLOGI("Set mute, not support yet."); - (void)mute; - return HDF_SUCCESS; -} - -int32_t AudioCaptureLowLatencyImpl::GetMute(bool &mute) -{ - DHLOGI("Get mute, not support yet."); - (void)mute; - return HDF_SUCCESS; -} - -int32_t AudioCaptureLowLatencyImpl::SetVolume(float volume) -{ - DHLOGI("Can not set vol not by this interface."); - (void)volume; - return HDF_SUCCESS; -} - -int32_t AudioCaptureLowLatencyImpl::GetVolume(float &volume) -{ - DHLOGI("Can not get vol not by this interface."); - (void)volume; - return HDF_SUCCESS; -} - -int32_t AudioCaptureLowLatencyImpl::GetGainThreshold(float &min, float &max) -{ - DHLOGI("Get gain threshold, not support yet."); - min = 0; - max = 0; - return HDF_SUCCESS; -} - -int32_t AudioCaptureLowLatencyImpl::SetGain(float gain) -{ - DHLOGI("Set gain, not support yet."); - (void)gain; - return HDF_SUCCESS; -} - -int32_t AudioCaptureLowLatencyImpl::GetGain(float &gain) -{ - DHLOGI("Get gain, not support yet."); - gain = 1.0; - return HDF_SUCCESS; -} - -int32_t AudioCaptureLowLatencyImpl::GetFrameSize(uint64_t &size) -{ - (void)size; - return HDF_SUCCESS; -} - -int32_t AudioCaptureLowLatencyImpl::GetFrameCount(uint64_t &count) -{ - (void)count; - return HDF_SUCCESS; -} - -int32_t AudioCaptureLowLatencyImpl::SetSampleAttributes(const AudioSampleAttributes &attrs) -{ - DHLOGI("Set sample attributes."); - devAttrs_ = attrs; - return HDF_SUCCESS; -} - -int32_t AudioCaptureLowLatencyImpl::GetSampleAttributes(AudioSampleAttributes &attrs) -{ - DHLOGI("Get sample attributes."); - attrs = devAttrs_; - return HDF_SUCCESS; -} - -int32_t AudioCaptureLowLatencyImpl::GetCurrentChannelId(uint32_t &channelId) -{ - DHLOGI("Get current channel id, not support yet."); - (void)channelId; - return HDF_SUCCESS; -} - -int32_t AudioCaptureLowLatencyImpl::SetExtraParams(const std::string &keyValueList) -{ - DHLOGI("Set extra parameters, not support yet."); - (void)keyValueList; - return HDF_SUCCESS; -} - -int32_t AudioCaptureLowLatencyImpl::GetExtraParams(std::string &keyValueList) -{ - DHLOGI("Get extra parameters, not support yet."); - (void)keyValueList; - return HDF_SUCCESS; -} - -int32_t AudioCaptureLowLatencyImpl::ReqMmapBuffer(int32_t reqSize, AudioMmapBufferDescriptor &desc) -{ - DHLOGI("Request mmap buffer."); - int32_t minSize = CalculateSampleNum(devAttrs_.sampleRate, minTimeInterval_); - int32_t maxSize = CalculateSampleNum(devAttrs_.sampleRate, maxTimeInterval_); - int32_t realSize = reqSize; - if (reqSize < minSize) { - realSize = minSize; - } else if (reqSize > maxSize) { - realSize = maxSize; - } - DHLOGI("ReqMmap buffer realsize : %d, minsize: %d, maxsize:%d.", realSize, minSize, maxSize); - desc.totalBufferFrames = realSize; - ashmemLength_ = realSize * devAttrs_.channelCount * devAttrs_.format; - DHLOGI("Init ashmem real sample size : %d, length: %d.", realSize, ashmemLength_); - int32_t ret = InitAshmem(ashmemLength_); - if (ret != HDF_SUCCESS) { - DHLOGE("Init ashmem error.."); - return HDF_FAILURE; - } - desc.memoryFd = fd_; - desc.transferFrameSize = static_cast(CalculateSampleNum(devAttrs_.sampleRate, timeInterval_)); - lengthPerTrans_ = desc.transferFrameSize * devAttrs_.channelCount * devAttrs_.format; - desc.isShareable = false; - ret = audioExtCallback_->RefreshAshmemInfo(adapterName_, devDesc_.pins, fd_, ashmemLength_, lengthPerTrans_); - if (ret != HDF_SUCCESS) { - DHLOGE("Refresh ashmem info failed."); - return HDF_FAILURE; - } - return HDF_SUCCESS; -} - -int32_t AudioCaptureLowLatencyImpl::GetMmapPosition(uint64_t &frames, AudioTimeStamp &time) -{ - DHLOGI("Get mmap position, not support yet."); - (void)frames; - (void)time; - return HDF_SUCCESS; -} - -int32_t AudioCaptureLowLatencyImpl::AddAudioEffect(uint64_t effectid) -{ - DHLOGI("Add audio effect, not support yet."); - (void)effectid; - return HDF_SUCCESS; -} - -int32_t AudioCaptureLowLatencyImpl::RemoveAudioEffect(uint64_t effectid) -{ - DHLOGI("Remove audio effect, not support yet."); - (void)effectid; - return HDF_SUCCESS; -} - -int32_t AudioCaptureLowLatencyImpl::GetFrameBufferSize(uint64_t &bufferSize) -{ - DHLOGI("Get frame buffer size, not support yet."); - (void)bufferSize; - return HDF_SUCCESS; -} -} // V1_0 -} // Audio -} // Distributedaudio -} // HDI -} // OHOS diff --git a/hdf_service/distributed_audio/hdi_service/audio/v1_0/src/audio_render_lowlatency_impl.cpp b/hdf_service/distributed_audio/hdi_service/audio/v1_0/src/audio_render_lowlatency_impl.cpp deleted file mode 100644 index 4412d9ff..00000000 --- a/hdf_service/distributed_audio/hdi_service/audio/v1_0/src/audio_render_lowlatency_impl.cpp +++ /dev/null @@ -1,443 +0,0 @@ -/* - * Copyright (c) 2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "audio_render_lowlatency_impl.h" - -#include -#include -#include "sys/time.h" - -#include "daudio_constants.h" -#include "daudio_events.h" -#include "daudio_log.h" -#include "daudio_utils.h" - -#undef DH_LOG_TAG -#define DH_LOG_TAG "AudioRenderLowLatencyImpl" - -using namespace OHOS::DistributedHardware; -namespace OHOS { -namespace HDI { -namespace DistributedAudio { -namespace Audio { -namespace V1_0 { -AudioRenderLowLatencyImpl::AudioRenderLowLatencyImpl(const std::string &adpName, const AudioDeviceDescriptor &desc, - const AudioSampleAttributes &attrs, const sptr &callback) - : AudioRenderInterfaceImplBase(desc), adapterName_(adpName), devDesc_(desc), - devAttrs_(attrs), audioExtCallback_(callback) -{ - devAttrs_.frameSize = CalculateFrameSize(attrs.sampleRate, attrs.channelCount, attrs.format, timeInterval_, true); - DHLOGI("Distributed lowlatency render constructed, id(%d). framesize(%d)", desc.pins, devAttrs_.frameSize); -} - -AudioRenderLowLatencyImpl::~AudioRenderLowLatencyImpl() -{ - UnInitAshmem(); - DHLOGI("Distributed lowlatency render destructed, id(%d).", devDesc_.pins); -} - -int32_t AudioRenderLowLatencyImpl::InitAshmem(int32_t ashmemLength) -{ - std::string memory_name = "Render ShareMemory"; - if (ashmemLength < DAUDIO_MIN_ASHMEM_LEN || ashmemLength > DAUDIO_MAX_ASHMEM_LEN) { - DHLOGE("Init ashmem failed. length is illegal"); - return HDF_FAILURE; - } - ashmem_ = OHOS::Ashmem::CreateAshmem(memory_name.c_str(), ashmemLength); - if (ashmem_ == nullptr) { - DHLOGE("Create ashmem failed."); - return HDF_FAILURE; - } - bool ret = ashmem_->MapReadAndWriteAshmem(); - if (ret != true) { - DHLOGE("Mmap ashmem failed."); - return HDF_FAILURE; - } - fd_ = ashmem_->GetAshmemFd(); - DHLOGI("Init Ashmem success, fd: %d, length: %d", fd_, ashmemLength); - return HDF_SUCCESS; -} - -void AudioRenderLowLatencyImpl::UnInitAshmem() -{ - if (ashmem_ != nullptr) { - ashmem_->UnmapAshmem(); - ashmem_->CloseAshmem(); - ashmem_ = nullptr; - DHLOGI("UnInitAshmem success."); - } -} - -int32_t AudioRenderLowLatencyImpl::GetLatency(uint32_t &ms) -{ - DHLOGI("Get render device latency, not support yet."); - ms = 0; - return HDF_SUCCESS; -} - -float AudioRenderLowLatencyImpl::GetFadeRate(uint32_t currentIndex, const uint32_t durationIndex) -{ - if (currentIndex > durationIndex) { - return 1.0f; - } - - float fadeRate = static_cast(currentIndex) / durationIndex * DAUDIO_FADE_NORMALIZATION_FACTOR; - if (fadeRate < 1) { - return pow(fadeRate, DAUDIO_FADE_POWER_NUM) / DAUDIO_FADE_NORMALIZATION_FACTOR; - } - return -pow(fadeRate - DAUDIO_FADE_MAXIMUM_VALUE, DAUDIO_FADE_POWER_NUM) / - DAUDIO_FADE_NORMALIZATION_FACTOR + 1; -} - -int32_t AudioRenderLowLatencyImpl::FadeInProcess(const uint32_t durationFrame, - int8_t* frameData, const size_t frameLength) -{ - int16_t* frame = reinterpret_cast(frameData); - const size_t newFrameLength = frameLength / 2; - - for (size_t k = 0; k < newFrameLength; ++k) { - float rate = GetFadeRate(currentFrame_ * newFrameLength + k, durationFrame * newFrameLength); - frame[k] = currentFrame_ == durationFrame - 1 ? frame[k] : static_cast(rate * frame[k]); - } - DHLOGI("Fade-in frame[currentFrame: %d].", currentFrame_); - ++currentFrame_; - currentFrame_ = currentFrame_ >= durationFrame ? durationFrame - 1 : currentFrame_; - - return HDF_SUCCESS; -} - -int32_t AudioRenderLowLatencyImpl::RenderFrame(const std::vector &frame, uint64_t &replyBytes) -{ - DHLOGI("Render frame. not support in low-latency render"); - (void)devAttrs_.sampleRate; - (void)devAttrs_.channelCount; - (void)devAttrs_.format; - - return HDF_SUCCESS; -} - -int32_t AudioRenderLowLatencyImpl::GetRenderPosition(uint64_t &frames, AudioTimeStamp &time) -{ - DHLOGI("Get render position, not support yet."); - (void)frames; - (void)time; - return HDF_SUCCESS; -} - -int32_t AudioRenderLowLatencyImpl::SetRenderSpeed(float speed) -{ - DHLOGI("Set render speed, control render speed is not support yet."); - renderSpeed_ = speed; - return HDF_SUCCESS; -} - -int32_t AudioRenderLowLatencyImpl::GetRenderSpeed(float &speed) -{ - DHLOGI("Get render speed, control render speed is not support yet."); - speed = renderSpeed_; - return HDF_SUCCESS; -} - -int32_t AudioRenderLowLatencyImpl::SetChannelMode(AudioChannelMode mode) -{ - DHLOGI("Set channel mode, control channel mode is not support yet."); - channelMode_ = mode; - return HDF_SUCCESS; -} - -int32_t AudioRenderLowLatencyImpl::GetChannelMode(AudioChannelMode &mode) -{ - DHLOGI("Get channel mode, control channel mode is not support yet."); - mode = channelMode_; - return HDF_SUCCESS; -} - -int32_t AudioRenderLowLatencyImpl::RegCallback(const sptr &audioCallback, int8_t cookie) -{ - DHLOGI("Register render callback."); - (void)cookie; - renderCallback_ = audioCallback; - return HDF_SUCCESS; -} - -int32_t AudioRenderLowLatencyImpl::DrainBuffer(AudioDrainNotifyType &type) -{ - DHLOGI("Drain audio buffer, not support yet."); - (void)type; - return HDF_SUCCESS; -} - -int32_t AudioRenderLowLatencyImpl::IsSupportsDrain(bool &support) -{ - DHLOGI("Check whether drain is supported, not support yet."); - (void)support; - return HDF_SUCCESS; -} - -int32_t AudioRenderLowLatencyImpl::Start() -{ - DHLOGI("Start render mmap."); - DAudioEvent event = { HDF_AUDIO_EVENT_MMAP_START, "" }; - if (audioExtCallback_ == nullptr) { - DHLOGE("Callback is nullptr."); - return HDF_FAILURE; - } - int32_t ret = audioExtCallback_->NotifyEvent(adapterName_, devDesc_.pins, event); - if (ret != HDF_SUCCESS) { - DHLOGE("Start render mmap failed."); - return HDF_FAILURE; - } - return HDF_SUCCESS; -} - -int32_t AudioRenderLowLatencyImpl::Stop() -{ - DHLOGI("Stop render mmap."); - DAudioEvent event = { HDF_AUDIO_EVENT_MMAP_STOP, "" }; - int32_t ret = audioExtCallback_->NotifyEvent(adapterName_, devDesc_.pins, event); - if (ret != HDF_SUCCESS) { - DHLOGE("Stop render mmap failed."); - return HDF_FAILURE; - } - return HDF_SUCCESS; -} - -int32_t AudioRenderLowLatencyImpl::Pause() -{ - DHLOGI("Pause render."); - std::lock_guard renderLck(renderMtx_); - renderStatus_ = RENDER_STATUS_PAUSE; - return HDF_SUCCESS; -} - -int32_t AudioRenderLowLatencyImpl::Resume() -{ - return HDF_SUCCESS; -} - -int32_t AudioRenderLowLatencyImpl::Flush() -{ - return HDF_SUCCESS; -} - -int32_t AudioRenderLowLatencyImpl::TurnStandbyMode() -{ - DHLOGI("Turn stand by mode, not support yet."); - return HDF_SUCCESS; -} - -int32_t AudioRenderLowLatencyImpl::AudioDevDump(int32_t range, int32_t fd) -{ - DHLOGI("Dump audio info, not support yet."); - (void)range; - (void)fd; - return HDF_SUCCESS; -} - -int32_t AudioRenderLowLatencyImpl::IsSupportsPauseAndResume(bool &supportPause, bool &supportResume) -{ - DHLOGI("Check whether pause and resume is supported, not support yet."); - (void)supportPause; - (void)supportResume; - return HDF_SUCCESS; -} - -int32_t AudioRenderLowLatencyImpl::CheckSceneCapability(const AudioSceneDescriptor &scene, bool &supported) -{ - DHLOGI("Check scene capability."); - (void)scene; - (void)supported; - return HDF_SUCCESS; -} - -int32_t AudioRenderLowLatencyImpl::SelectScene(const AudioSceneDescriptor &scene) -{ - DHLOGI("Select audio scene, not support yet."); - (void)scene; - return HDF_SUCCESS; -} - -int32_t AudioRenderLowLatencyImpl::SetMute(bool mute) -{ - DHLOGI("Set mute, not support yet."); - (void)mute; - return HDF_SUCCESS; -} - -int32_t AudioRenderLowLatencyImpl::GetMute(bool &mute) -{ - DHLOGI("Get mute, not support yet."); - (void)mute; - return HDF_SUCCESS; -} - -int32_t AudioRenderLowLatencyImpl::SetVolume(float volume) -{ - DHLOGI("Can not set vol not by this interface."); - (void)volume; - return HDF_SUCCESS; -} - -int32_t AudioRenderLowLatencyImpl::GetVolume(float &volume) -{ - DHLOGI("Can not get vol not by this interface."); - (void)volume; - return HDF_SUCCESS; -} - -int32_t AudioRenderLowLatencyImpl::GetGainThreshold(float &min, float &max) -{ - DHLOGI("Get gain threshold, not support yet."); - min = 0; - max = 0; - return HDF_SUCCESS; -} - -int32_t AudioRenderLowLatencyImpl::SetGain(float gain) -{ - DHLOGI("Set gain, not support yet."); - (void)gain; - return HDF_SUCCESS; -} - -int32_t AudioRenderLowLatencyImpl::GetGain(float &gain) -{ - DHLOGI("Get gain, not support yet."); - gain = 1.0; - return HDF_SUCCESS; -} - -int32_t AudioRenderLowLatencyImpl::GetFrameSize(uint64_t &size) -{ - (void)size; - return HDF_SUCCESS; -} - -int32_t AudioRenderLowLatencyImpl::GetFrameCount(uint64_t &count) -{ - (void)count; - return HDF_SUCCESS; -} - -int32_t AudioRenderLowLatencyImpl::SetSampleAttributes(const AudioSampleAttributes &attrs) -{ - DHLOGI("Set sample attributes."); - devAttrs_ = attrs; - return HDF_SUCCESS; -} - -int32_t AudioRenderLowLatencyImpl::GetSampleAttributes(AudioSampleAttributes &attrs) -{ - DHLOGI("Get sample attributes."); - attrs = devAttrs_; - return HDF_SUCCESS; -} - -int32_t AudioRenderLowLatencyImpl::GetCurrentChannelId(uint32_t &channelId) -{ - DHLOGI("Get current channel id, not support yet."); - (void)channelId; - return HDF_SUCCESS; -} - -int32_t AudioRenderLowLatencyImpl::SetExtraParams(const std::string &keyValueList) -{ - DHLOGI("Set extra parameters, not support yet."); - (void)keyValueList; - return HDF_SUCCESS; -} - -int32_t AudioRenderLowLatencyImpl::GetExtraParams(std::string &keyValueList) -{ - DHLOGI("Get extra parameters, not support yet."); - (void)keyValueList; - return HDF_SUCCESS; -} - -int32_t AudioRenderLowLatencyImpl::ReqMmapBuffer(int32_t reqSize, AudioMmapBufferDescriptor &desc) -{ - DHLOGI("Request mmap buffer."); - int32_t minSize = CalculateSampleNum(devAttrs_.sampleRate, minTimeInterval_); - int32_t maxSize = CalculateSampleNum(devAttrs_.sampleRate, maxTimeInterval_); - int32_t realSize = reqSize; - if (reqSize < minSize) { - realSize = minSize; - } else if (reqSize > maxSize) { - realSize = maxSize; - } - DHLOGI("ReqMmap buffer realsize : %d, minsize: %d, maxsize:%d.", realSize, minSize, maxSize); - desc.totalBufferFrames = realSize; - ashmemLength_ = static_cast(realSize * devAttrs_.channelCount * devAttrs_.format); - DHLOGI("Init ashmem real sample size : %d, length: %d.", realSize, ashmemLength_); - int32_t ret = InitAshmem(ashmemLength_); - if (ret != HDF_SUCCESS) { - DHLOGE("Init ashmem error.."); - return HDF_FAILURE; - } - desc.memoryFd = fd_; - desc.transferFrameSize = static_cast(CalculateSampleNum(devAttrs_.sampleRate, timeInterval_)); - lengthPerTrans_ = desc.transferFrameSize * devAttrs_.channelCount * devAttrs_.format; - desc.isShareable = false; - ret = audioExtCallback_->RefreshAshmemInfo(adapterName_, devDesc_.pins, fd_, ashmemLength_, lengthPerTrans_); - if (ret != HDF_SUCCESS) { - DHLOGE("Refresh ashmem info failed."); - return HDF_FAILURE; - } - return HDF_SUCCESS; -} - -int32_t AudioRenderLowLatencyImpl::GetMmapPosition(uint64_t &frames, AudioTimeStamp &time) -{ - DHLOGI("Get mmap position."); - (void)time; - if (audioExtCallback_ == nullptr) { - DHLOGE("Callback is nullptr."); - return HDF_FAILURE; - } - uint64_t timeStamp; - int32_t ret = audioExtCallback_->ReadMmapPosition(adapterName_, devDesc_.pins, frames, timeStamp); - if (ret != HDF_SUCCESS) { - DHLOGE("Read mmap position failed."); - return HDF_FAILURE; - } - DHLOGI("Read mmap position. frames: %d, timeStamp: %d", frames, timeStamp); - return HDF_SUCCESS; -} - -int32_t AudioRenderLowLatencyImpl::AddAudioEffect(uint64_t effectid) -{ - DHLOGI("Add audio effect, not support yet."); - (void)effectid; - return HDF_SUCCESS; -} - -int32_t AudioRenderLowLatencyImpl::RemoveAudioEffect(uint64_t effectid) -{ - DHLOGI("Remove audio effect, not support yet."); - (void)effectid; - return HDF_SUCCESS; -} - -int32_t AudioRenderLowLatencyImpl::GetFrameBufferSize(uint64_t &bufferSize) -{ - DHLOGI("Get frame buffer size, not support yet."); - (void)bufferSize; - return HDF_SUCCESS; -} -} // V1_0 -} // Audio -} // Distributedaudio -} // HDI -} // OHOS diff --git a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/audio_capture_lowlatency/BUILD.gn b/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/audio_capture_lowlatency/BUILD.gn deleted file mode 100644 index e6c956d0..00000000 --- a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/audio_capture_lowlatency/BUILD.gn +++ /dev/null @@ -1,56 +0,0 @@ -# Copyright (c) 2023 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import("//build/ohos.gni") -import("//build/test.gni") -import("//drivers/hdf_core/adapter/uhdf2/uhdf.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") - -module_out_path = "distributed_audio/hdf_service/hdi_service/audio" - -config("module_private_config") { - visibility = [ ":*" ] - - include_dirs = [ - "include", - "${hdf_ser_aud_path}/include", - "${hdf_ser_aud_path}/test/unittest/audio_test_utils", - "${hdf_service_path}/hdi_service/common/include", - "${hdf_service_path}/hdi_service/common/log/include", - "${hdf_service_path}/hdi_service/common/utils/include", - "//foundation/communication/ipc/interfaces/innerkits/ipc_core/include", - ] -} - -## UnitTest hdi_service_audio_v1_0_test -ohos_unittest("HDIServiceCaptureLowlatencyTest") { - module_out_path = module_out_path - - sources = [ "${hdf_ser_aud_path}/test/unittest/audio_capture_lowlatency/src/audio_capture_lowlatency_impl_test.cpp" ] - - configs = [ ":module_private_config" ] - - public_deps = [ - "${hdf_ser_aud_path}:libaudio_manager_daudio_primary_service_1.0", - "//third_party/googletest:gmock", - "//third_party/googletest:gtest_main", - ] - - external_deps = [ "c_utils:utils" ] -} - -group("hdi_service_audio_capture_lowlatency_test") { - testonly = true - deps = [ ":HDIServiceCaptureLowlatencyTest" ] -} diff --git a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/audio_capture_lowlatency/include/audio_capture_lowlatency_impl_test.h b/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/audio_capture_lowlatency/include/audio_capture_lowlatency_impl_test.h deleted file mode 100644 index e6a14c9f..00000000 --- a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/audio_capture_lowlatency/include/audio_capture_lowlatency_impl_test.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef OHOS_AUDIO_CAPTURE_LOWLATENCY_IMPL_TEST_H -#define OHOS_AUDIO_CAPTURE_LOWLATENCY_IMPL_TEST_H - -#include - -#include -#include -#include - -#include "audio_test_utils.h" -#define private public -#include "audio_capture_lowlatency_impl.h" -#undef private - -namespace OHOS { -namespace HDI { -namespace DistributedAudio { -namespace Audio { -namespace V1_0 { -using OHOS::HDI::DistributedAudio::Audioext::V1_0::AudioData; -using OHOS::HDI::DistributedAudio::Audioext::V1_0::AudioParameter; -using OHOS::HDI::DistributedAudio::Audioext::V1_0::IDAudioCallback; - -class AudioCaptureLowlatencyImplTest : public testing::Test { -public: - static void SetUpTestCase(void); - static void TearDownTestCase(void); - void SetUp(); - void TearDown(); - - std::string adpName_; - AudioDeviceDescriptor desc_; - AudioSampleAttributes attrs_; - sptr callback_; - std::shared_ptr audioCapturelatencyImpl_ = nullptr; -}; -} // V1_0 -} // Audio -} // Distributedaudio -} // HDI -} // OHOS -#endif // OHOS_AUDIO_CAPTURE_LOWLATENCY_IMPL_TEST_H - diff --git a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/audio_capture_lowlatency/src/audio_capture_lowlatency_impl_test.cpp b/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/audio_capture_lowlatency/src/audio_capture_lowlatency_impl_test.cpp deleted file mode 100644 index d14d2cb4..00000000 --- a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/audio_capture_lowlatency/src/audio_capture_lowlatency_impl_test.cpp +++ /dev/null @@ -1,205 +0,0 @@ -/* - * Copyright (c) 2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "audio_capture_lowlatency_impl_test.h" - -#include -#include -#include - -#include "ashmem.h" -#include "daudio_constants.h" -#include "daudio_log.h" - -using namespace testing::ext; - -namespace OHOS { -namespace HDI { -namespace DistributedAudio { -namespace Audio { -namespace V1_0 { -void AudioCaptureLowlatencyImplTest::SetUpTestCase(void) {} - -void AudioCaptureLowlatencyImplTest::TearDownTestCase(void) {} - -void AudioCaptureLowlatencyImplTest::SetUp(void) -{ - std::string adpName; - AudioDeviceDescriptor desc; - AudioSampleAttributes attrs; - sptr callback; - audioCapturelatencyImpl_ = std::make_shared(adpName, desc, attrs, callback); -} - -void AudioCaptureLowlatencyImplTest::TearDown(void) -{ - audioCapturelatencyImpl_ = nullptr; -} - -/** - * @tc.name: InitAshmem_001 - * @tc.desc: Verify the InitAshmem function. - * @tc.type: FUNC - * @tc.require: AR000HP6J4 - */ -HWTEST_F(AudioCaptureLowlatencyImplTest, InitAshmem_001, TestSize.Level1) -{ - int32_t ashmemLength = 1024; - EXPECT_EQ(HDF_SUCCESS, audioCapturelatencyImpl_->InitAshmem(ashmemLength)); - audioCapturelatencyImpl_->UnInitAshmem(); -} - -/** - * @tc.name: InitAshmem_002 - * @tc.desc: Verify the InitAshmem function. - * @tc.type: FUNC - * @tc.require: AR000HP6J4 - */ -HWTEST_F(AudioCaptureLowlatencyImplTest, InitAshmem_002, TestSize.Level1) -{ - int32_t ashmemLength = -1; - EXPECT_EQ(HDF_FAILURE, audioCapturelatencyImpl_->InitAshmem(ashmemLength)); - audioCapturelatencyImpl_->UnInitAshmem(); -} - -/** - * @tc.name: Start_001 - * @tc.desc: Verify the Start function. - * @tc.type: FUNC - * @tc.require: AR000HP6J4 - */ -HWTEST_F(AudioCaptureLowlatencyImplTest, Start_001, TestSize.Level1) -{ - uint64_t frames = 0; - AudioTimeStamp time; - std::vector frame; - uint64_t requestBytes = 1024; - EXPECT_EQ(HDF_SUCCESS, audioCapturelatencyImpl_->GetCapturePosition(frames, time)); - EXPECT_EQ(HDF_SUCCESS, audioCapturelatencyImpl_->CaptureFrame(frame, requestBytes)); - EXPECT_EQ(HDF_SUCCESS, audioCapturelatencyImpl_->Pause()); - EXPECT_EQ(HDF_SUCCESS, audioCapturelatencyImpl_->Resume()); - EXPECT_EQ(HDF_SUCCESS, audioCapturelatencyImpl_->Flush()); - EXPECT_EQ(HDF_SUCCESS, audioCapturelatencyImpl_->TurnStandbyMode()); - EXPECT_EQ(HDF_SUCCESS, audioCapturelatencyImpl_->GetMmapPosition(frames, time)); - audioCapturelatencyImpl_->audioExtCallback_ = new MockIDAudioCallback(); - EXPECT_EQ(HDF_SUCCESS, audioCapturelatencyImpl_->Start()); - EXPECT_EQ(HDF_SUCCESS, audioCapturelatencyImpl_->Stop()); -} - -/** - * @tc.name: Start_002 - * @tc.desc: Verify the Start function. - * @tc.type: FUNC - * @tc.require: AR000HP6J4 - */ -HWTEST_F(AudioCaptureLowlatencyImplTest, Start_002, TestSize.Level1) -{ - int32_t range = 1; - int32_t fd = 1; - bool supportPause = true; - bool supportResume = true; - AudioSceneDescriptor scene; - bool supported = true; - EXPECT_EQ(HDF_SUCCESS, audioCapturelatencyImpl_->AudioDevDump(range, fd)); - EXPECT_EQ(HDF_SUCCESS, audioCapturelatencyImpl_->IsSupportsPauseAndResume(supportPause, supportResume)); - EXPECT_EQ(HDF_SUCCESS, audioCapturelatencyImpl_->CheckSceneCapability(scene, supported)); - EXPECT_EQ(HDF_SUCCESS, audioCapturelatencyImpl_->SelectScene(scene)); - audioCapturelatencyImpl_->audioExtCallback_ = nullptr; - EXPECT_EQ(HDF_FAILURE, audioCapturelatencyImpl_->Start()); -} - -/** - * @tc.name: ReqMmapBuffer_001 - * @tc.desc: Verify the ReqMmapBuffer function. - * @tc.type: FUNC - * @tc.require: AR000HP6J4 - */ -HWTEST_F(AudioCaptureLowlatencyImplTest, ReqMmapBuffer_001, TestSize.Level1) -{ - int32_t reqSize = 30; - AudioMmapBufferDescriptor desc; - EXPECT_EQ(HDF_FAILURE, audioCapturelatencyImpl_->ReqMmapBuffer(reqSize, desc)); - audioCapturelatencyImpl_->UnInitAshmem(); -} - -/** - * @tc.name: ReqMmapBuffer_002 - * @tc.desc: Verify the ReqMmapBuffer function. - * @tc.type: FUNC - * @tc.require: AR000HP6J4 - */ -HWTEST_F(AudioCaptureLowlatencyImplTest, ReqMmapBuffer_002, TestSize.Level1) -{ - int32_t reqSize = 30; - AudioMmapBufferDescriptor desc; - struct AudioSampleAttributes captureAttr = { - .type = AUDIO_IN_MEDIA, - .interleaved = 0, - .format = AUDIO_FORMAT_TYPE_PCM_16_BIT, - .sampleRate = 48000, - .channelCount = 2, - .period = 1024, - .frameSize = 4, - .isBigEndian = false, - .isSignedData = true, - .startThreshold = 1024, - .stopThreshold = 0x7fffffff, - .silenceThreshold = 0, - .streamId = 1, - }; - audioCapturelatencyImpl_->devAttrs_ = captureAttr; - audioCapturelatencyImpl_->audioExtCallback_ = new MockIDAudioCallback(); - EXPECT_EQ(HDF_SUCCESS, audioCapturelatencyImpl_->ReqMmapBuffer(reqSize, desc)); - audioCapturelatencyImpl_->UnInitAshmem(); -} - -/** - * @tc.name: SetMute_001 - * @tc.desc: Verify the SetMute function. - * @tc.type: FUNC - * @tc.require: AR000HP6J4 - */ -HWTEST_F(AudioCaptureLowlatencyImplTest, SetMute_001, TestSize.Level1) -{ - bool mute = true; - float volume = 0.0; - float min = 0.0; - float max = 10.0; - uint64_t size = 1024; - uint32_t channelId = 0; - std::string keyValueList = "keyValueList"; - AudioSampleAttributes attrs; - EXPECT_EQ(HDF_SUCCESS, audioCapturelatencyImpl_->SetMute(mute)); - EXPECT_EQ(HDF_SUCCESS, audioCapturelatencyImpl_->GetMute(mute)); - EXPECT_EQ(HDF_SUCCESS, audioCapturelatencyImpl_->SetVolume(volume)); - EXPECT_EQ(HDF_SUCCESS, audioCapturelatencyImpl_->GetGainThreshold(min, max)); - EXPECT_EQ(HDF_SUCCESS, audioCapturelatencyImpl_->SetGain(volume)); - EXPECT_EQ(HDF_SUCCESS, audioCapturelatencyImpl_->GetGain(volume)); - EXPECT_EQ(HDF_SUCCESS, audioCapturelatencyImpl_->GetFrameSize(size)); - EXPECT_EQ(HDF_SUCCESS, audioCapturelatencyImpl_->GetFrameCount(size)); - EXPECT_EQ(HDF_SUCCESS, audioCapturelatencyImpl_->SetSampleAttributes(attrs)); - EXPECT_EQ(HDF_SUCCESS, audioCapturelatencyImpl_->GetSampleAttributes(attrs)); - EXPECT_EQ(HDF_SUCCESS, audioCapturelatencyImpl_->GetCurrentChannelId(channelId)); - EXPECT_EQ(HDF_SUCCESS, audioCapturelatencyImpl_->SetExtraParams(keyValueList)); - EXPECT_EQ(HDF_SUCCESS, audioCapturelatencyImpl_->GetExtraParams(keyValueList)); - EXPECT_EQ(HDF_SUCCESS, audioCapturelatencyImpl_->AddAudioEffect(size)); - EXPECT_EQ(HDF_SUCCESS, audioCapturelatencyImpl_->RemoveAudioEffect(size)); - EXPECT_EQ(HDF_SUCCESS, audioCapturelatencyImpl_->GetFrameBufferSize(size)); -} -} // V1_0 -} // Audio -} // Distributedaudio -} // HDI -} // OHOS \ No newline at end of file diff --git a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/audio_render_lowlatency/BUILD.gn b/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/audio_render_lowlatency/BUILD.gn deleted file mode 100644 index f015298a..00000000 --- a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/audio_render_lowlatency/BUILD.gn +++ /dev/null @@ -1,56 +0,0 @@ -# Copyright (c) 2023 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import("//build/ohos.gni") -import("//build/test.gni") -import("//drivers/hdf_core/adapter/uhdf2/uhdf.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") - -module_out_path = "distributed_audio/hdf_service/hdi_service/audio" - -config("module_private_config") { - visibility = [ ":*" ] - - include_dirs = [ - "include", - "${hdf_ser_aud_path}/include", - "${hdf_ser_aud_path}/test/unittest/audio_test_utils", - "${hdf_service_path}/hdi_service/common/include", - "${hdf_service_path}/hdi_service/common/log/include", - "${hdf_service_path}/hdi_service/common/utils/include", - "//foundation/communication/ipc/interfaces/innerkits/ipc_core/include", - ] -} - -## UnitTest hdi_service_audio_v1_0_test -ohos_unittest("HDIServiceRenderLowlatencyTest") { - module_out_path = module_out_path - - sources = [ "${hdf_ser_aud_path}/test/unittest/audio_render_lowlatency/src/audio_render_lowlatency_impl_test.cpp" ] - - configs = [ ":module_private_config" ] - - public_deps = [ - "${hdf_ser_aud_path}:libaudio_manager_daudio_primary_service_1.0", - "//third_party/googletest:gmock", - "//third_party/googletest:gtest_main", - ] - - external_deps = [ "c_utils:utils" ] -} - -group("hdi_service_audio_render_lowlatency_test") { - testonly = true - deps = [ ":HDIServiceRenderLowlatencyTest" ] -} diff --git a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/audio_render_lowlatency/include/audio_render_lowlatency_impl_test.h b/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/audio_render_lowlatency/include/audio_render_lowlatency_impl_test.h deleted file mode 100644 index 2f018ddb..00000000 --- a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/audio_render_lowlatency/include/audio_render_lowlatency_impl_test.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef OHOS_AUDIO_RENDER_LOWLATENCY_IMPL_TEST_H -#define OHOS_AUDIO_RENDER_LOWLATENCY_IMPL_TEST_H - -#include - -#include -#include -#include - -#include "audio_test_utils.h" -#define private public -#include "audio_render_lowlatency_impl.h" -#undef private - -namespace OHOS { -namespace HDI { -namespace DistributedAudio { -namespace Audio { -namespace V1_0 { -using OHOS::HDI::DistributedAudio::Audioext::V1_0::AudioData; -using OHOS::HDI::DistributedAudio::Audioext::V1_0::AudioParameter; -using OHOS::HDI::DistributedAudio::Audioext::V1_0::IDAudioCallback; - -class AudioRenderLowlatencyImplTest : public testing::Test { -public: - static void SetUpTestCase(void); - static void TearDownTestCase(void); - void SetUp(); - void TearDown(); - - std::string adpName_; - AudioDeviceDescriptor desc_; - AudioSampleAttributes attrs_; - sptr callback_; - std::shared_ptr audioRenderlatencyImpl_ = nullptr; -}; -} // V1_0 -} // Audio -} // Distributedaudio -} // HDI -} // OHOS -#endif // OHOS_AUDIO_RENDER_LOWLATENCY_IMPL_TEST_H - diff --git a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/audio_render_lowlatency/src/audio_render_lowlatency_impl_test.cpp b/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/audio_render_lowlatency/src/audio_render_lowlatency_impl_test.cpp deleted file mode 100644 index 03e5e230..00000000 --- a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/audio_render_lowlatency/src/audio_render_lowlatency_impl_test.cpp +++ /dev/null @@ -1,236 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "audio_render_lowlatency_impl_test.h" - -#include -#include -#include - -#include "ashmem.h" -#include "daudio_constants.h" -#include "daudio_log.h" - -using namespace testing::ext; - -namespace OHOS { -namespace HDI { -namespace DistributedAudio { -namespace Audio { -namespace V1_0 { -void AudioRenderLowlatencyImplTest::SetUpTestCase(void) {} - -void AudioRenderLowlatencyImplTest::TearDownTestCase(void) {} - -void AudioRenderLowlatencyImplTest::SetUp(void) -{ - std::string adpName; - AudioDeviceDescriptor desc; - AudioSampleAttributes attrs; - sptr callback; - audioRenderlatencyImpl_ = std::make_shared(adpName, desc, attrs, callback); -} - -void AudioRenderLowlatencyImplTest::TearDown(void) -{ - audioRenderlatencyImpl_ = nullptr; -} - -/** - * @tc.name: InitAshmem_001 - * @tc.desc: Verify the InitAshmem function. - * @tc.type: FUNC - * @tc.require: AR000HP6J4 - */ -HWTEST_F(AudioRenderLowlatencyImplTest, InitAshmem_001, TestSize.Level1) -{ - int fd = 1; - uint32_t ms = 0; - float speed = 0.0; - uint64_t replyBytes = 0; - int32_t ashmemLength = 1024; - const std::vector frame; - AudioTimeStamp time; - audioRenderlatencyImpl_->audioExtCallback_ = new MockIDAudioCallback(); - EXPECT_EQ(HDF_SUCCESS, audioRenderlatencyImpl_->InitAshmem(ashmemLength)); - audioRenderlatencyImpl_->UnInitAshmem(); - EXPECT_EQ(HDF_SUCCESS, audioRenderlatencyImpl_->GetRenderPosition(replyBytes, time)); - EXPECT_EQ(HDF_SUCCESS, audioRenderlatencyImpl_->RenderFrame(frame, replyBytes)); - EXPECT_EQ(HDF_SUCCESS, audioRenderlatencyImpl_->GetLatency(ms)); - EXPECT_EQ(HDF_SUCCESS, audioRenderlatencyImpl_->SetRenderSpeed(speed)); - EXPECT_EQ(HDF_SUCCESS, audioRenderlatencyImpl_->GetRenderSpeed(speed)); - EXPECT_EQ(HDF_SUCCESS, audioRenderlatencyImpl_->SetVolume(speed)); - EXPECT_EQ(HDF_SUCCESS, audioRenderlatencyImpl_->GetVolume(speed)); - EXPECT_EQ(HDF_SUCCESS, audioRenderlatencyImpl_->AudioDevDump(ashmemLength, fd)); - EXPECT_EQ(HDF_SUCCESS, audioRenderlatencyImpl_->GetMmapPosition(replyBytes, time)); -} - -/** - * @tc.name: InitAshmem_002 - * @tc.desc: Verify the InitAshmem function. - * @tc.type: FUNC - * @tc.require: AR000HP6J4 - */ -HWTEST_F(AudioRenderLowlatencyImplTest, InitAshmem_002, TestSize.Level1) -{ - int8_t cookie = 0; - bool support = true; - int32_t ashmemLength = -1; - AudioDrainNotifyType type; - AudioSceneDescriptor scene; - sptr audioCallback = nullptr; - EXPECT_EQ(HDF_SUCCESS, audioRenderlatencyImpl_->Pause()); - EXPECT_EQ(HDF_SUCCESS, audioRenderlatencyImpl_->Resume()); - EXPECT_EQ(HDF_SUCCESS, audioRenderlatencyImpl_->Flush()); - EXPECT_EQ(HDF_SUCCESS, audioRenderlatencyImpl_->TurnStandbyMode()); - EXPECT_EQ(HDF_SUCCESS, audioRenderlatencyImpl_->DrainBuffer(type)); - EXPECT_EQ(HDF_SUCCESS, audioRenderlatencyImpl_->IsSupportsPauseAndResume(support, support)); - EXPECT_EQ(HDF_SUCCESS, audioRenderlatencyImpl_->CheckSceneCapability(scene, support)); - EXPECT_EQ(HDF_SUCCESS, audioRenderlatencyImpl_->SelectScene(scene)); - EXPECT_EQ(HDF_SUCCESS, audioRenderlatencyImpl_->SetMute(support)); - EXPECT_EQ(HDF_SUCCESS, audioRenderlatencyImpl_->GetMute(support)); - EXPECT_EQ(HDF_SUCCESS, audioRenderlatencyImpl_->IsSupportsDrain(support)); - EXPECT_EQ(HDF_SUCCESS, audioRenderlatencyImpl_->RegCallback(audioCallback, cookie)); - EXPECT_EQ(HDF_FAILURE, audioRenderlatencyImpl_->InitAshmem(ashmemLength)); - audioRenderlatencyImpl_->UnInitAshmem(); -} - -/** - * @tc.name: GetFadeRate_001 - * @tc.desc: Verify the GetFadeRate function. - * @tc.type: FUNC - * @tc.require: AR000HP6J4 - */ -HWTEST_F(AudioRenderLowlatencyImplTest, GetFadeRate_001, TestSize.Level1) -{ - float min = 0.0; - float max = 10.0; - uint64_t size = 1024; - uint32_t currentIndex = 2; - const uint32_t durationIndex = 5; - AudioSampleAttributes attrs; - EXPECT_EQ(HDF_SUCCESS, audioRenderlatencyImpl_->GetGainThreshold(min, max)); - EXPECT_EQ(HDF_SUCCESS, audioRenderlatencyImpl_->SetGain(min)); - EXPECT_EQ(HDF_SUCCESS, audioRenderlatencyImpl_->GetGain(min)); - EXPECT_EQ(HDF_SUCCESS, audioRenderlatencyImpl_->GetFrameSize(size)); - EXPECT_EQ(HDF_SUCCESS, audioRenderlatencyImpl_->GetFrameCount(size)); - EXPECT_EQ(HDF_SUCCESS, audioRenderlatencyImpl_->SetSampleAttributes(attrs)); - EXPECT_EQ(HDF_SUCCESS, audioRenderlatencyImpl_->GetSampleAttributes(attrs)); - EXPECT_EQ(HDF_SUCCESS, audioRenderlatencyImpl_->GetCurrentChannelId(currentIndex)); - float fadeRate = audioRenderlatencyImpl_->GetFadeRate(currentIndex, durationIndex); - EXPECT_LE(0, fadeRate); - EXPECT_GE(0.5f, fadeRate); -} - -/** - * @tc.name: FadeInProcess_001 - * @tc.desc: Verify the FadeInProcess function. - * @tc.type: FUNC - * @tc.require: AR000HP6J4 - */ -HWTEST_F(AudioRenderLowlatencyImplTest, FadeInProcess_001, TestSize.Level1) -{ - uint64_t effectid = 0; - std::string keyValueList = "keyValueList"; - const uint32_t durationFrame = 10; - const size_t frameLength = 4096; - int8_t* frameData = new int8_t[frameLength]; - EXPECT_EQ(HDF_SUCCESS, audioRenderlatencyImpl_->SetExtraParams(keyValueList)); - EXPECT_EQ(HDF_SUCCESS, audioRenderlatencyImpl_->GetExtraParams(keyValueList)); - EXPECT_EQ(HDF_SUCCESS, audioRenderlatencyImpl_->AddAudioEffect(effectid)); - EXPECT_EQ(HDF_SUCCESS, audioRenderlatencyImpl_->RemoveAudioEffect(effectid)); - EXPECT_EQ(HDF_SUCCESS, audioRenderlatencyImpl_->GetFrameBufferSize(effectid)); - EXPECT_EQ(HDF_SUCCESS, audioRenderlatencyImpl_->GetVolumeInner()); - EXPECT_EQ(HDF_SUCCESS, audioRenderlatencyImpl_->GetMaxVolumeInner()); - EXPECT_EQ(HDF_SUCCESS, audioRenderlatencyImpl_->GetMinVolumeInner()); - audioRenderlatencyImpl_->SetVolumeInner(durationFrame); - audioRenderlatencyImpl_->SetVolumeRangeInner(durationFrame, durationFrame); - EXPECT_EQ(HDF_SUCCESS, audioRenderlatencyImpl_->FadeInProcess(durationFrame, frameData, frameLength)); -} - -/** - * @tc.name: Start_001 - * @tc.desc: Verify the Start function. - * @tc.type: FUNC - * @tc.require: AR000HP6J4 - */ -HWTEST_F(AudioRenderLowlatencyImplTest, Start_001, TestSize.Level1) -{ - audioRenderlatencyImpl_->audioExtCallback_ = new MockIDAudioCallback(); - EXPECT_EQ(HDF_SUCCESS, audioRenderlatencyImpl_->Start()); - EXPECT_EQ(HDF_SUCCESS, audioRenderlatencyImpl_->Stop()); -} - -/** - * @tc.name: Start_002 - * @tc.desc: Verify the Start function. - * @tc.type: FUNC - * @tc.require: AR000HP6J4 - */ -HWTEST_F(AudioRenderLowlatencyImplTest, Start_002, TestSize.Level1) -{ - audioRenderlatencyImpl_->audioExtCallback_ = nullptr; - EXPECT_EQ(HDF_FAILURE, audioRenderlatencyImpl_->Start()); -} - -/** - * @tc.name: ReqMmapBuffer_001 - * @tc.desc: Verify the Start function. - * @tc.type: FUNC - * @tc.require: AR000HP6J4 - */ -HWTEST_F(AudioRenderLowlatencyImplTest, ReqMmapBuffer_001, TestSize.Level1) -{ - int32_t reqSize = 30; - AudioMmapBufferDescriptor desc; - EXPECT_EQ(HDF_FAILURE, audioRenderlatencyImpl_->ReqMmapBuffer(reqSize, desc)); - audioRenderlatencyImpl_->UnInitAshmem(); -} - -/** - * @tc.name: ReqMmapBuffer_002 - * @tc.desc: Verify the Start function. - * @tc.type: FUNC - * @tc.require: AR000HP6J4 - */ -HWTEST_F(AudioRenderLowlatencyImplTest, ReqMmapBuffer_002, TestSize.Level1) -{ - int32_t reqSize = 30; - AudioMmapBufferDescriptor desc; - struct AudioSampleAttributes renderAttr = { - .type = AUDIO_IN_MEDIA, - .interleaved = 0, - .format = AUDIO_FORMAT_TYPE_PCM_16_BIT, - .sampleRate = 48000, - .channelCount = 2, - .period = 1024, - .frameSize = 4, - .isBigEndian = false, - .isSignedData = true, - .startThreshold = 1024, - .stopThreshold = 0x7fffffff, - .silenceThreshold = 0, - .streamId = 1, - }; - audioRenderlatencyImpl_->devAttrs_ = renderAttr; - audioRenderlatencyImpl_->audioExtCallback_ = new MockIDAudioCallback(); - EXPECT_EQ(HDF_SUCCESS, audioRenderlatencyImpl_->ReqMmapBuffer(reqSize, desc)); - audioRenderlatencyImpl_->UnInitAshmem(); -} -} // V1_0 -} // Audio -} // Distributedaudio -} // HDI -} // OHOS \ No newline at end of file diff --git a/services/audiocontrol/test/unittest/controlsource/BUILD.gn b/services/audiocontrol/test/unittest/controlsource/BUILD.gn index 9d53f54c..a2a22ea7 100644 --- a/services/audiocontrol/test/unittest/controlsource/BUILD.gn +++ b/services/audiocontrol/test/unittest/controlsource/BUILD.gn @@ -53,12 +53,15 @@ ohos_unittest("ControlSourceTest") { deps = [ "${services_path}/audiomanager/servicesource:distributed_audio_source", - "//base/security/access_token/interfaces/innerkits/accesstoken:libaccesstoken_sdk", - "//base/security/access_token/interfaces/innerkits/nativetoken:libnativetoken", - "//base/security/access_token/interfaces/innerkits/token_setproc:libtoken_setproc", "//third_party/googletest:gmock", "//third_party/googletest:gtest_main", ] + + external_deps = [ + "access_token:libaccesstoken_sdk", + "access_token:libnativetoken", + "access_token:libtoken_setproc", + ] } group("control_source_test") { diff --git a/services/audioprocessor/effectcomponent/BUILD.gn b/services/audioprocessor/effectcomponent/BUILD.gn deleted file mode 100644 index e0d890bf..00000000 --- a/services/audioprocessor/effectcomponent/BUILD.gn +++ /dev/null @@ -1,51 +0,0 @@ -# Copyright (c) 2023 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import("//build/ohos.gni") -import("//build/ohos_var.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") - -ohos_shared_library("daudio_effect_component") { - include_dirs = [ - "./audiopipeline/include", - "./pipelinemanager/include", - "./elements/include", - "./element_factoy/include", - "${services_path}/common/audiodata/include", - "${common_path}/include", - "${fwk_common_path}/utils/include", - ] - - sources = [ - "${services_path}/audioprocessor/effectcomponent/audiopipeline/src/pipeline_impl.cpp", - "${services_path}/audioprocessor/effectcomponent/element_factoy/src/element_factory.cpp", - "${services_path}/audioprocessor/effectcomponent/elements/src/down_stream_element.cpp", - "${services_path}/audioprocessor/effectcomponent/elements/src/render_sink_element.cpp", - "${services_path}/audioprocessor/effectcomponent/elements/src/source_element.cpp", - "${services_path}/audioprocessor/effectcomponent/pipelinemanager/src/pipeline_manager.cpp", - ] - - deps = [ "${services_path}/common:distributed_audio_utils" ] - - external_deps = [ "c_utils:utils" ] - - defines = [ - "HI_LOG_ENABLE", - "LOG_DOMAIN=0xD004100", - ] - - subsystem_name = "distributedhardware" - - part_name = "distributed_audio" -} diff --git a/services/audioprocessor/effectcomponent/audiopipeline/include/ipipeline.h b/services/audioprocessor/effectcomponent/audiopipeline/include/ipipeline.h deleted file mode 100644 index 4103b5d9..00000000 --- a/services/audioprocessor/effectcomponent/audiopipeline/include/ipipeline.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef IPIPELINE_H -#define IPIPELINE_H - -#include -#include - -#include "audio_data.h" -#include "life_cycle.h" - -namespace OHOS { -namespace DistributedHardware { -enum class PipeType { - RENDER_PIPE, - CAPTURE_PIPE, - UNKNOWN, -}; - -class IPipeline : public ILifeCycle { -public: - virtual ~IPipeline() = default; - virtual int32_t FeedData(std::shared_ptr &inData, std::shared_ptr &outData) = 0; -}; -} // DistributedHardware -} // OHOS -#endif // IPIPELINE_H \ No newline at end of file diff --git a/services/audioprocessor/effectcomponent/audiopipeline/include/life_cycle.h b/services/audioprocessor/effectcomponent/audiopipeline/include/life_cycle.h deleted file mode 100644 index a94270c2..00000000 --- a/services/audioprocessor/effectcomponent/audiopipeline/include/life_cycle.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef LIFE_CYCLE_H -#define LIFE_CYCLE_H - -#include - -namespace OHOS { -namespace DistributedHardware { -class ILifeCycle { -public: - virtual ~ILifeCycle() = default; - virtual int32_t Init(const std::string config) = 0; - virtual int32_t StartUp() = 0; - virtual int32_t ShutDown() = 0; - virtual int32_t Release() = 0; -}; -} // OHOS -} // DistributedHardware -#endif // LIFE_CYCLE_H \ No newline at end of file diff --git a/services/audioprocessor/effectcomponent/audiopipeline/include/pipeline_impl.h b/services/audioprocessor/effectcomponent/audiopipeline/include/pipeline_impl.h deleted file mode 100644 index 6c6d1e23..00000000 --- a/services/audioprocessor/effectcomponent/audiopipeline/include/pipeline_impl.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef PIPELINE_IMPL_H -#define PIPELINE_IMPL_H - -#include -#include - -#include "audio_data.h" -#include "element_factory.h" -#include "ielement.h" -#include "ipipeline.h" - -namespace OHOS { -namespace DistributedHardware { -class PipelineImpl : public IPipeline { -public: - PipelineImpl(PipeType pipeType); - ~PipelineImpl() = default; - virtual int32_t Init(const std::string config) override; - virtual int32_t StartUp() override; - virtual int32_t ShutDown() override; - virtual int32_t Release() override; - virtual int32_t FeedData(std::shared_ptr &inData, std::shared_ptr &outData) override; - int32_t BuildPipeStream(const std::list &config); - -private: - PipeType pipeType_; - std::shared_ptr sourceNode_ = nullptr; -}; -} // DistributedHardware -} // OHOS -#endif // PIPELINE_IMPL_H \ No newline at end of file diff --git a/services/audioprocessor/effectcomponent/audiopipeline/src/pipeline_impl.cpp b/services/audioprocessor/effectcomponent/audiopipeline/src/pipeline_impl.cpp deleted file mode 100644 index f7d96e5d..00000000 --- a/services/audioprocessor/effectcomponent/audiopipeline/src/pipeline_impl.cpp +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright (c) 2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "pipeline_impl.h" - -#include "daudio_errorcode.h" -#include "daudio_log.h" - -#undef DH_LOG_TAG -#define DH_LOG_TAG "PipelineImpl" - -namespace OHOS { -namespace DistributedHardware { -PipelineImpl::PipelineImpl(PipeType pipeType) - : pipeType_(pipeType) -{ - DHLOGI("Pipeline is construct, type: %d.", pipeType_); -} - -int32_t PipelineImpl::Init(const std::string config) -{ - DHLOGI("Init pipeline."); - - if (sourceNode_ == nullptr) { - DHLOGE("Source node is null."); - return ERR_DH_AUDIO_NULLPTR; - } - sourceNode_->Init(config); - return DH_SUCCESS; -} - -int32_t PipelineImpl::StartUp() -{ - if (sourceNode_ == nullptr) { - DHLOGE("Source node is null."); - return ERR_DH_AUDIO_NULLPTR; - } - sourceNode_->StartUp(); - return DH_SUCCESS; -} - -int32_t PipelineImpl::ShutDown() -{ - if (sourceNode_ == nullptr) { - DHLOGE("Source node is null."); - return ERR_DH_AUDIO_NULLPTR; - } - sourceNode_->ShutDown(); - return DH_SUCCESS; -} - -int32_t PipelineImpl::Release() -{ - if (sourceNode_ == nullptr) { - DHLOGE("Source node is null."); - return ERR_DH_AUDIO_NULLPTR; - } - sourceNode_->Release(); - - return DH_SUCCESS; -} - -int32_t PipelineImpl::FeedData(std::shared_ptr &inData, std::shared_ptr &outData) -{ - if (sourceNode_ == nullptr) { - DHLOGE("Source node is null."); - return ERR_DH_AUDIO_NULLPTR; - } - return sourceNode_->PushData(inData, outData); -} - -int32_t PipelineImpl::BuildPipeStream(const std::list &config) -{ - auto elemFac = ElementFactory(); - std::shared_ptr currentNode = elemFac.CreateElement(ElementType::SOURCE); - if (currentNode == nullptr) { - DHLOGE("Create source element node failed."); - return ERR_DH_AUDIO_NULLPTR; - } - sourceNode_ = currentNode; - - for (auto iter = ++config.begin(); iter != config.end(); iter++) { - auto elemNode = elemFac.CreateElement(*iter); - if (currentNode == nullptr) { - DHLOGE("Current pipe stream contains null node."); - return ERR_DH_AUDIO_NULLPTR; - } - currentNode->AddDownStream(elemNode); - currentNode = elemNode; - } - return DH_SUCCESS; -} -} // DistributedHardware -} // OHOS \ No newline at end of file diff --git a/services/audioprocessor/effectcomponent/element_factoy/include/element_factory.h b/services/audioprocessor/effectcomponent/element_factoy/include/element_factory.h deleted file mode 100644 index e9849cf8..00000000 --- a/services/audioprocessor/effectcomponent/element_factoy/include/element_factory.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ELEMENT_FACTORY_H -#define ELEMENT_FACTORY_H - -#include - -#include "down_stream_element.h" - -namespace OHOS { -namespace DistributedHardware { -enum class ElementType { - UNKNOWN, - SOURCE, - REF_SINK, - MIC_SINK, - BUFFER_QUEUE, - RESAMPLER, - ECHO_CANSELLER, -}; - -class ElementFactory { -public: - ElementFactory() = default; - ~ElementFactory() = default; - std::shared_ptr CreateElement(enum ElementType elementType); -}; -} // DistributedHardware -} // OHOS -#endif // ELEMENT_FACTORY_H \ No newline at end of file diff --git a/services/audioprocessor/effectcomponent/element_factoy/src/element_factory.cpp b/services/audioprocessor/effectcomponent/element_factoy/src/element_factory.cpp deleted file mode 100644 index 4f6e08ce..00000000 --- a/services/audioprocessor/effectcomponent/element_factoy/src/element_factory.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "element_factory.h" - -#include "daudio_errorcode.h" -#include "daudio_log.h" -#include "render_sink_element.h" -#include "source_element.h" - -#undef DH_LOG_TAG -#define DH_LOG_TAG "ElementFactory" - -namespace OHOS { -namespace DistributedHardware { -std::shared_ptr ElementFactory::CreateElement(ElementType elementType) -{ - switch (elementType) { - case ElementType::SOURCE: - DHLOGI("Factory: creating source."); - return std::make_shared(); - case ElementType::REF_SINK: - DHLOGI("Factory: creating sink."); - return std::make_shared(); - case ElementType::MIC_SINK: - case ElementType::BUFFER_QUEUE: - case ElementType::RESAMPLER: - case ElementType::ECHO_CANSELLER: - default: - DHLOGE("This element type is not exist."); - break; - } - return nullptr; -} -} // DistributedHardware -} // OHOS \ No newline at end of file diff --git a/services/audioprocessor/effectcomponent/elements/include/capture_sink_element.h b/services/audioprocessor/effectcomponent/elements/include/capture_sink_element.h deleted file mode 100644 index 31eb5575..00000000 --- a/services/audioprocessor/effectcomponent/elements/include/capture_sink_element.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef CAPTURE_SINK_ELEMENT_H -#define CAPTURE_SINK_ELEMENT_H - -#include "down_stream_element.h" - -namespace OHOS { -namespace DistributedHardware { - -class CaptureSinkElement : public DownStreamElement { -public: - CaptureSinkElement() = default; - ~CaptureSinkElement() = defualt; - int32_t Init(const std::string config) override; - int32_t StartUp() override; - int32_t ShutDown() override; - int32_t Release() override; - std::string GetType() override; - int32_t PushData(std::shared_ptr &inData, std::shared_ptr &outData) override; - -protected: - int32_t DoProcessData(std::shared_ptr &inData, std::shared_ptr &outData) override; - -private: - std::string elemType_ = SINK_MIC; -}; -} // OHOS -} // DistributedHardware -#endif // CAPTURE_SINK_ELEMENT_H diff --git a/services/audioprocessor/effectcomponent/elements/include/down_stream_element.h b/services/audioprocessor/effectcomponent/elements/include/down_stream_element.h deleted file mode 100644 index ffa56647..00000000 --- a/services/audioprocessor/effectcomponent/elements/include/down_stream_element.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef DOWN_STREAM_ELEMENT_H -#define DOWN_STREAM_ELEMENT_H - -#include -#include - -#include "audio_data.h" -#include "ielement.h" - -namespace OHOS { -namespace DistributedHardware { -const std::string SOURCE_REF = "source_ref"; -const std::string SOURCE_MIC = "source_mic"; -const std::string SINK_REF = "sink_ref"; -const std::string SINK_MIC = "sink_mic"; -const std::string RESAMPLER = "resampler"; -const std::string AEC = "aec"; -const std::string BUFFER_QUEUE = "buffer_queue"; - -class DownStreamElement : public IElement { -public: - virtual ~DownStreamElement() {} - int32_t AddDownStream(const std::shared_ptr &element); -protected: - const std::unordered_set>& GetDownStreams(); - virtual int32_t DoProcessData(std::shared_ptr &inData, std::shared_ptr &outData) = 0; - -private: - std::unordered_set> downStreams_; -}; -} // DistributedHardware -} // OHOS -#endif // DOWN_STREAM_ELEMENT_H \ No newline at end of file diff --git a/services/audioprocessor/effectcomponent/elements/include/ielement.h b/services/audioprocessor/effectcomponent/elements/include/ielement.h deleted file mode 100644 index 40e5df34..00000000 --- a/services/audioprocessor/effectcomponent/elements/include/ielement.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef IELEMENT_H -#define IELEMENT_H - -#include -#include - -#include "audio_data.h" -#include "life_cycle.h" - -namespace OHOS { -namespace DistributedHardware { -class IElement : public ILifeCycle { -public: - virtual ~IElement() = default; - virtual std::string GetType() = 0; - virtual int32_t PushData(std::shared_ptr &inData, std::shared_ptr &outData) = 0; -}; -} // OHOS -} // DistributedHardware -#endif // IELEMENT_H \ No newline at end of file diff --git a/services/audioprocessor/effectcomponent/elements/include/render_sink_element.h b/services/audioprocessor/effectcomponent/elements/include/render_sink_element.h deleted file mode 100644 index baccefbe..00000000 --- a/services/audioprocessor/effectcomponent/elements/include/render_sink_element.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef RENDER_SINK_ELEMENT_H -#define RENDER_SINK_ELEMENT_H - -#include "down_stream_element.h" - -namespace OHOS { -namespace DistributedHardware { - -class RenderSinkElement : public DownStreamElement { -public: - RenderSinkElement() = default; - ~RenderSinkElement() = default; - int32_t Init(const std::string config) override; - int32_t StartUp() override; - int32_t ShutDown() override; - int32_t Release() override; - std::string GetType() override; - int32_t PushData(std::shared_ptr &inData, std::shared_ptr &outData) override; - -protected: - int32_t DoProcessData(std::shared_ptr &inData, std::shared_ptr &outData) override; - -private: - std::string elemType_ = SINK_REF; -}; -} // OHOS -} // DistributedHardware -#endif // RENDER_SINK_ELEMENT_H \ No newline at end of file diff --git a/services/audioprocessor/effectcomponent/elements/include/source_element.h b/services/audioprocessor/effectcomponent/elements/include/source_element.h deleted file mode 100644 index 6023bae6..00000000 --- a/services/audioprocessor/effectcomponent/elements/include/source_element.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef SOURCE_ELEMENT_H -#define SOURCE_ELEMENT_H - -#include "down_stream_element.h" - -namespace OHOS { -namespace DistributedHardware { - -class SourceElement : public DownStreamElement { -public: - SourceElement() = default; - ~SourceElement() = default; - int32_t Init(const std::string config) override; - int32_t StartUp() override; - int32_t ShutDown() override; - int32_t Release() override; - std::string GetType() override; - int32_t PushData(std::shared_ptr &inData, std::shared_ptr &outData) override; - -protected: - int32_t DoProcessData(std::shared_ptr &inData, std::shared_ptr &outData) override; - -private: - std::string elemType_ = SOURCE_REF; -}; -} // OHOS -} // DistributedHardware -#endif // SOURCE_ELEMENT_H \ No newline at end of file diff --git a/services/audioprocessor/effectcomponent/elements/src/capture_sink_element.cpp b/services/audioprocessor/effectcomponent/elements/src/capture_sink_element.cpp deleted file mode 100644 index ccdc8674..00000000 --- a/services/audioprocessor/effectcomponent/elements/src/capture_sink_element.cpp +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright (c) 2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "capture_sink_element.h" - -#include "daudio_errorcode.h" -#include "daudio_log.h" - -#undef DH_LOG_TAG -#define DH_LOG_TAG "CaptureSinkElement" - -using namespace std; -namespace OHOS { -namespace DistributedHardware { -int32_t CaptureSinkElement::Init(const std::string config) -{ - DHLOGI("[init prcedure] : %s", GetType().c_str()); - for (auto &&obj : GetDownStreams()) { - if (obj == nullptr) { - DHLOGE("Next node is null, type: %d.", GetType().c_str()); - return ERR_DH_AUDIO_NULLPTR; - } - int32_t ret = obj->Init(config); - if (ret != DH_SUCCESS) { - DHLOGE("Current node init failed."); - return ERR_DH_AUDIO_FAILED; - } - } - return DH_SUCCESS; -} - -int32_t CaptureSinkElement::StartUp() -{ - DHLOGI("[startup prcedure] : %s", GetType().c_str()); - for (auto &&obj : GetDownStreams()) { - if (obj == nullptr) { - DHLOGE("Next node is null, type: %d.", GetType().c_str()); - return ERR_DH_AUDIO_NULLPTR; - } - int32_t ret = obj->StartUp(); - if (ret != DH_SUCCESS) { - DHLOGE("Current node start up failed."); - return ERR_DH_AUDIO_FAILED; - } - } - return DH_SUCCESS; -} - -int32_t CaptureSinkElement::ShutDown() -{ - DHLOGI("[shutdown prcedure] : %s", GetType().c_str()); - for (auto &&obj : GetDownStreams()) { - if (obj == nullptr) { - DHLOGE("Next node is null, type: %d.", GetType().c_str()); - return ERR_DH_AUDIO_NULLPTR; - } - int32_t ret = obj->ShutDown(); - if (ret != DH_SUCCESS) { - DHLOGE("Current node shut down failed."); - return ERR_DH_AUDIO_FAILED; - } - } - return DH_SUCCESS; -} - -int32_t CaptureSinkElement::Release() -{ - DHLOGI("[release prcedure] : %s", GetType().c_str()); - for (auto &&obj : GetDownStreams()) { - if (obj == nullptr) { - DHLOGE("Next node is null, type: %d.", GetType().c_str()); - return ERR_DH_AUDIO_NULLPTR; - } - int32_t ret = obj->Release(); - if (ret != DH_SUCCESS) { - DHLOGE("Current node release failed."); - return ERR_DH_AUDIO_FAILED; - } - } - return DH_SUCCESS; -} -std::string CaptureSinkElement::GetType() -{ - return elemType_; -} -int32_t CaptureSinkElement::PushData(std::shared_ptr &inData, std::shared_ptr &outData) -{ - std::shared_ptr tmpData; - int32_t ret = DoProcessData(inData, tmpData); - if (ret != DH_SUCCESS) { - DHLOGI("Current element process data failed."); - return ERR_DH_AUDIO_FAILED; - } - for (auto &&obj : GetDownStreams()) { - if (obj == nullptr) { - DHLOGE("Next node is null, type: %d.", GetType().c_str()); - return ERR_DH_AUDIO_NULLPTR; - } - ret = obj->PushData(tmpData, outData); - if (ret != DH_SUCCESS) { - DHLOGE("Current node release failed."); - return ERR_DH_AUDIO_FAILED; - } - } - return DH_SUCCESS; -} -int32_t CaptureSinkElement::DoProcessData(std::shared_ptr &inData, std::shared_ptr &outData) -{ - DHLOGI("Element of type: %s is processing data.", GetType().c_str()); - (void)inData; - (void)outData; - return DH_SUCCESS; -} -} // DistributedHardware -} // OHOS \ No newline at end of file diff --git a/services/audioprocessor/effectcomponent/elements/src/down_stream_element.cpp b/services/audioprocessor/effectcomponent/elements/src/down_stream_element.cpp deleted file mode 100644 index 5c1a00e8..00000000 --- a/services/audioprocessor/effectcomponent/elements/src/down_stream_element.cpp +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "down_stream_element.h" - -#include "daudio_errorcode.h" -#include "daudio_log.h" - -#undef DH_LOG_TAG -#define DH_LOG_TAG "DownStreamElement" -namespace OHOS { -namespace DistributedHardware { -int32_t DownStreamElement::AddDownStream(const std::shared_ptr &element) -{ - downStreams_.insert(element); - return DH_SUCCESS; -} - -const std::unordered_set>& DownStreamElement::GetDownStreams() -{ - return downStreams_; -} -} // DistributedHardware -} // OHOS \ No newline at end of file diff --git a/services/audioprocessor/effectcomponent/elements/src/render_sink_element.cpp b/services/audioprocessor/effectcomponent/elements/src/render_sink_element.cpp deleted file mode 100644 index a6739eaf..00000000 --- a/services/audioprocessor/effectcomponent/elements/src/render_sink_element.cpp +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright (c) 2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "render_sink_element.h" - -#include "daudio_errorcode.h" -#include "daudio_log.h" - -#undef DH_LOG_TAG -#define DH_LOG_TAG "RenderSinkElement" - -using namespace std; -namespace OHOS { -namespace DistributedHardware { -int32_t RenderSinkElement::Init(const std::string config) -{ - DHLOGI("[init procedure] : %s", GetType().c_str()); - for (auto &&obj : GetDownStreams()) { - if (obj == nullptr) { - DHLOGE("Next node is null, type: %d.", GetType().c_str()); - return ERR_DH_AUDIO_NULLPTR; - } - int32_t ret = obj->Init(config); - if (ret != DH_SUCCESS) { - DHLOGE("Current node init failed."); - return ERR_DH_AUDIO_FAILED; - } - } - return DH_SUCCESS; -} - -int32_t RenderSinkElement::StartUp() -{ - DHLOGI("[startup procedure] : %s", GetType().c_str()); - for (auto &&obj : GetDownStreams()) { - if (obj == nullptr) { - DHLOGE("Next node is null, type: %d.", GetType().c_str()); - return ERR_DH_AUDIO_NULLPTR; - } - int32_t ret = obj->StartUp(); - if (ret != DH_SUCCESS) { - DHLOGE("Current node start up failed."); - return ERR_DH_AUDIO_FAILED; - } - } - return DH_SUCCESS; -} - -int32_t RenderSinkElement::ShutDown() -{ - DHLOGI("[shutdown procedure] : %s", GetType().c_str()); - for (auto &&obj : GetDownStreams()) { - if (obj == nullptr) { - DHLOGE("Next node is null, type: %d.", GetType().c_str()); - return ERR_DH_AUDIO_NULLPTR; - } - int32_t ret = obj->ShutDown(); - if (ret != DH_SUCCESS) { - DHLOGE("Current node shut down failed."); - return ERR_DH_AUDIO_FAILED; - } - } - return DH_SUCCESS; -} - -int32_t RenderSinkElement::Release() -{ - DHLOGI("[release procedure] : %s", GetType().c_str()); - for (auto &&obj : GetDownStreams()) { - if (obj == nullptr) { - DHLOGE("Next node is null, type: %d.", GetType().c_str()); - return ERR_DH_AUDIO_NULLPTR; - } - int32_t ret = obj->Release(); - if (ret != DH_SUCCESS) { - DHLOGE("Current node release failed."); - return ERR_DH_AUDIO_FAILED; - } - } - return DH_SUCCESS; -} - -std::string RenderSinkElement::GetType() -{ - return elemType_; -} - -int32_t RenderSinkElement::PushData(std::shared_ptr &inData, std::shared_ptr &outData) -{ - std::shared_ptr tmpData; - int32_t ret = DoProcessData(inData, tmpData); - if (ret != DH_SUCCESS) { - DHLOGI("Current element process data failed."); - return ERR_DH_AUDIO_FAILED; - } - for (auto &&obj : GetDownStreams()) { - if (obj == nullptr) { - DHLOGE("Next node is null, type: %d.", GetType().c_str()); - return ERR_DH_AUDIO_NULLPTR; - } - ret = obj->PushData(tmpData, outData); - if (ret != DH_SUCCESS) { - DHLOGE("Current node release failed."); - return ERR_DH_AUDIO_FAILED; - } - } - return DH_SUCCESS; -} - -int32_t RenderSinkElement::DoProcessData(std::shared_ptr &inData, std::shared_ptr &outData) -{ - DHLOGI("Element of type: %s is processing data.", GetType().c_str()); - (void)inData; - (void)outData; - return DH_SUCCESS; -} -} // DistributedHardware -} // OHOS \ No newline at end of file diff --git a/services/audioprocessor/effectcomponent/elements/src/source_element.cpp b/services/audioprocessor/effectcomponent/elements/src/source_element.cpp deleted file mode 100644 index 74ceaf48..00000000 --- a/services/audioprocessor/effectcomponent/elements/src/source_element.cpp +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright (c) 2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "source_element.h" - -#include "daudio_errorcode.h" -#include "daudio_log.h" - -#undef DH_LOG_TAG -#define DH_LOG_TAG "SourceElement" - -namespace OHOS { -namespace DistributedHardware { -int32_t SourceElement::Init(std::string config) -{ - DHLOGI("[init procedure] : %s", GetType().c_str()); - for (auto &&obj : GetDownStreams()) { - if (obj == nullptr) { - DHLOGE("Next node is null, type: %d.", GetType().c_str()); - return ERR_DH_AUDIO_NULLPTR; - } - int32_t ret = obj->Init(config); - if (ret != DH_SUCCESS) { - DHLOGE("Current node init failed."); - return ERR_DH_AUDIO_FAILED; - } - } - return DH_SUCCESS; -} - -int32_t SourceElement::StartUp() -{ - DHLOGI("[startup procedure] : %s", GetType().c_str()); - for (auto &&obj : GetDownStreams()) { - if (obj == nullptr) { - DHLOGE("Next node is null, type: %d.", GetType().c_str()); - return ERR_DH_AUDIO_NULLPTR; - } - int32_t ret = obj->StartUp(); - if (ret != DH_SUCCESS) { - DHLOGE("Current node start up failed."); - return ERR_DH_AUDIO_FAILED; - } - } - return DH_SUCCESS; -} - -int32_t SourceElement::ShutDown() -{ - DHLOGI("[shutdown procedure] : %s", GetType().c_str()); - for (auto &&obj : GetDownStreams()) { - if (obj == nullptr) { - DHLOGE("Next node is null, type: %d.", GetType().c_str()); - return ERR_DH_AUDIO_NULLPTR; - } - int32_t ret = obj->ShutDown(); - if (ret != DH_SUCCESS) { - DHLOGE("Current node shut down failed."); - return ERR_DH_AUDIO_FAILED; - } - } - return DH_SUCCESS; -} - -int32_t SourceElement::Release() -{ - DHLOGI("[release procedure] : %s", GetType().c_str()); - for (auto &&obj : GetDownStreams()) { - if (obj == nullptr) { - DHLOGE("Next node is null, type: %d.", GetType().c_str()); - return ERR_DH_AUDIO_NULLPTR; - } - int32_t ret = obj->Release(); - if (ret != DH_SUCCESS) { - DHLOGE("Current node release failed."); - return ERR_DH_AUDIO_FAILED; - } - } - return DH_SUCCESS; -} - -std::string SourceElement::GetType() -{ - return elemType_; -} - -int32_t SourceElement::PushData(std::shared_ptr &inData, std::shared_ptr &outData) -{ - std::shared_ptr tmpData; - int32_t ret = DoProcessData(inData, tmpData); - if (ret != DH_SUCCESS) { - DHLOGI("Current element process data failed."); - return ERR_DH_AUDIO_FAILED; - } - for (auto &&obj : GetDownStreams()) { - if (obj == nullptr) { - DHLOGE("Next node is null, type: %d.", GetType().c_str()); - return ERR_DH_AUDIO_NULLPTR; - } - ret = obj->PushData(tmpData, outData); - if (ret != DH_SUCCESS) { - DHLOGE("Current node release failed."); - return ERR_DH_AUDIO_FAILED; - } - } - return DH_SUCCESS; -} - -int32_t SourceElement::DoProcessData(std::shared_ptr &inData, std::shared_ptr &outData) -{ - DHLOGI("Element of type: %s is processing data.", GetType().c_str()); - (void)inData; - (void)outData; - return DH_SUCCESS; -} -} // DistributedHardware -} // OHOS \ No newline at end of file diff --git a/services/audioprocessor/effectcomponent/pipelinemanager/include/pipeline_manager.h b/services/audioprocessor/effectcomponent/pipelinemanager/include/pipeline_manager.h deleted file mode 100644 index 8ee8f53b..00000000 --- a/services/audioprocessor/effectcomponent/pipelinemanager/include/pipeline_manager.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef DAUDIO_EFFECT_COMPONENT_H -#define DAUDIO_EFFECT_COMPONENT_H - -#include -#include -#include - -#include "element_factory.h" -#include "ipipeline.h" -#include "single_instance.h" - -namespace OHOS { -namespace DistributedHardware { -constexpr int32_t ERR_PIPE_ID = -1; -constexpr int32_t INITIAL_PIPE_ID = -1; -constexpr int32_t MAX_PIPELINE_SIZE = 1000000; - -class PipelineManager { - DECLARE_SINGLE_INSTANCE_BASE(PipelineManager); -public: - int32_t CreatePipeline(const PipeType &pipeType, const std::list &config, - std::shared_ptr &pipe); - int32_t ClearPipeline(int32_t pipeId); - -private: - PipelineManager() = default; - ~PipelineManager() = default; - int32_t GeneratePipeId(); - bool CheckPipeConfig(const std::list &config); - -private: - std::map> mapPipelines_; -}; -} // DistributedHardware -} // OHOS -#endif // DAUDIO_EFFECT_COMPONENT_H \ No newline at end of file diff --git a/services/audioprocessor/effectcomponent/pipelinemanager/src/pipeline_manager.cpp b/services/audioprocessor/effectcomponent/pipelinemanager/src/pipeline_manager.cpp deleted file mode 100644 index 9f7b1495..00000000 --- a/services/audioprocessor/effectcomponent/pipelinemanager/src/pipeline_manager.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "pipeline_manager.h" - -#include "daudio_errorcode.h" -#include "daudio_log.h" - -#include "ipipeline.h" -#include "pipeline_impl.h" - -#undef DH_LOG_TAG -#define DH_LOG_TAG "PipelineManager" -namespace OHOS { -namespace DistributedHardware { -IMPLEMENT_SINGLE_INSTANCE(PipelineManager); - -int32_t PipelineManager::CreatePipeline(const PipeType &pipeType, - const std::list &config, std::shared_ptr &pipe) -{ - DHLOGI("Pipeline is creating, type: %d", static_cast(pipeType)); - if (CheckPipeConfig(config) != true) { - DHLOGE("Pipeline config error."); - return ERR_PIPE_ID; - } - auto pipeImpl = std::make_shared(pipeType); - if (pipeImpl == nullptr) { - DHLOGE("Creating pipeline failed."); - return ERR_PIPE_ID; - } - int32_t ret = pipeImpl->BuildPipeStream(config); - if (ret != DH_SUCCESS) { - DHLOGE("Build pipe stream failed."); - return ERR_PIPE_ID; - } - - pipe = pipeImpl; - int32_t pipeId = GeneratePipeId(); - if (pipeId == ERR_PIPE_ID) { - DHLOGE("Pipeline ID generated error."); - return ERR_PIPE_ID; - } - mapPipelines_[pipeId] = pipe; - return pipeId; -} - -int32_t PipelineManager::ClearPipeline(int32_t pipeId) -{ - DHLOGI("Clearing pipeline."); - auto ret = mapPipelines_.find(pipeId); - if (ret == mapPipelines_.end()) { - DHLOGE("pipe ID is not exist."); - return ERR_DH_AUDIO_FAILED; - } - mapPipelines_.erase(pipeId); - return DH_SUCCESS; -} - -int32_t PipelineManager::GeneratePipeId() -{ - static int32_t pipeId = INITIAL_PIPE_ID; - ++pipeId; - if (pipeId > MAX_PIPELINE_SIZE) { - DHLOGE("Pipe number is out the max size."); - return ERR_PIPE_ID; - } - return pipeId; -} - -bool PipelineManager::CheckPipeConfig(const std::list &config) -{ - DHLOGI("Checking pipeline's configure."); - if (config.front() != ElementType::SOURCE) { - return false; - } - if (config.back() != ElementType::REF_SINK && config.back() != ElementType::MIC_SINK) { - return false; - } - return true; -} -} // DistributedHardware -} // OHOS \ No newline at end of file diff --git a/services/audioprocessor/lowlatencyprocessor/include/audio_lowlatency_processor.h b/services/audioprocessor/lowlatencyprocessor/include/audio_lowlatency_processor.h deleted file mode 100644 index 9f765044..00000000 --- a/services/audioprocessor/lowlatencyprocessor/include/audio_lowlatency_processor.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef OHOS_IAUDIO_LOWLATENCY_PROCESSOR_H -#define OHOS_IAUDIO_LOWLATENCY_PROCESSOR_H - -#include - -#include "audio_data.h" -#include "audio_event.h" -#include "audio_param.h" -#include "iaudio_codec.h" -#include "iaudio_codec_callback.h" -#include "iaudio_processor.h" -#include "iaudio_processor_callback.h" - -namespace OHOS { -namespace DistributedHardware { -class AudioLowlatencyProcessor : public IAudioProcessor, - public std::enable_shared_from_this { -public: - AudioLowlatencyProcessor() = default; - ~AudioLowlatencyProcessor() = default; - - int32_t ConfigureAudioProcessor(const AudioCommonParam &localDevParam, const AudioCommonParam &remoteDevParam, - const std::shared_ptr &procCallback) override; - int32_t ReleaseAudioProcessor() override; - int32_t StartAudioProcessor() override; - int32_t StopAudioProcessor() override; - int32_t FeedAudioProcessor(const std::shared_ptr &inputData) override; - -private: - std::weak_ptr procCallback_; -}; -} // namespace DistributedHardware -} // namespace OHOS -#endif // OHOS_IAUDIO_ENCODER_PROCESSOR_H diff --git a/services/audioprocessor/lowlatencyprocessor/src/audio_lowlatency_processor.cpp b/services/audioprocessor/lowlatencyprocessor/src/audio_lowlatency_processor.cpp deleted file mode 100644 index 2aa587c2..00000000 --- a/services/audioprocessor/lowlatencyprocessor/src/audio_lowlatency_processor.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "audio_lowlatency_processor.h" - -#include "daudio_constants.h" -#include "daudio_errorcode.h" -#include "daudio_hisysevent.h" -#include "daudio_hitrace.h" -#include "daudio_log.h" - -#undef DH_LOG_TAG -#define DH_LOG_TAG "AudioLowlatencyProcessor" - -namespace OHOS { -namespace DistributedHardware { -int32_t AudioLowlatencyProcessor::ConfigureAudioProcessor(const AudioCommonParam &localDevParam, - const AudioCommonParam &remoteDevParam, const std::shared_ptr &procCallback) -{ - DHLOGI("Configure audio processor."); - if (procCallback == nullptr) { - DHLOGE("Processor callback is null."); - return ERR_DH_AUDIO_BAD_VALUE; - } - procCallback_ = procCallback; - DHLOGI("Frame size is not default 4096, do not need to config audio processor."); - return DH_SUCCESS; -} - -int32_t AudioLowlatencyProcessor::ReleaseAudioProcessor() -{ - DHLOGI("Release audio processor."); - return DH_SUCCESS; -} - -int32_t AudioLowlatencyProcessor::StartAudioProcessor() -{ - DHLOGI("Start audio processor."); - return DH_SUCCESS; -} - -int32_t AudioLowlatencyProcessor::StopAudioProcessor() -{ - DHLOGI("Stop audio processor."); - return DH_SUCCESS; -} - -int32_t AudioLowlatencyProcessor::FeedAudioProcessor(const std::shared_ptr &inputData) -{ - DHLOGD("Feed audio processor."); - if (inputData == nullptr) { - DHLOGE("Input data is null."); - return ERR_DH_AUDIO_BAD_VALUE; - } - auto cbObj = procCallback_.lock(); - if (cbObj == nullptr) { - DHLOGE("Processor callback is null."); - return ERR_DH_AUDIO_BAD_VALUE; - } - cbObj->OnAudioDataDone(inputData); - return DH_SUCCESS; -} -} // namespace DistributedHardware -} // namespace OHOS \ No newline at end of file diff --git a/services/audiotransport/audiotransportstatus/BUILD.gn b/services/audiotransport/audiotransportstatus/BUILD.gn index b99fc76c..59171db8 100644 --- a/services/audiotransport/audiotransportstatus/BUILD.gn +++ b/services/audiotransport/audiotransportstatus/BUILD.gn @@ -9,7 +9,7 @@ # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and -# limitations under the License. +# limitations under the License. import("//build/ohos.gni") import("//build/ohos_var.gni") @@ -18,9 +18,6 @@ import( ohos_shared_library("distributed_audio_transport_status") { include_dirs = [ - "//base/hiviewdfx/hisysevent/interfaces/native/innerkits/hisysevent/include", - "//base/hiviewdfx/hitrace/interfaces/native/innerkits/include/hitrace_meter", - "//foundation/communication/dsoftbus/interfaces/kits/transport", "${fwk_common_path}/utils/include", "${mediastandard_path}/interfaces/innerkits/native/media/include", "${mediastandardfwk_path}/audiocommon/include", @@ -58,7 +55,9 @@ ohos_shared_library("distributed_audio_transport_status") { external_deps = [ "c_utils:utils", + "dsoftbus:softbus_client", "hitrace_native:hitrace_meter", + "hisysevent_native:libhisysevent", "multimedia_player_framework:media_client", ] diff --git a/services/audiotransport/test/unittest/audiotransportstatus/BUILD.gn b/services/audiotransport/test/unittest/audiotransportstatus/BUILD.gn index 6529a501..da81225e 100644 --- a/services/audiotransport/test/unittest/audiotransportstatus/BUILD.gn +++ b/services/audiotransport/test/unittest/audiotransportstatus/BUILD.gn @@ -9,7 +9,7 @@ # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and -# limitations under the License. +# limitations under the License. import("//build/ohos.gni") import("//build/ohos_var.gni") @@ -24,9 +24,6 @@ config("module_private_config") { visibility = [ ":*" ] include_dirs = [ - "//base/hiviewdfx/hisysevent/interfaces/native/innerkits/hisysevent/include", - "//base/hiviewdfx/hitrace/interfaces/native/innerkits/include/hitrace_meter", - "//foundation/communication/dsoftbus/interfaces/kits/transport", "${fwk_common_path}/utils/include", "${mediastandard_path}/interfaces/innerkits/native/media/include", "${mediastandardfwk_path}/audiocommon/include", @@ -67,6 +64,8 @@ ohos_unittest("TransportStatusTest") { "//third_party/googletest:gtest_main", ] + external_deps = [ "dsoftbus:softbus_client" ] + defines = [ "HI_LOG_ENABLE", "DH_LOG_TAG=\"daudio_trans_test\"", -- Gitee From ac01363e0ee5b112c24fbfdb1dcf04d89fad5835 Mon Sep 17 00:00:00 2001 From: w30042960 Date: Thu, 13 Apr 2023 16:06:38 +0800 Subject: [PATCH 8/9] modify gn Signed-off-by: w30042960 --- audiohandler/BUILD.gn | 3 +-- audiohandler/test/unittest/BUILD.gn | 3 +-- bundle.json | 6 +++--- common/dfx_utils/test/unittest/BUILD.gn | 3 +-- hdf_interfaces/distributed_audio/bundle.json | 8 +++++--- hdf_service/distributed_audio/bundle.json | 8 +++++--- .../distributed_audio/hdi_service/audio/v1_0/BUILD.gn | 3 +-- .../audio/v1_0/test/fuzztest/captureframe_fuzzer/BUILD.gn | 3 +-- .../v1_0/test/fuzztest/createcapture_fuzzer/BUILD.gn | 3 +-- .../audio/v1_0/test/fuzztest/createrender_fuzzer/BUILD.gn | 3 +-- .../v1_0/test/fuzztest/destroycapture_fuzzer/BUILD.gn | 3 +-- .../v1_0/test/fuzztest/destroyrender_fuzzer/BUILD.gn | 3 +-- .../v1_0/test/fuzztest/getalladapters_fuzzer/BUILD.gn | 3 +-- .../v1_0/test/fuzztest/getextraparams_fuzzer/BUILD.gn | 3 +-- .../audio/v1_0/test/fuzztest/loadadapter_fuzzer/BUILD.gn | 3 +-- .../audio/v1_0/test/fuzztest/renderframe_fuzzer/BUILD.gn | 3 +-- .../v1_0/test/fuzztest/setextraparams_fuzzer/BUILD.gn | 3 +-- .../v1_0/test/fuzztest/unloadadapter_fuzzer/BUILD.gn | 3 +-- .../hdi_service/audio/v1_0/test/unittest/BUILD.gn | 3 +-- .../v1_0/test/unittest/audio_adapter_interface/BUILD.gn | 3 +-- .../v1_0/test/unittest/audio_capture_interface/BUILD.gn | 3 +-- .../v1_0/test/unittest/audio_manager_interface/BUILD.gn | 3 +-- .../v1_0/test/unittest/audio_render_interface/BUILD.gn | 3 +-- .../distributed_audio/hdi_service/audio_ext/v1_0/BUILD.gn | 3 +-- .../v1_0/test/fuzztest/notifyevent_fuzzer/BUILD.gn | 3 +-- .../test/fuzztest/registeraudiodevice_fuzzer/BUILD.gn | 3 +-- .../test/fuzztest/unregisteraudiodevice_fuzzer/BUILD.gn | 3 +-- .../hdi_service/audio_ext/v1_0/test/unittest/BUILD.gn | 3 +-- interfaces/inner_kits/native_cpp/audio_sink/BUILD.gn | 3 +-- interfaces/inner_kits/native_cpp/audio_source/BUILD.gn | 3 +-- interfaces/inner_kits/native_cpp/test/fuzztest/BUILD.gn | 3 +-- .../test/fuzztest/onremotesinksvrdied_fuzzer/BUILD.gn | 3 +-- .../test/fuzztest/onremotesourcesvrdied_fuzzer/BUILD.gn | 3 +-- .../fuzztest/sinkhandlerfinishstartsa_fuzzer/BUILD.gn | 3 +-- .../test/fuzztest/sinkhandlerinitsink_fuzzer/BUILD.gn | 3 +-- .../sinkhandlersubscribelocalhardware_fuzzer/BUILD.gn | 3 +-- .../sinkhandlerunsubscribelocalhardware_fuzzer/BUILD.gn | 3 +-- .../fuzztest/sinkonloadsystemabilityfail_fuzzer/BUILD.gn | 3 +-- .../sinkonloadsystemabilitysuccess_fuzzer/BUILD.gn | 3 +-- .../test/fuzztest/sinkproxydaudionotify_fuzzer/BUILD.gn | 3 +-- .../test/fuzztest/sinkproxyinitsink_fuzzer/BUILD.gn | 3 +-- .../sinkproxysubscribelocalhardware_fuzzer/BUILD.gn | 3 +-- .../sinkproxyunsubscribelocalhardware_fuzzer/BUILD.gn | 3 +-- .../BUILD.gn | 3 +-- .../fuzztest/sourcehandlerfinishstartsa_fuzzer/BUILD.gn | 3 +-- .../test/fuzztest/sourcehandlerinitsource_fuzzer/BUILD.gn | 3 +-- .../BUILD.gn | 3 +-- .../BUILD.gn | 3 +-- .../sourceipccallbackonnotifyregresult_fuzzer/BUILD.gn | 3 +-- .../sourceipccallbackonnotifyunregresult_fuzzer/BUILD.gn | 3 +-- .../sourceonloadsystemabilityfail_fuzzer/BUILD.gn | 3 +-- .../sourceonloadsystemabilitysuccess_fuzzer/BUILD.gn | 3 +-- .../sourceproxyconfigdistributedhardware_fuzzer/BUILD.gn | 3 +-- .../test/fuzztest/sourceproxydaudionotify_fuzzer/BUILD.gn | 3 +-- .../test/fuzztest/sourceproxyinitsource_fuzzer/BUILD.gn | 3 +-- .../BUILD.gn | 3 +-- .../BUILD.gn | 3 +-- interfaces/inner_kits/native_cpp/test/unittest/BUILD.gn | 3 +-- .../native_cpp/test/unittest/audiosinktest/BUILD.gn | 3 +-- .../native_cpp/test/unittest/audiosourcetest/BUILD.gn | 3 +-- services/audioclient/test/unittest/BUILD.gn | 3 +-- services/audioclient/test/unittest/micclient/BUILD.gn | 3 +-- services/audioclient/test/unittest/spkclient/BUILD.gn | 3 +-- services/audiocontrol/test/unittest/BUILD.gn | 3 +-- services/audiocontrol/test/unittest/controlsink/BUILD.gn | 3 +-- .../audiocontrol/test/unittest/controlsource/BUILD.gn | 3 +-- services/audiohdiproxy/test/unittest/BUILD.gn | 3 +-- .../test/unittest/daudio_hdi_handler/BUILD.gn | 3 +-- .../test/unittest/daudio_manager_callback/BUILD.gn | 3 +-- services/audiomanager/servicesink/BUILD.gn | 3 +-- services/audiomanager/servicesource/BUILD.gn | 3 +-- services/audiomanager/test/unittest/BUILD.gn | 3 +-- services/audiomanager/test/unittest/managersink/BUILD.gn | 3 +-- services/audiomanager/test/unittest/servicesink/BUILD.gn | 3 +-- .../audiomanager/test/unittest/servicesource/BUILD.gn | 3 +-- .../audiomanager/test/unittest/source_device/BUILD.gn | 3 +-- .../audiomanager/test/unittest/sourcemanager/BUILD.gn | 3 +-- services/audioprocessor/test/unittest/BUILD.gn | 3 +-- .../test/unittest/common/decodeprocessor/BUILD.gn | 3 +-- .../test/unittest/common/encodeprocessor/BUILD.gn | 3 +-- .../audiotransport/audiochannel/audiodatachannel/BUILD.gn | 3 +-- services/audiotransport/audioctrltransport/BUILD.gn | 3 +-- services/audiotransport/audiotransportstatus/BUILD.gn | 3 +-- services/audiotransport/decodetransport/BUILD.gn | 3 +-- services/audiotransport/encodetransport/BUILD.gn | 3 +-- services/audiotransport/test/unittest/BUILD.gn | 3 +-- .../test/unittest/audioctrlchannel/BUILD.gn | 3 +-- .../test/unittest/audioctrltransport/BUILD.gn | 3 +-- .../test/unittest/audiodatachannel/BUILD.gn | 3 +-- .../test/unittest/audiotransportstatus/BUILD.gn | 3 +-- .../audiotransport/test/unittest/decodetransport/BUILD.gn | 3 +-- .../audiotransport/test/unittest/encodetransport/BUILD.gn | 3 +-- services/common/BUILD.gn | 3 +-- services/common/taskProcessor/test/unittest/BUILD.gn | 3 +-- .../taskProcessor/test/unittest/task_queue/BUILD.gn | 3 +-- services/common/test/unittest/audiodata/BUILD.gn | 3 +-- services/hdfaudioclient/BUILD.gn | 3 +-- services/hdfaudioclient/test/unittest/BUILD.gn | 3 +-- services/softbusadapter/BUILD.gn | 3 +-- services/softbusadapter/test/unittest/BUILD.gn | 3 +-- 100 files changed, 110 insertions(+), 203 deletions(-) diff --git a/audiohandler/BUILD.gn b/audiohandler/BUILD.gn index 84c43d62..a31af79f 100644 --- a/audiohandler/BUILD.gn +++ b/audiohandler/BUILD.gn @@ -13,8 +13,7 @@ import("//build/ohos.gni") import("//build/ohos_var.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../distributedaudio.gni") ohos_shared_library("distributed_audio_handler") { include_dirs = [ diff --git a/audiohandler/test/unittest/BUILD.gn b/audiohandler/test/unittest/BUILD.gn index c712c096..3e17b3be 100644 --- a/audiohandler/test/unittest/BUILD.gn +++ b/audiohandler/test/unittest/BUILD.gn @@ -12,8 +12,7 @@ # limitations under the License. import("//build/test.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../distributedaudio.gni") module_out_path = "distributed_audio/audio_handler_test" diff --git a/bundle.json b/bundle.json index d01f118f..bcd6ba69 100755 --- a/bundle.json +++ b/bundle.json @@ -1,7 +1,7 @@ { "name":"@ohos/distributed_audio", "description":"distributed audio", - "version":"3.1", + "version":"4.0", "author":{}, "repository":"https://gitee.com/openharmony/distributed_audio", "license":"Apache License 2.0", @@ -21,8 +21,8 @@ "adapted_system_type":[ "standard" ], - "rom":"2000k", - "ram":"6M", + "rom":"2000KB", + "ram":"6MB", "hisysevent_config": [ "//foundation/distributedhardware/distributed_audio/hisysevent.yaml" ], diff --git a/common/dfx_utils/test/unittest/BUILD.gn b/common/dfx_utils/test/unittest/BUILD.gn index bfa27536..04c9a8e1 100644 --- a/common/dfx_utils/test/unittest/BUILD.gn +++ b/common/dfx_utils/test/unittest/BUILD.gn @@ -14,8 +14,7 @@ import("//build/ohos.gni") import("//build/ohos_var.gni") import("//build/test.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../distributedaudio.gni") module_out_path = "distributed_audio/common/dfx_utils_test" diff --git a/hdf_interfaces/distributed_audio/bundle.json b/hdf_interfaces/distributed_audio/bundle.json index 9ee9786e..0b2891a4 100644 --- a/hdf_interfaces/distributed_audio/bundle.json +++ b/hdf_interfaces/distributed_audio/bundle.json @@ -1,13 +1,15 @@ { - "name": "drivers_interface_distributed_audio", + "name": "@ohos/drivers_interface_distributed_audio", "description": "distributed audio device driver interface", - "version": "1.0", + "version": "4.0", "license": "Apache License 2.0", "component": { "name": "drivers_interface_distributed_audio", "subsystem": "distributedhardware", "syscap": [""], - "adapter_system_type": ["standard"], + "adapted_system_type":[ + "standard" + ], "rom": "675KB", "ram": "1024KB", "deps": { diff --git a/hdf_service/distributed_audio/bundle.json b/hdf_service/distributed_audio/bundle.json index 3104d33b..605514fa 100644 --- a/hdf_service/distributed_audio/bundle.json +++ b/hdf_service/distributed_audio/bundle.json @@ -1,13 +1,15 @@ { - "name": "drivers_peripheral_distributed_audio", + "name": "@ohos/drivers_peripheral_distributed_audio", "description": "distributed audo device driver", - "version": "3.1", + "version": "4.0", "license": "Apache License 2.0", "component": { "name": "drivers_peripheral_distributed_audio", "subsystem": "distributedhardware", "syscap": [ "" ], - "adapter_system_type": ["standard"], + "adapted_system_type":[ + "standard" + ], "rom": "1000KB", "ram": "8000KB", "deps": { diff --git a/hdf_service/distributed_audio/hdi_service/audio/v1_0/BUILD.gn b/hdf_service/distributed_audio/hdi_service/audio/v1_0/BUILD.gn index 1c1229f9..bb347937 100644 --- a/hdf_service/distributed_audio/hdi_service/audio/v1_0/BUILD.gn +++ b/hdf_service/distributed_audio/hdi_service/audio/v1_0/BUILD.gn @@ -13,8 +13,7 @@ import("//build/ohos.gni") import("//drivers/hdf_core/adapter/uhdf2/uhdf.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../../distributedaudio.gni") ohos_shared_library("libaudio_manager_daudio_primary_service_1.0") { include_dirs = [ diff --git a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/captureframe_fuzzer/BUILD.gn b/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/captureframe_fuzzer/BUILD.gn index 84e6d2ee..5c859b2f 100644 --- a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/captureframe_fuzzer/BUILD.gn +++ b/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/captureframe_fuzzer/BUILD.gn @@ -14,8 +14,7 @@ #####################hydra-fuzz################### import("//build/config/features.gni") import("//build/test.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../../../../../distributedaudio.gni") ##############################fuzztest########################################## ohos_fuzztest("CaptureFrameFuzzTest") { diff --git a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/createcapture_fuzzer/BUILD.gn b/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/createcapture_fuzzer/BUILD.gn index 0c00d4cd..87945bf8 100644 --- a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/createcapture_fuzzer/BUILD.gn +++ b/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/createcapture_fuzzer/BUILD.gn @@ -14,8 +14,7 @@ #####################hydra-fuzz################### import("//build/config/features.gni") import("//build/test.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../../../../../distributedaudio.gni") ##############################fuzztest########################################## ohos_fuzztest("CreateCaptureFuzzTest") { diff --git a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/createrender_fuzzer/BUILD.gn b/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/createrender_fuzzer/BUILD.gn index 3bda1c63..e9631e98 100644 --- a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/createrender_fuzzer/BUILD.gn +++ b/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/createrender_fuzzer/BUILD.gn @@ -14,8 +14,7 @@ #####################hydra-fuzz################### import("//build/config/features.gni") import("//build/test.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../../../../../distributedaudio.gni") ##############################fuzztest########################################## ohos_fuzztest("CreateRenderFuzzTest") { diff --git a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/destroycapture_fuzzer/BUILD.gn b/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/destroycapture_fuzzer/BUILD.gn index 0473001c..77260e36 100644 --- a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/destroycapture_fuzzer/BUILD.gn +++ b/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/destroycapture_fuzzer/BUILD.gn @@ -14,8 +14,7 @@ #####################hydra-fuzz################### import("//build/config/features.gni") import("//build/test.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../../../../../distributedaudio.gni") ##############################fuzztest########################################## ohos_fuzztest("DestroyCaptureFuzzTest") { diff --git a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/destroyrender_fuzzer/BUILD.gn b/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/destroyrender_fuzzer/BUILD.gn index 1bf06740..e5dc01a8 100644 --- a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/destroyrender_fuzzer/BUILD.gn +++ b/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/destroyrender_fuzzer/BUILD.gn @@ -14,8 +14,7 @@ #####################hydra-fuzz################### import("//build/config/features.gni") import("//build/test.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../../../../../distributedaudio.gni") ##############################fuzztest########################################## ohos_fuzztest("DestroyRenderFuzzTest") { diff --git a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/getalladapters_fuzzer/BUILD.gn b/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/getalladapters_fuzzer/BUILD.gn index af4f35ce..fb62e071 100644 --- a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/getalladapters_fuzzer/BUILD.gn +++ b/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/getalladapters_fuzzer/BUILD.gn @@ -14,8 +14,7 @@ #####################hydra-fuzz################### import("//build/config/features.gni") import("//build/test.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../../../../../distributedaudio.gni") ##############################fuzztest########################################## ohos_fuzztest("GetAllAdaptersFuzzTest") { diff --git a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/getextraparams_fuzzer/BUILD.gn b/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/getextraparams_fuzzer/BUILD.gn index e05732e2..1bc568b7 100644 --- a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/getextraparams_fuzzer/BUILD.gn +++ b/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/getextraparams_fuzzer/BUILD.gn @@ -14,8 +14,7 @@ #####################hydra-fuzz################### import("//build/config/features.gni") import("//build/test.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../../../../../distributedaudio.gni") ##############################fuzztest########################################## ohos_fuzztest("GetExtraParamsFuzzTest") { diff --git a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/loadadapter_fuzzer/BUILD.gn b/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/loadadapter_fuzzer/BUILD.gn index c263c02c..78c854ac 100644 --- a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/loadadapter_fuzzer/BUILD.gn +++ b/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/loadadapter_fuzzer/BUILD.gn @@ -14,8 +14,7 @@ #####################hydra-fuzz################### import("//build/config/features.gni") import("//build/test.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../../../../../distributedaudio.gni") ##############################fuzztest########################################## ohos_fuzztest("LoadAdapterFuzzTest") { diff --git a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/renderframe_fuzzer/BUILD.gn b/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/renderframe_fuzzer/BUILD.gn index 51f8355a..71e85638 100644 --- a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/renderframe_fuzzer/BUILD.gn +++ b/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/renderframe_fuzzer/BUILD.gn @@ -14,8 +14,7 @@ #####################hydra-fuzz################### import("//build/config/features.gni") import("//build/test.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../../../../../distributedaudio.gni") ##############################fuzztest########################################## ohos_fuzztest("RenderFrameFuzzTest") { diff --git a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/setextraparams_fuzzer/BUILD.gn b/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/setextraparams_fuzzer/BUILD.gn index ff9a2b26..b1b8675a 100644 --- a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/setextraparams_fuzzer/BUILD.gn +++ b/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/setextraparams_fuzzer/BUILD.gn @@ -14,8 +14,7 @@ #####################hydra-fuzz################### import("//build/config/features.gni") import("//build/test.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../../../../../distributedaudio.gni") ##############################fuzztest########################################## ohos_fuzztest("SetExtraParamsFuzzTest") { diff --git a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/unloadadapter_fuzzer/BUILD.gn b/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/unloadadapter_fuzzer/BUILD.gn index b0279179..bdaadad4 100644 --- a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/unloadadapter_fuzzer/BUILD.gn +++ b/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/fuzztest/unloadadapter_fuzzer/BUILD.gn @@ -14,8 +14,7 @@ #####################hydra-fuzz################### import("//build/config/features.gni") import("//build/test.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../../../../../distributedaudio.gni") ##############################fuzztest########################################## ohos_fuzztest("UnloadAdapterFuzzTest") { diff --git a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/BUILD.gn b/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/BUILD.gn index 2e12f391..72d69d8c 100644 --- a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/BUILD.gn +++ b/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/BUILD.gn @@ -13,8 +13,7 @@ import("//build/ohos.gni") import("//drivers/hdf_core/adapter/uhdf2/uhdf.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../../../../distributedaudio.gni") group("hdi_service_audio_test") { testonly = true diff --git a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/audio_adapter_interface/BUILD.gn b/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/audio_adapter_interface/BUILD.gn index b58f3099..ecf01392 100644 --- a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/audio_adapter_interface/BUILD.gn +++ b/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/audio_adapter_interface/BUILD.gn @@ -14,8 +14,7 @@ import("//build/ohos.gni") import("//build/test.gni") import("//drivers/hdf_core/adapter/uhdf2/uhdf.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../../../../../distributedaudio.gni") module_out_path = "distributed_audio/hdf_service/hdi_service/audio" diff --git a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/audio_capture_interface/BUILD.gn b/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/audio_capture_interface/BUILD.gn index e96d7eae..723de980 100644 --- a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/audio_capture_interface/BUILD.gn +++ b/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/audio_capture_interface/BUILD.gn @@ -14,8 +14,7 @@ import("//build/ohos.gni") import("//build/test.gni") import("//drivers/hdf_core/adapter/uhdf2/uhdf.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../../../../../distributedaudio.gni") module_out_path = "distributed_audio/hdf_service/hdi_service/audio" diff --git a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/audio_manager_interface/BUILD.gn b/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/audio_manager_interface/BUILD.gn index 7cb001d2..25415052 100644 --- a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/audio_manager_interface/BUILD.gn +++ b/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/audio_manager_interface/BUILD.gn @@ -14,8 +14,7 @@ import("//build/ohos.gni") import("//build/test.gni") import("//drivers/hdf_core/adapter/uhdf2/uhdf.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../../../../../distributedaudio.gni") module_out_path = "distributed_audio/hdf_service/hdi_service/audio" diff --git a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/audio_render_interface/BUILD.gn b/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/audio_render_interface/BUILD.gn index ebaa6350..f9dfad9d 100644 --- a/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/audio_render_interface/BUILD.gn +++ b/hdf_service/distributed_audio/hdi_service/audio/v1_0/test/unittest/audio_render_interface/BUILD.gn @@ -14,8 +14,7 @@ import("//build/ohos.gni") import("//build/test.gni") import("//drivers/hdf_core/adapter/uhdf2/uhdf.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../../../../../distributedaudio.gni") module_out_path = "distributed_audio/hdf_service/hdi_service/audio" diff --git a/hdf_service/distributed_audio/hdi_service/audio_ext/v1_0/BUILD.gn b/hdf_service/distributed_audio/hdi_service/audio_ext/v1_0/BUILD.gn index 0685b3a5..a8c2b3b7 100644 --- a/hdf_service/distributed_audio/hdi_service/audio_ext/v1_0/BUILD.gn +++ b/hdf_service/distributed_audio/hdi_service/audio_ext/v1_0/BUILD.gn @@ -13,8 +13,7 @@ import("//build/ohos.gni") import("//drivers/hdf_core/adapter/uhdf2/uhdf.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../../distributedaudio.gni") ohos_shared_library("libdaudio_manager_daudio_ext_service_1.0") { include_dirs = [ diff --git a/hdf_service/distributed_audio/hdi_service/audio_ext/v1_0/test/fuzztest/notifyevent_fuzzer/BUILD.gn b/hdf_service/distributed_audio/hdi_service/audio_ext/v1_0/test/fuzztest/notifyevent_fuzzer/BUILD.gn index b636acd4..358427f3 100644 --- a/hdf_service/distributed_audio/hdi_service/audio_ext/v1_0/test/fuzztest/notifyevent_fuzzer/BUILD.gn +++ b/hdf_service/distributed_audio/hdi_service/audio_ext/v1_0/test/fuzztest/notifyevent_fuzzer/BUILD.gn @@ -14,8 +14,7 @@ #####################hydra-fuzz################### import("//build/config/features.gni") import("//build/test.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../../../../../distributedaudio.gni") ##############################fuzztest########################################## ohos_fuzztest("NotifyEventFuzzTest") { diff --git a/hdf_service/distributed_audio/hdi_service/audio_ext/v1_0/test/fuzztest/registeraudiodevice_fuzzer/BUILD.gn b/hdf_service/distributed_audio/hdi_service/audio_ext/v1_0/test/fuzztest/registeraudiodevice_fuzzer/BUILD.gn index 601f57d9..d7b8c5ec 100644 --- a/hdf_service/distributed_audio/hdi_service/audio_ext/v1_0/test/fuzztest/registeraudiodevice_fuzzer/BUILD.gn +++ b/hdf_service/distributed_audio/hdi_service/audio_ext/v1_0/test/fuzztest/registeraudiodevice_fuzzer/BUILD.gn @@ -14,8 +14,7 @@ #####################hydra-fuzz################### import("//build/config/features.gni") import("//build/test.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../../../../../distributedaudio.gni") ##############################fuzztest########################################## ohos_fuzztest("RegisterAudioDeviceFuzzTest") { diff --git a/hdf_service/distributed_audio/hdi_service/audio_ext/v1_0/test/fuzztest/unregisteraudiodevice_fuzzer/BUILD.gn b/hdf_service/distributed_audio/hdi_service/audio_ext/v1_0/test/fuzztest/unregisteraudiodevice_fuzzer/BUILD.gn index 2b390313..a8996453 100644 --- a/hdf_service/distributed_audio/hdi_service/audio_ext/v1_0/test/fuzztest/unregisteraudiodevice_fuzzer/BUILD.gn +++ b/hdf_service/distributed_audio/hdi_service/audio_ext/v1_0/test/fuzztest/unregisteraudiodevice_fuzzer/BUILD.gn @@ -14,8 +14,7 @@ #####################hydra-fuzz################### import("//build/config/features.gni") import("//build/test.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../../../../../distributedaudio.gni") ##############################fuzztest########################################## ohos_fuzztest("UnRegisterAudioDeviceFuzzTest") { diff --git a/hdf_service/distributed_audio/hdi_service/audio_ext/v1_0/test/unittest/BUILD.gn b/hdf_service/distributed_audio/hdi_service/audio_ext/v1_0/test/unittest/BUILD.gn index df54f14e..56e45be1 100644 --- a/hdf_service/distributed_audio/hdi_service/audio_ext/v1_0/test/unittest/BUILD.gn +++ b/hdf_service/distributed_audio/hdi_service/audio_ext/v1_0/test/unittest/BUILD.gn @@ -14,8 +14,7 @@ import("//build/ohos.gni") import("//build/test.gni") import("//drivers/hdf_core/adapter/uhdf2/uhdf.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../../../../distributedaudio.gni") module_out_path = "distributed_audio/hdf_service/hdi_service/audio_ext" diff --git a/interfaces/inner_kits/native_cpp/audio_sink/BUILD.gn b/interfaces/inner_kits/native_cpp/audio_sink/BUILD.gn index 57c67d93..934cd42e 100755 --- a/interfaces/inner_kits/native_cpp/audio_sink/BUILD.gn +++ b/interfaces/inner_kits/native_cpp/audio_sink/BUILD.gn @@ -13,8 +13,7 @@ import("//build/ohos.gni") import("//build/ohos_var.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../distributedaudio.gni") ohos_shared_library("distributed_audio_sink_sdk") { include_dirs = [ diff --git a/interfaces/inner_kits/native_cpp/audio_source/BUILD.gn b/interfaces/inner_kits/native_cpp/audio_source/BUILD.gn index 9eb731ad..2898b1eb 100755 --- a/interfaces/inner_kits/native_cpp/audio_source/BUILD.gn +++ b/interfaces/inner_kits/native_cpp/audio_source/BUILD.gn @@ -13,8 +13,7 @@ import("//build/ohos.gni") import("//build/ohos_var.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../distributedaudio.gni") ohos_shared_library("distributed_audio_source_sdk") { include_dirs = [ diff --git a/interfaces/inner_kits/native_cpp/test/fuzztest/BUILD.gn b/interfaces/inner_kits/native_cpp/test/fuzztest/BUILD.gn index 96b639ae..8605ec77 100644 --- a/interfaces/inner_kits/native_cpp/test/fuzztest/BUILD.gn +++ b/interfaces/inner_kits/native_cpp/test/fuzztest/BUILD.gn @@ -13,8 +13,7 @@ import("//build/ohos.gni") import("//build/ohos_var.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../../distributedaudio.gni") group("fuzztest") { testonly = true diff --git a/interfaces/inner_kits/native_cpp/test/fuzztest/onremotesinksvrdied_fuzzer/BUILD.gn b/interfaces/inner_kits/native_cpp/test/fuzztest/onremotesinksvrdied_fuzzer/BUILD.gn index 8b5383b1..8cb74d66 100755 --- a/interfaces/inner_kits/native_cpp/test/fuzztest/onremotesinksvrdied_fuzzer/BUILD.gn +++ b/interfaces/inner_kits/native_cpp/test/fuzztest/onremotesinksvrdied_fuzzer/BUILD.gn @@ -14,8 +14,7 @@ #####################hydra-fuzz################### import("//build/config/features.gni") import("//build/test.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../../../distributedaudio.gni") ##############################fuzztest########################################## ohos_fuzztest("OnRemoteSinkSvrDiedFuzzTest") { diff --git a/interfaces/inner_kits/native_cpp/test/fuzztest/onremotesourcesvrdied_fuzzer/BUILD.gn b/interfaces/inner_kits/native_cpp/test/fuzztest/onremotesourcesvrdied_fuzzer/BUILD.gn index 8e4379d7..f55439c3 100755 --- a/interfaces/inner_kits/native_cpp/test/fuzztest/onremotesourcesvrdied_fuzzer/BUILD.gn +++ b/interfaces/inner_kits/native_cpp/test/fuzztest/onremotesourcesvrdied_fuzzer/BUILD.gn @@ -14,8 +14,7 @@ #####################hydra-fuzz################### import("//build/config/features.gni") import("//build/test.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../../../distributedaudio.gni") ##############################fuzztest########################################## ohos_fuzztest("OnRemoteSourceSvrDiedFuzzTest") { diff --git a/interfaces/inner_kits/native_cpp/test/fuzztest/sinkhandlerfinishstartsa_fuzzer/BUILD.gn b/interfaces/inner_kits/native_cpp/test/fuzztest/sinkhandlerfinishstartsa_fuzzer/BUILD.gn index fb782d02..7607a317 100755 --- a/interfaces/inner_kits/native_cpp/test/fuzztest/sinkhandlerfinishstartsa_fuzzer/BUILD.gn +++ b/interfaces/inner_kits/native_cpp/test/fuzztest/sinkhandlerfinishstartsa_fuzzer/BUILD.gn @@ -14,8 +14,7 @@ #####################hydra-fuzz################### import("//build/config/features.gni") import("//build/test.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../../../distributedaudio.gni") ##############################fuzztest########################################## ohos_fuzztest("SinkHandlerFinishStartSAFuzzTest") { diff --git a/interfaces/inner_kits/native_cpp/test/fuzztest/sinkhandlerinitsink_fuzzer/BUILD.gn b/interfaces/inner_kits/native_cpp/test/fuzztest/sinkhandlerinitsink_fuzzer/BUILD.gn index ce603e6e..236fd0b2 100755 --- a/interfaces/inner_kits/native_cpp/test/fuzztest/sinkhandlerinitsink_fuzzer/BUILD.gn +++ b/interfaces/inner_kits/native_cpp/test/fuzztest/sinkhandlerinitsink_fuzzer/BUILD.gn @@ -14,8 +14,7 @@ #####################hydra-fuzz################### import("//build/config/features.gni") import("//build/test.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../../../distributedaudio.gni") ##############################fuzztest########################################## ohos_fuzztest("SinkHandlerInitSinkFuzzTest") { diff --git a/interfaces/inner_kits/native_cpp/test/fuzztest/sinkhandlersubscribelocalhardware_fuzzer/BUILD.gn b/interfaces/inner_kits/native_cpp/test/fuzztest/sinkhandlersubscribelocalhardware_fuzzer/BUILD.gn index 33818772..778453fb 100755 --- a/interfaces/inner_kits/native_cpp/test/fuzztest/sinkhandlersubscribelocalhardware_fuzzer/BUILD.gn +++ b/interfaces/inner_kits/native_cpp/test/fuzztest/sinkhandlersubscribelocalhardware_fuzzer/BUILD.gn @@ -14,8 +14,7 @@ #####################hydra-fuzz################### import("//build/config/features.gni") import("//build/test.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../../../distributedaudio.gni") ##############################fuzztest########################################## ohos_fuzztest("SinkHandlerSubscribeLocalHardwareFuzzTest") { diff --git a/interfaces/inner_kits/native_cpp/test/fuzztest/sinkhandlerunsubscribelocalhardware_fuzzer/BUILD.gn b/interfaces/inner_kits/native_cpp/test/fuzztest/sinkhandlerunsubscribelocalhardware_fuzzer/BUILD.gn index 101d6c04..c0a7115f 100755 --- a/interfaces/inner_kits/native_cpp/test/fuzztest/sinkhandlerunsubscribelocalhardware_fuzzer/BUILD.gn +++ b/interfaces/inner_kits/native_cpp/test/fuzztest/sinkhandlerunsubscribelocalhardware_fuzzer/BUILD.gn @@ -14,8 +14,7 @@ #####################hydra-fuzz################### import("//build/config/features.gni") import("//build/test.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../../../distributedaudio.gni") ##############################fuzztest########################################## ohos_fuzztest("SinkHandlerUnsubscribeLocalHardwareFuzzTest") { diff --git a/interfaces/inner_kits/native_cpp/test/fuzztest/sinkonloadsystemabilityfail_fuzzer/BUILD.gn b/interfaces/inner_kits/native_cpp/test/fuzztest/sinkonloadsystemabilityfail_fuzzer/BUILD.gn index 219c0063..ba31a5da 100755 --- a/interfaces/inner_kits/native_cpp/test/fuzztest/sinkonloadsystemabilityfail_fuzzer/BUILD.gn +++ b/interfaces/inner_kits/native_cpp/test/fuzztest/sinkonloadsystemabilityfail_fuzzer/BUILD.gn @@ -14,8 +14,7 @@ #####################hydra-fuzz################### import("//build/config/features.gni") import("//build/test.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../../../distributedaudio.gni") ##############################fuzztest########################################## ohos_fuzztest("SinkOnLoadSystemAbilityFailFuzzTest") { diff --git a/interfaces/inner_kits/native_cpp/test/fuzztest/sinkonloadsystemabilitysuccess_fuzzer/BUILD.gn b/interfaces/inner_kits/native_cpp/test/fuzztest/sinkonloadsystemabilitysuccess_fuzzer/BUILD.gn index 08c3f29d..e96df5cd 100755 --- a/interfaces/inner_kits/native_cpp/test/fuzztest/sinkonloadsystemabilitysuccess_fuzzer/BUILD.gn +++ b/interfaces/inner_kits/native_cpp/test/fuzztest/sinkonloadsystemabilitysuccess_fuzzer/BUILD.gn @@ -14,8 +14,7 @@ #####################hydra-fuzz################### import("//build/config/features.gni") import("//build/test.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../../../distributedaudio.gni") ##############################fuzztest########################################## ohos_fuzztest("SinkOnLoadSystemAbilitySuccessFuzzTest") { diff --git a/interfaces/inner_kits/native_cpp/test/fuzztest/sinkproxydaudionotify_fuzzer/BUILD.gn b/interfaces/inner_kits/native_cpp/test/fuzztest/sinkproxydaudionotify_fuzzer/BUILD.gn index 8af9740c..7e62e862 100755 --- a/interfaces/inner_kits/native_cpp/test/fuzztest/sinkproxydaudionotify_fuzzer/BUILD.gn +++ b/interfaces/inner_kits/native_cpp/test/fuzztest/sinkproxydaudionotify_fuzzer/BUILD.gn @@ -14,8 +14,7 @@ #####################hydra-fuzz################### import("//build/config/features.gni") import("//build/test.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../../../distributedaudio.gni") ##############################fuzztest########################################## ohos_fuzztest("SinkProxyDAudioNotifyFuzzTest") { diff --git a/interfaces/inner_kits/native_cpp/test/fuzztest/sinkproxyinitsink_fuzzer/BUILD.gn b/interfaces/inner_kits/native_cpp/test/fuzztest/sinkproxyinitsink_fuzzer/BUILD.gn index a3c4e6c7..193da854 100755 --- a/interfaces/inner_kits/native_cpp/test/fuzztest/sinkproxyinitsink_fuzzer/BUILD.gn +++ b/interfaces/inner_kits/native_cpp/test/fuzztest/sinkproxyinitsink_fuzzer/BUILD.gn @@ -14,8 +14,7 @@ #####################hydra-fuzz################### import("//build/config/features.gni") import("//build/test.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../../../distributedaudio.gni") ##############################fuzztest########################################## ohos_fuzztest("SinkProxyInitSinkFuzzTest") { diff --git a/interfaces/inner_kits/native_cpp/test/fuzztest/sinkproxysubscribelocalhardware_fuzzer/BUILD.gn b/interfaces/inner_kits/native_cpp/test/fuzztest/sinkproxysubscribelocalhardware_fuzzer/BUILD.gn index 7309a909..fe592476 100755 --- a/interfaces/inner_kits/native_cpp/test/fuzztest/sinkproxysubscribelocalhardware_fuzzer/BUILD.gn +++ b/interfaces/inner_kits/native_cpp/test/fuzztest/sinkproxysubscribelocalhardware_fuzzer/BUILD.gn @@ -14,8 +14,7 @@ #####################hydra-fuzz################### import("//build/config/features.gni") import("//build/test.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../../../distributedaudio.gni") ##############################fuzztest########################################## ohos_fuzztest("SinkProxySubscribeLocalHardwareFuzzTest") { diff --git a/interfaces/inner_kits/native_cpp/test/fuzztest/sinkproxyunsubscribelocalhardware_fuzzer/BUILD.gn b/interfaces/inner_kits/native_cpp/test/fuzztest/sinkproxyunsubscribelocalhardware_fuzzer/BUILD.gn index e5dc3c4e..81adb7ef 100755 --- a/interfaces/inner_kits/native_cpp/test/fuzztest/sinkproxyunsubscribelocalhardware_fuzzer/BUILD.gn +++ b/interfaces/inner_kits/native_cpp/test/fuzztest/sinkproxyunsubscribelocalhardware_fuzzer/BUILD.gn @@ -14,8 +14,7 @@ #####################hydra-fuzz################### import("//build/config/features.gni") import("//build/test.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../../../distributedaudio.gni") ##############################fuzztest########################################## ohos_fuzztest("SinkProxyUnsubscribeLocalHardwareFuzzTest") { diff --git a/interfaces/inner_kits/native_cpp/test/fuzztest/sourcehandlerconfigdistributedhardware_fuzzer/BUILD.gn b/interfaces/inner_kits/native_cpp/test/fuzztest/sourcehandlerconfigdistributedhardware_fuzzer/BUILD.gn index 7c952ac6..f62c8637 100755 --- a/interfaces/inner_kits/native_cpp/test/fuzztest/sourcehandlerconfigdistributedhardware_fuzzer/BUILD.gn +++ b/interfaces/inner_kits/native_cpp/test/fuzztest/sourcehandlerconfigdistributedhardware_fuzzer/BUILD.gn @@ -14,8 +14,7 @@ #####################hydra-fuzz################### import("//build/config/features.gni") import("//build/test.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../../../distributedaudio.gni") ##############################fuzztest########################################## ohos_fuzztest("SourceHandlerConfigDistributedHardwareFuzzTest") { diff --git a/interfaces/inner_kits/native_cpp/test/fuzztest/sourcehandlerfinishstartsa_fuzzer/BUILD.gn b/interfaces/inner_kits/native_cpp/test/fuzztest/sourcehandlerfinishstartsa_fuzzer/BUILD.gn index 414a2d1b..a17da763 100755 --- a/interfaces/inner_kits/native_cpp/test/fuzztest/sourcehandlerfinishstartsa_fuzzer/BUILD.gn +++ b/interfaces/inner_kits/native_cpp/test/fuzztest/sourcehandlerfinishstartsa_fuzzer/BUILD.gn @@ -14,8 +14,7 @@ #####################hydra-fuzz################### import("//build/config/features.gni") import("//build/test.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../../../distributedaudio.gni") ##############################fuzztest########################################## ohos_fuzztest("SourceHandlerFinishStartSAFuzzTest") { diff --git a/interfaces/inner_kits/native_cpp/test/fuzztest/sourcehandlerinitsource_fuzzer/BUILD.gn b/interfaces/inner_kits/native_cpp/test/fuzztest/sourcehandlerinitsource_fuzzer/BUILD.gn index 4012d0fc..af8191b9 100755 --- a/interfaces/inner_kits/native_cpp/test/fuzztest/sourcehandlerinitsource_fuzzer/BUILD.gn +++ b/interfaces/inner_kits/native_cpp/test/fuzztest/sourcehandlerinitsource_fuzzer/BUILD.gn @@ -14,8 +14,7 @@ #####################hydra-fuzz################### import("//build/config/features.gni") import("//build/test.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../../../distributedaudio.gni") ##############################fuzztest########################################## ohos_fuzztest("SourceHandlerInitSourceFuzzTest") { diff --git a/interfaces/inner_kits/native_cpp/test/fuzztest/sourcehandlerregisterdistributedhardware_fuzzer/BUILD.gn b/interfaces/inner_kits/native_cpp/test/fuzztest/sourcehandlerregisterdistributedhardware_fuzzer/BUILD.gn index 0745818e..5673ecb6 100755 --- a/interfaces/inner_kits/native_cpp/test/fuzztest/sourcehandlerregisterdistributedhardware_fuzzer/BUILD.gn +++ b/interfaces/inner_kits/native_cpp/test/fuzztest/sourcehandlerregisterdistributedhardware_fuzzer/BUILD.gn @@ -14,8 +14,7 @@ #####################hydra-fuzz################### import("//build/config/features.gni") import("//build/test.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../../../distributedaudio.gni") ##############################fuzztest########################################## ohos_fuzztest("SourceHandlerRegisterDistributedHardwareFuzzTest") { diff --git a/interfaces/inner_kits/native_cpp/test/fuzztest/sourcehandlerunregisterdistributedhardware_fuzzer/BUILD.gn b/interfaces/inner_kits/native_cpp/test/fuzztest/sourcehandlerunregisterdistributedhardware_fuzzer/BUILD.gn index 0fed9bff..c216334d 100755 --- a/interfaces/inner_kits/native_cpp/test/fuzztest/sourcehandlerunregisterdistributedhardware_fuzzer/BUILD.gn +++ b/interfaces/inner_kits/native_cpp/test/fuzztest/sourcehandlerunregisterdistributedhardware_fuzzer/BUILD.gn @@ -14,8 +14,7 @@ #####################hydra-fuzz################### import("//build/config/features.gni") import("//build/test.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../../../distributedaudio.gni") ##############################fuzztest########################################## ohos_fuzztest("SourceHandlerUnregisterDistributedHardwareFuzzTest") { diff --git a/interfaces/inner_kits/native_cpp/test/fuzztest/sourceipccallbackonnotifyregresult_fuzzer/BUILD.gn b/interfaces/inner_kits/native_cpp/test/fuzztest/sourceipccallbackonnotifyregresult_fuzzer/BUILD.gn index b349dce2..db637459 100755 --- a/interfaces/inner_kits/native_cpp/test/fuzztest/sourceipccallbackonnotifyregresult_fuzzer/BUILD.gn +++ b/interfaces/inner_kits/native_cpp/test/fuzztest/sourceipccallbackonnotifyregresult_fuzzer/BUILD.gn @@ -14,8 +14,7 @@ #####################hydra-fuzz################### import("//build/config/features.gni") import("//build/test.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../../../distributedaudio.gni") ##############################fuzztest########################################## ohos_fuzztest("SourceIpcCallbackOnNotifyRegResultFuzzTest") { diff --git a/interfaces/inner_kits/native_cpp/test/fuzztest/sourceipccallbackonnotifyunregresult_fuzzer/BUILD.gn b/interfaces/inner_kits/native_cpp/test/fuzztest/sourceipccallbackonnotifyunregresult_fuzzer/BUILD.gn index 57e3aeb8..2725c60b 100755 --- a/interfaces/inner_kits/native_cpp/test/fuzztest/sourceipccallbackonnotifyunregresult_fuzzer/BUILD.gn +++ b/interfaces/inner_kits/native_cpp/test/fuzztest/sourceipccallbackonnotifyunregresult_fuzzer/BUILD.gn @@ -14,8 +14,7 @@ #####################hydra-fuzz################### import("//build/config/features.gni") import("//build/test.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../../../distributedaudio.gni") ##############################fuzztest########################################## ohos_fuzztest("SourceIpcCallbackOnNotifyUnregResultFuzzTest") { diff --git a/interfaces/inner_kits/native_cpp/test/fuzztest/sourceonloadsystemabilityfail_fuzzer/BUILD.gn b/interfaces/inner_kits/native_cpp/test/fuzztest/sourceonloadsystemabilityfail_fuzzer/BUILD.gn index 5ffc4759..53531f6f 100755 --- a/interfaces/inner_kits/native_cpp/test/fuzztest/sourceonloadsystemabilityfail_fuzzer/BUILD.gn +++ b/interfaces/inner_kits/native_cpp/test/fuzztest/sourceonloadsystemabilityfail_fuzzer/BUILD.gn @@ -14,8 +14,7 @@ #####################hydra-fuzz################### import("//build/config/features.gni") import("//build/test.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../../../distributedaudio.gni") ##############################fuzztest########################################## ohos_fuzztest("SourceOnLoadSystemAbilityFailFuzzTest") { diff --git a/interfaces/inner_kits/native_cpp/test/fuzztest/sourceonloadsystemabilitysuccess_fuzzer/BUILD.gn b/interfaces/inner_kits/native_cpp/test/fuzztest/sourceonloadsystemabilitysuccess_fuzzer/BUILD.gn index 33149bb7..1df137cf 100755 --- a/interfaces/inner_kits/native_cpp/test/fuzztest/sourceonloadsystemabilitysuccess_fuzzer/BUILD.gn +++ b/interfaces/inner_kits/native_cpp/test/fuzztest/sourceonloadsystemabilitysuccess_fuzzer/BUILD.gn @@ -14,8 +14,7 @@ #####################hydra-fuzz################### import("//build/config/features.gni") import("//build/test.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../../../distributedaudio.gni") ##############################fuzztest########################################## ohos_fuzztest("SourceOnLoadSystemAbilitySuccessFuzzTest") { diff --git a/interfaces/inner_kits/native_cpp/test/fuzztest/sourceproxyconfigdistributedhardware_fuzzer/BUILD.gn b/interfaces/inner_kits/native_cpp/test/fuzztest/sourceproxyconfigdistributedhardware_fuzzer/BUILD.gn index 2993f4c9..06d00bc5 100755 --- a/interfaces/inner_kits/native_cpp/test/fuzztest/sourceproxyconfigdistributedhardware_fuzzer/BUILD.gn +++ b/interfaces/inner_kits/native_cpp/test/fuzztest/sourceproxyconfigdistributedhardware_fuzzer/BUILD.gn @@ -14,8 +14,7 @@ #####################hydra-fuzz################### import("//build/config/features.gni") import("//build/test.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../../../distributedaudio.gni") ##############################fuzztest########################################## ohos_fuzztest("SourceProxyConfigDistributedHardwareFuzzTest") { diff --git a/interfaces/inner_kits/native_cpp/test/fuzztest/sourceproxydaudionotify_fuzzer/BUILD.gn b/interfaces/inner_kits/native_cpp/test/fuzztest/sourceproxydaudionotify_fuzzer/BUILD.gn index f796b25a..d605aa8e 100755 --- a/interfaces/inner_kits/native_cpp/test/fuzztest/sourceproxydaudionotify_fuzzer/BUILD.gn +++ b/interfaces/inner_kits/native_cpp/test/fuzztest/sourceproxydaudionotify_fuzzer/BUILD.gn @@ -14,8 +14,7 @@ #####################hydra-fuzz################### import("//build/config/features.gni") import("//build/test.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../../../distributedaudio.gni") ##############################fuzztest########################################## ohos_fuzztest("SourceProxyDAudioNotifyFuzzTest") { diff --git a/interfaces/inner_kits/native_cpp/test/fuzztest/sourceproxyinitsource_fuzzer/BUILD.gn b/interfaces/inner_kits/native_cpp/test/fuzztest/sourceproxyinitsource_fuzzer/BUILD.gn index a77e3906..e1ea532b 100755 --- a/interfaces/inner_kits/native_cpp/test/fuzztest/sourceproxyinitsource_fuzzer/BUILD.gn +++ b/interfaces/inner_kits/native_cpp/test/fuzztest/sourceproxyinitsource_fuzzer/BUILD.gn @@ -14,8 +14,7 @@ #####################hydra-fuzz################### import("//build/config/features.gni") import("//build/test.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../../../distributedaudio.gni") ##############################fuzztest########################################## ohos_fuzztest("SourceProxyInitSourceFuzzTest") { diff --git a/interfaces/inner_kits/native_cpp/test/fuzztest/sourceproxyregisterdistributedhardware_fuzzer/BUILD.gn b/interfaces/inner_kits/native_cpp/test/fuzztest/sourceproxyregisterdistributedhardware_fuzzer/BUILD.gn index 8f84f417..2bbd4355 100755 --- a/interfaces/inner_kits/native_cpp/test/fuzztest/sourceproxyregisterdistributedhardware_fuzzer/BUILD.gn +++ b/interfaces/inner_kits/native_cpp/test/fuzztest/sourceproxyregisterdistributedhardware_fuzzer/BUILD.gn @@ -14,8 +14,7 @@ #####################hydra-fuzz################### import("//build/config/features.gni") import("//build/test.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../../../distributedaudio.gni") ##############################fuzztest########################################## ohos_fuzztest("SourceProxyRegisterDistributedHardwareFuzzTest") { diff --git a/interfaces/inner_kits/native_cpp/test/fuzztest/sourceproxyunregisterdistributedhardware_fuzzer/BUILD.gn b/interfaces/inner_kits/native_cpp/test/fuzztest/sourceproxyunregisterdistributedhardware_fuzzer/BUILD.gn index 403d4c0c..a903e1bb 100755 --- a/interfaces/inner_kits/native_cpp/test/fuzztest/sourceproxyunregisterdistributedhardware_fuzzer/BUILD.gn +++ b/interfaces/inner_kits/native_cpp/test/fuzztest/sourceproxyunregisterdistributedhardware_fuzzer/BUILD.gn @@ -14,8 +14,7 @@ #####################hydra-fuzz################### import("//build/config/features.gni") import("//build/test.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../../../distributedaudio.gni") ##############################fuzztest########################################## ohos_fuzztest("SourceProxyUnregisterDistributedHardwareFuzzTest") { diff --git a/interfaces/inner_kits/native_cpp/test/unittest/BUILD.gn b/interfaces/inner_kits/native_cpp/test/unittest/BUILD.gn index e4de8336..583e2b94 100644 --- a/interfaces/inner_kits/native_cpp/test/unittest/BUILD.gn +++ b/interfaces/inner_kits/native_cpp/test/unittest/BUILD.gn @@ -13,8 +13,7 @@ import("//build/ohos.gni") import("//build/ohos_var.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../../distributedaudio.gni") group("unittest") { testonly = true diff --git a/interfaces/inner_kits/native_cpp/test/unittest/audiosinktest/BUILD.gn b/interfaces/inner_kits/native_cpp/test/unittest/audiosinktest/BUILD.gn index 2f8d18fc..38c3bf08 100755 --- a/interfaces/inner_kits/native_cpp/test/unittest/audiosinktest/BUILD.gn +++ b/interfaces/inner_kits/native_cpp/test/unittest/audiosinktest/BUILD.gn @@ -12,8 +12,7 @@ # limitations under the License. import("//build/test.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../../../distributedaudio.gni") module_out_path = "distributed_audio/interfaces/audio_sink_test" diff --git a/interfaces/inner_kits/native_cpp/test/unittest/audiosourcetest/BUILD.gn b/interfaces/inner_kits/native_cpp/test/unittest/audiosourcetest/BUILD.gn index 8d112f65..1eb00aa9 100755 --- a/interfaces/inner_kits/native_cpp/test/unittest/audiosourcetest/BUILD.gn +++ b/interfaces/inner_kits/native_cpp/test/unittest/audiosourcetest/BUILD.gn @@ -12,8 +12,7 @@ # limitations under the License. import("//build/test.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../../../distributedaudio.gni") module_out_path = "distributed_audio/interfaces/audio_source_test" diff --git a/services/audioclient/test/unittest/BUILD.gn b/services/audioclient/test/unittest/BUILD.gn index ffc0b701..9f6d80d5 100644 --- a/services/audioclient/test/unittest/BUILD.gn +++ b/services/audioclient/test/unittest/BUILD.gn @@ -13,8 +13,7 @@ import("//build/ohos.gni") import("//build/ohos_var.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../distributedaudio.gni") group("daudio_client_test") { testonly = true diff --git a/services/audioclient/test/unittest/micclient/BUILD.gn b/services/audioclient/test/unittest/micclient/BUILD.gn index d429f8e6..77246db6 100644 --- a/services/audioclient/test/unittest/micclient/BUILD.gn +++ b/services/audioclient/test/unittest/micclient/BUILD.gn @@ -14,8 +14,7 @@ import("//build/ohos.gni") import("//build/ohos_var.gni") import("//build/test.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../../distributedaudio.gni") module_out_path = "distributed_audio/services/audioclient/mic_client_test" diff --git a/services/audioclient/test/unittest/spkclient/BUILD.gn b/services/audioclient/test/unittest/spkclient/BUILD.gn index 62ce87cb..118cd99b 100644 --- a/services/audioclient/test/unittest/spkclient/BUILD.gn +++ b/services/audioclient/test/unittest/spkclient/BUILD.gn @@ -14,8 +14,7 @@ import("//build/ohos.gni") import("//build/ohos_var.gni") import("//build/test.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../../distributedaudio.gni") module_out_path = "distributed_audio/services/audioclient/spk_client_test" diff --git a/services/audiocontrol/test/unittest/BUILD.gn b/services/audiocontrol/test/unittest/BUILD.gn index c1f65be0..b71dc287 100644 --- a/services/audiocontrol/test/unittest/BUILD.gn +++ b/services/audiocontrol/test/unittest/BUILD.gn @@ -13,8 +13,7 @@ import("//build/ohos.gni") import("//build/ohos_var.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../distributedaudio.gni") group("daudio_control_test") { testonly = true diff --git a/services/audiocontrol/test/unittest/controlsink/BUILD.gn b/services/audiocontrol/test/unittest/controlsink/BUILD.gn index 4a521952..c4a29abb 100644 --- a/services/audiocontrol/test/unittest/controlsink/BUILD.gn +++ b/services/audiocontrol/test/unittest/controlsink/BUILD.gn @@ -12,8 +12,7 @@ # limitations under the License. import("//build/test.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../../distributedaudio.gni") module_out_path = "distributed_audio/services/audiocontrol/control_sink_test" diff --git a/services/audiocontrol/test/unittest/controlsource/BUILD.gn b/services/audiocontrol/test/unittest/controlsource/BUILD.gn index a2a22ea7..ca355a23 100644 --- a/services/audiocontrol/test/unittest/controlsource/BUILD.gn +++ b/services/audiocontrol/test/unittest/controlsource/BUILD.gn @@ -12,8 +12,7 @@ # limitations under the License. import("//build/test.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../../distributedaudio.gni") module_out_path = "distributed_audio/services/audiocontrol/control_source_test" diff --git a/services/audiohdiproxy/test/unittest/BUILD.gn b/services/audiohdiproxy/test/unittest/BUILD.gn index 43fb1972..a9ba7026 100644 --- a/services/audiohdiproxy/test/unittest/BUILD.gn +++ b/services/audiohdiproxy/test/unittest/BUILD.gn @@ -13,8 +13,7 @@ import("//build/ohos.gni") import("//build/ohos_var.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../distributedaudio.gni") group("daudio_hdi_proxy_test") { testonly = true diff --git a/services/audiohdiproxy/test/unittest/daudio_hdi_handler/BUILD.gn b/services/audiohdiproxy/test/unittest/daudio_hdi_handler/BUILD.gn index d4a11cc8..3843e266 100644 --- a/services/audiohdiproxy/test/unittest/daudio_hdi_handler/BUILD.gn +++ b/services/audiohdiproxy/test/unittest/daudio_hdi_handler/BUILD.gn @@ -14,8 +14,7 @@ import("//build/ohos.gni") import("//build/ohos_var.gni") import("//build/test.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../../distributedaudio.gni") module_out_path = "distributed_audio/services/audiohdiproxy/daudio_hdi_handler" diff --git a/services/audiohdiproxy/test/unittest/daudio_manager_callback/BUILD.gn b/services/audiohdiproxy/test/unittest/daudio_manager_callback/BUILD.gn index 59470557..d0f72d82 100644 --- a/services/audiohdiproxy/test/unittest/daudio_manager_callback/BUILD.gn +++ b/services/audiohdiproxy/test/unittest/daudio_manager_callback/BUILD.gn @@ -14,8 +14,7 @@ import("//build/ohos.gni") import("//build/ohos_var.gni") import("//build/test.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../../distributedaudio.gni") module_out_path = "distributed_audio/services/audiohdiproxy/daudio_manager_callback" diff --git a/services/audiomanager/servicesink/BUILD.gn b/services/audiomanager/servicesink/BUILD.gn index 4ad33c20..bd822197 100755 --- a/services/audiomanager/servicesink/BUILD.gn +++ b/services/audiomanager/servicesink/BUILD.gn @@ -13,8 +13,7 @@ import("//build/ohos.gni") import("//build/ohos_var.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../distributedaudio.gni") ohos_shared_library("distributed_audio_sink") { include_dirs = [ diff --git a/services/audiomanager/servicesource/BUILD.gn b/services/audiomanager/servicesource/BUILD.gn index 795ab5ce..838ae15a 100755 --- a/services/audiomanager/servicesource/BUILD.gn +++ b/services/audiomanager/servicesource/BUILD.gn @@ -13,8 +13,7 @@ import("//build/ohos.gni") import("//build/ohos_var.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../distributedaudio.gni") ohos_shared_library("distributed_audio_source") { include_dirs = [ diff --git a/services/audiomanager/test/unittest/BUILD.gn b/services/audiomanager/test/unittest/BUILD.gn index ec07f3a9..e9e5589c 100644 --- a/services/audiomanager/test/unittest/BUILD.gn +++ b/services/audiomanager/test/unittest/BUILD.gn @@ -13,8 +13,7 @@ import("//build/ohos.gni") import("//build/ohos_var.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../distributedaudio.gni") group("daudio_manager_test") { testonly = true diff --git a/services/audiomanager/test/unittest/managersink/BUILD.gn b/services/audiomanager/test/unittest/managersink/BUILD.gn index c0baa4d0..d34046af 100644 --- a/services/audiomanager/test/unittest/managersink/BUILD.gn +++ b/services/audiomanager/test/unittest/managersink/BUILD.gn @@ -14,8 +14,7 @@ import("//build/ohos.gni") import("//build/ohos_var.gni") import("//build/test.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../../distributedaudio.gni") module_out_path = "distributed_audio/services/audiomanager/manager_sink_test" diff --git a/services/audiomanager/test/unittest/servicesink/BUILD.gn b/services/audiomanager/test/unittest/servicesink/BUILD.gn index c5888e5d..dadbe725 100644 --- a/services/audiomanager/test/unittest/servicesink/BUILD.gn +++ b/services/audiomanager/test/unittest/servicesink/BUILD.gn @@ -14,8 +14,7 @@ import("//build/ohos.gni") import("//build/ohos_var.gni") import("//build/test.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../../distributedaudio.gni") module_out_path = "distributed_audio/services/audiomanager/service_sink_test" diff --git a/services/audiomanager/test/unittest/servicesource/BUILD.gn b/services/audiomanager/test/unittest/servicesource/BUILD.gn index c4903405..cd9bcd62 100644 --- a/services/audiomanager/test/unittest/servicesource/BUILD.gn +++ b/services/audiomanager/test/unittest/servicesource/BUILD.gn @@ -14,8 +14,7 @@ import("//build/ohos.gni") import("//build/ohos_var.gni") import("//build/test.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../../distributedaudio.gni") module_out_path = "distributed_audio/services/audiomanager/service_source_test" diff --git a/services/audiomanager/test/unittest/source_device/BUILD.gn b/services/audiomanager/test/unittest/source_device/BUILD.gn index f081a21d..5fd18fc6 100644 --- a/services/audiomanager/test/unittest/source_device/BUILD.gn +++ b/services/audiomanager/test/unittest/source_device/BUILD.gn @@ -12,8 +12,7 @@ # limitations under the License. import("//build/test.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../../distributedaudio.gni") module_out_path = "distributed_audio/services/audiomanager/source_device_test" diff --git a/services/audiomanager/test/unittest/sourcemanager/BUILD.gn b/services/audiomanager/test/unittest/sourcemanager/BUILD.gn index 865db41c..7083d45c 100644 --- a/services/audiomanager/test/unittest/sourcemanager/BUILD.gn +++ b/services/audiomanager/test/unittest/sourcemanager/BUILD.gn @@ -12,8 +12,7 @@ # limitations under the License. import("//build/test.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../../distributedaudio.gni") module_out_path = "distributed_audio/services/audiomanager/source_manager_test" diff --git a/services/audioprocessor/test/unittest/BUILD.gn b/services/audioprocessor/test/unittest/BUILD.gn index 350ef0eb..5954b958 100644 --- a/services/audioprocessor/test/unittest/BUILD.gn +++ b/services/audioprocessor/test/unittest/BUILD.gn @@ -13,8 +13,7 @@ import("//build/ohos.gni") import("//build/ohos_var.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../distributedaudio.gni") group("daudio_processor_test") { testonly = true diff --git a/services/audioprocessor/test/unittest/common/decodeprocessor/BUILD.gn b/services/audioprocessor/test/unittest/common/decodeprocessor/BUILD.gn index 563703ad..2217620a 100644 --- a/services/audioprocessor/test/unittest/common/decodeprocessor/BUILD.gn +++ b/services/audioprocessor/test/unittest/common/decodeprocessor/BUILD.gn @@ -14,8 +14,7 @@ import("//build/ohos.gni") import("//build/ohos_var.gni") import("//build/test.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../../../distributedaudio.gni") module_output_path = "distributed_audio/services/audioprocessor/decode_processor_test" diff --git a/services/audioprocessor/test/unittest/common/encodeprocessor/BUILD.gn b/services/audioprocessor/test/unittest/common/encodeprocessor/BUILD.gn index d6c6e124..d8e50fe2 100644 --- a/services/audioprocessor/test/unittest/common/encodeprocessor/BUILD.gn +++ b/services/audioprocessor/test/unittest/common/encodeprocessor/BUILD.gn @@ -14,8 +14,7 @@ import("//build/ohos.gni") import("//build/ohos_var.gni") import("//build/test.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../../../distributedaudio.gni") module_output_path = "distributed_audio/services/audioprocessor/encode_processor_test" diff --git a/services/audiotransport/audiochannel/audiodatachannel/BUILD.gn b/services/audiotransport/audiochannel/audiodatachannel/BUILD.gn index ec33274a..ebf19ad8 100644 --- a/services/audiotransport/audiochannel/audiodatachannel/BUILD.gn +++ b/services/audiotransport/audiochannel/audiodatachannel/BUILD.gn @@ -13,8 +13,7 @@ import("//build/ohos.gni") import("//build/ohos_var.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../distributedaudio.gni") ohos_shared_library("distributed_audio_data_channel") { include_dirs = [ diff --git a/services/audiotransport/audioctrltransport/BUILD.gn b/services/audiotransport/audioctrltransport/BUILD.gn index 1cc7e557..863e5953 100644 --- a/services/audiotransport/audioctrltransport/BUILD.gn +++ b/services/audiotransport/audioctrltransport/BUILD.gn @@ -13,8 +13,7 @@ import("//build/ohos.gni") import("//build/ohos_var.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../distributedaudio.gni") ohos_shared_library("distributed_audio_control") { include_dirs = [ diff --git a/services/audiotransport/audiotransportstatus/BUILD.gn b/services/audiotransport/audiotransportstatus/BUILD.gn index 59171db8..14274182 100644 --- a/services/audiotransport/audiotransportstatus/BUILD.gn +++ b/services/audiotransport/audiotransportstatus/BUILD.gn @@ -13,8 +13,7 @@ import("//build/ohos.gni") import("//build/ohos_var.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../distributedaudio.gni") ohos_shared_library("distributed_audio_transport_status") { include_dirs = [ diff --git a/services/audiotransport/decodetransport/BUILD.gn b/services/audiotransport/decodetransport/BUILD.gn index c56ab209..2c920c4d 100644 --- a/services/audiotransport/decodetransport/BUILD.gn +++ b/services/audiotransport/decodetransport/BUILD.gn @@ -13,8 +13,7 @@ import("//build/ohos.gni") import("//build/ohos_var.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../distributedaudio.gni") ohos_shared_library("distributed_audio_decode_transport") { include_dirs = [ diff --git a/services/audiotransport/encodetransport/BUILD.gn b/services/audiotransport/encodetransport/BUILD.gn index d544e795..7dbd57b4 100644 --- a/services/audiotransport/encodetransport/BUILD.gn +++ b/services/audiotransport/encodetransport/BUILD.gn @@ -13,8 +13,7 @@ import("//build/ohos.gni") import("//build/ohos_var.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../distributedaudio.gni") ohos_shared_library("distributed_audio_encode_transport") { include_dirs = [ diff --git a/services/audiotransport/test/unittest/BUILD.gn b/services/audiotransport/test/unittest/BUILD.gn index 2170f9f3..9df9215a 100644 --- a/services/audiotransport/test/unittest/BUILD.gn +++ b/services/audiotransport/test/unittest/BUILD.gn @@ -13,8 +13,7 @@ import("//build/ohos.gni") import("//build/ohos_var.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../distributedaudio.gni") group("daudio_transport_test") { testonly = true diff --git a/services/audiotransport/test/unittest/audioctrlchannel/BUILD.gn b/services/audiotransport/test/unittest/audioctrlchannel/BUILD.gn index 99596291..5f2a8b41 100644 --- a/services/audiotransport/test/unittest/audioctrlchannel/BUILD.gn +++ b/services/audiotransport/test/unittest/audioctrlchannel/BUILD.gn @@ -12,8 +12,7 @@ # limitations under the License. import("//build/test.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../../distributedaudio.gni") module_out_path = "distributed_audio/services/audiotransport/audio_ctrl_channel_test" diff --git a/services/audiotransport/test/unittest/audioctrltransport/BUILD.gn b/services/audiotransport/test/unittest/audioctrltransport/BUILD.gn index a8ab114f..98a9b979 100644 --- a/services/audiotransport/test/unittest/audioctrltransport/BUILD.gn +++ b/services/audiotransport/test/unittest/audioctrltransport/BUILD.gn @@ -12,8 +12,7 @@ # limitations under the License. import("//build/test.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../../distributedaudio.gni") module_out_path = "distributed_audio/services/audiotransport/audio_ctrl_transport_test" diff --git a/services/audiotransport/test/unittest/audiodatachannel/BUILD.gn b/services/audiotransport/test/unittest/audiodatachannel/BUILD.gn index cce8e1ca..144688b1 100644 --- a/services/audiotransport/test/unittest/audiodatachannel/BUILD.gn +++ b/services/audiotransport/test/unittest/audiodatachannel/BUILD.gn @@ -12,8 +12,7 @@ # limitations under the License. import("//build/test.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../../distributedaudio.gni") module_out_path = "distributed_audio/services/audiotransport/audio_data_channel_test" diff --git a/services/audiotransport/test/unittest/audiotransportstatus/BUILD.gn b/services/audiotransport/test/unittest/audiotransportstatus/BUILD.gn index da81225e..27a29a3b 100644 --- a/services/audiotransport/test/unittest/audiotransportstatus/BUILD.gn +++ b/services/audiotransport/test/unittest/audiotransportstatus/BUILD.gn @@ -14,8 +14,7 @@ import("//build/ohos.gni") import("//build/ohos_var.gni") import("//build/test.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../../distributedaudio.gni") module_output_path = "distributed_audio/services/audiotransport/transport_status_test" diff --git a/services/audiotransport/test/unittest/decodetransport/BUILD.gn b/services/audiotransport/test/unittest/decodetransport/BUILD.gn index 3a702efb..3d9b8588 100644 --- a/services/audiotransport/test/unittest/decodetransport/BUILD.gn +++ b/services/audiotransport/test/unittest/decodetransport/BUILD.gn @@ -14,8 +14,7 @@ import("//build/ohos.gni") import("//build/ohos_var.gni") import("//build/test.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../../distributedaudio.gni") module_output_path = "distributed_audio/services/audiotransport/decode_transport_test" diff --git a/services/audiotransport/test/unittest/encodetransport/BUILD.gn b/services/audiotransport/test/unittest/encodetransport/BUILD.gn index 8e3984b9..0303a744 100644 --- a/services/audiotransport/test/unittest/encodetransport/BUILD.gn +++ b/services/audiotransport/test/unittest/encodetransport/BUILD.gn @@ -14,8 +14,7 @@ import("//build/ohos.gni") import("//build/ohos_var.gni") import("//build/test.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../../distributedaudio.gni") module_output_path = "distributed_audio/services/audiotransport/encode_transport_test" diff --git a/services/common/BUILD.gn b/services/common/BUILD.gn index 6155cf6f..fd1793ed 100644 --- a/services/common/BUILD.gn +++ b/services/common/BUILD.gn @@ -13,8 +13,7 @@ import("//build/ohos.gni") import("//build/ohos_var.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../distributedaudio.gni") config("daudio_common_pub_config") { include_dirs = [ diff --git a/services/common/taskProcessor/test/unittest/BUILD.gn b/services/common/taskProcessor/test/unittest/BUILD.gn index 190814d0..26686b34 100644 --- a/services/common/taskProcessor/test/unittest/BUILD.gn +++ b/services/common/taskProcessor/test/unittest/BUILD.gn @@ -13,8 +13,7 @@ import("//build/ohos.gni") import("//build/ohos_var.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../../distributedaudio.gni") group("task_processor_test") { testonly = true diff --git a/services/common/taskProcessor/test/unittest/task_queue/BUILD.gn b/services/common/taskProcessor/test/unittest/task_queue/BUILD.gn index a86914dc..c2049f5b 100644 --- a/services/common/taskProcessor/test/unittest/task_queue/BUILD.gn +++ b/services/common/taskProcessor/test/unittest/task_queue/BUILD.gn @@ -14,8 +14,7 @@ import("//build/ohos.gni") import("//build/ohos_var.gni") import("//build/test.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../../../distributedaudio.gni") module_out_path = "distributed_audio/services/common/taskProcessor/test" diff --git a/services/common/test/unittest/audiodata/BUILD.gn b/services/common/test/unittest/audiodata/BUILD.gn index 4664caa5..e8a3953a 100644 --- a/services/common/test/unittest/audiodata/BUILD.gn +++ b/services/common/test/unittest/audiodata/BUILD.gn @@ -12,8 +12,7 @@ # limitations under the License. import("//build/test.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../../distributedaudio.gni") module_out_path = "distributed_audio/services/common/audio_data_test" diff --git a/services/hdfaudioclient/BUILD.gn b/services/hdfaudioclient/BUILD.gn index 16b0bbac..1bb5fd87 100644 --- a/services/hdfaudioclient/BUILD.gn +++ b/services/hdfaudioclient/BUILD.gn @@ -13,8 +13,7 @@ import("//build/ohos.gni") import("//drivers/hdf_core/adapter/uhdf2/uhdf.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../distributedaudio.gni") ohos_shared_library("daudio_client") { include_dirs = [ "//drivers//peripheral/audio/interfaces/include/" ] diff --git a/services/hdfaudioclient/test/unittest/BUILD.gn b/services/hdfaudioclient/test/unittest/BUILD.gn index 0d2b763f..0c714fb0 100644 --- a/services/hdfaudioclient/test/unittest/BUILD.gn +++ b/services/hdfaudioclient/test/unittest/BUILD.gn @@ -12,8 +12,7 @@ # limitations under the License. import("//build/test.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../distributedaudio.gni") module_output_path = "distributed_audio/hdfaudioclient" diff --git a/services/softbusadapter/BUILD.gn b/services/softbusadapter/BUILD.gn index f159bf0b..811ce50e 100644 --- a/services/softbusadapter/BUILD.gn +++ b/services/softbusadapter/BUILD.gn @@ -13,8 +13,7 @@ import("//build/ohos.gni") import("//build/ohos_var.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../distributedaudio.gni") ohos_shared_library("distributed_audio_softbus_adapter") { include_dirs = [ diff --git a/services/softbusadapter/test/unittest/BUILD.gn b/services/softbusadapter/test/unittest/BUILD.gn index 6285150b..7d8641af 100644 --- a/services/softbusadapter/test/unittest/BUILD.gn +++ b/services/softbusadapter/test/unittest/BUILD.gn @@ -12,8 +12,7 @@ # limitations under the License. import("//build/test.gni") -import( - "//foundation/distributedhardware/distributed_audio/distributedaudio.gni") +import("../../../../distributedaudio.gni") module_out_path = "distributed_audio/services/softbusadapter" -- Gitee From 3db4207cfc8e7549388b74d83262b00c0dc29d14 Mon Sep 17 00:00:00 2001 From: w30042960 Date: Thu, 13 Apr 2023 16:27:29 +0800 Subject: [PATCH 9/9] modify gn Signed-off-by: w30042960 --- services/audiotransport/audiotransportstatus/BUILD.gn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/audiotransport/audiotransportstatus/BUILD.gn b/services/audiotransport/audiotransportstatus/BUILD.gn index 14274182..f877bd1f 100644 --- a/services/audiotransport/audiotransportstatus/BUILD.gn +++ b/services/audiotransport/audiotransportstatus/BUILD.gn @@ -55,8 +55,8 @@ ohos_shared_library("distributed_audio_transport_status") { external_deps = [ "c_utils:utils", "dsoftbus:softbus_client", - "hitrace_native:hitrace_meter", "hisysevent_native:libhisysevent", + "hitrace_native:hitrace_meter", "multimedia_player_framework:media_client", ] -- Gitee