diff --git a/frameworks/native/audioeffect/include/audio_effect_chain.h b/frameworks/native/audioeffect/include/audio_effect_chain.h index a899ebd3394a0cab725648bbfdcdf21da3d4372c..7bb68f4cb25fa2a1cb47f40376e2bc464a1f253f 100644 --- a/frameworks/native/audioeffect/include/audio_effect_chain.h +++ b/frameworks/native/audioeffect/include/audio_effect_chain.h @@ -45,7 +45,8 @@ public: ~AudioEffectChain(); std::string GetEffectMode(); void SetEffectMode(const std::string &mode); - void AddEffectHandle(AudioEffectHandle effectHandle, AudioEffectLibrary *libHandle, AudioEffectScene currSceneType); + void AddEffectHandle(AudioEffectHandle effectHandle, AudioEffectLibrary *libHandle, AudioEffectScene currSceneType, + const std::string &effectName, const std::string &property); void ApplyEffectChain(float *bufIn, float *bufOut, uint32_t frameLen, AudioEffectProcInfo procInfo); bool IsEmptyEffectHandles(); void Dump(); @@ -58,6 +59,7 @@ public: void ResetIoBufferConfig(); void SetFinalVolume(float volume); float GetFinalVolume(); + int32_t SetEffectProperty(const std::string &effect, const std::string &property); private: AudioEffectConfig GetIoBufferConfig(); @@ -69,6 +71,7 @@ private: std::string effectMode_ = ""; uint32_t latency_ = 0; std::vector standByEffectHandles_; + std::vector effectNames_; std::vector libHandles_; AudioEffectConfig ioBufferConfig_ = {}; AudioBuffer audioBufIn_ = {}; diff --git a/frameworks/native/audioeffect/include/audio_effect_chain_manager.h b/frameworks/native/audioeffect/include/audio_effect_chain_manager.h index 16bdd2ee2d19cc57dfe2efca3370c18868ffb7e2..30dd719c8b1b6ee538a6966a98f82a664abbf268 100644 --- a/frameworks/native/audioeffect/include/audio_effect_chain_manager.h +++ b/frameworks/native/audioeffect/include/audio_effect_chain_manager.h @@ -171,6 +171,7 @@ private: std::map SessionIDToEffectInfoMap_; std::map SceneTypeToEffectChainCountBackupMap_; std::set SceneTypeToSpecialEffectSet_; + std::unordered_map effectPropertyMap_; std::vector priorSceneList_; DeviceType deviceType_ = DEVICE_TYPE_SPEAKER; std::string deviceSink_ = DEFAULT_DEVICE_SINK; diff --git a/frameworks/native/audioeffect/include/audio_enhance_chain.h b/frameworks/native/audioeffect/include/audio_enhance_chain.h index 3be2c3ccc9fe350999a9ad10df38ca63501d9988..9e2814436344836a498a2a30c208188369543b38 100644 --- a/frameworks/native/audioeffect/include/audio_enhance_chain.h +++ b/frameworks/native/audioeffect/include/audio_enhance_chain.h @@ -62,12 +62,14 @@ class AudioEnhanceChain { public: AudioEnhanceChain(const std::string &scene, const AudioEnhanceParam &algoParam); ~AudioEnhanceChain(); - void AddEnhanceHandle(AudioEffectHandle handle, AudioEffectLibrary *libHandle); + void AddEnhanceHandle(AudioEffectHandle handle, AudioEffectLibrary *libHandle, const std::string &enhance, + const std::string &property); bool IsEmptyEnhanceHandles(); void GetAlgoConfig(AudioBufferConfig &algoConfig); uint32_t GetAlgoBufferSize(); uint32_t GetAlgoBufferSizeEc(); int32_t ApplyEnhanceChain(std::unique_ptr &enhanceBuffer, uint32_t length); + int32_t SetEnhanceProperty(const std::string &effect, const std::string &property); int32_t SetEnhanceParamToHandle(AudioEffectHandle handle); private: @@ -75,6 +77,7 @@ private: void InitDump(); void ReleaseEnhanceChain(); int32_t GetOneFrameInputData(std::unique_ptr &enhanceBuffer); + int32_t SetPropertyToHandle(AudioEffectHandle handle, const std::string &property); bool setConfigFlag_; std::mutex chainMutex_; @@ -87,6 +90,7 @@ private: FILE *dumpFileOut_ = nullptr; bool needEcFlag_; std::vector standByEnhanceHandles_; + std::vector enhanceNames_; std::vector enhanceLibHandles_; }; diff --git a/frameworks/native/audioeffect/include/audio_enhance_chain_manager.h b/frameworks/native/audioeffect/include/audio_enhance_chain_manager.h index 7e0750747fe000911d97c7a9f0987743d0a69a86..7234a15edc5463237788e19624bc1d9900690ba3 100644 --- a/frameworks/native/audioeffect/include/audio_enhance_chain_manager.h +++ b/frameworks/native/audioeffect/include/audio_enhance_chain_manager.h @@ -67,6 +67,7 @@ private: std::map> enhanceChainToEnhancesMap_; std::map> enhanceToLibraryEntryMap_; std::map enhanceToLibraryNameMap_; + std::unordered_map enhancePropertyMap_; std::map capturerIdToDeviceMap_; std::map rendererIdToDeviceMap_; std::unique_ptr enhanceBuffer_ = nullptr; diff --git a/frameworks/native/audioeffect/src/audio_effect_chain.cpp b/frameworks/native/audioeffect/src/audio_effect_chain.cpp index 62facd39e699a920fc891a80791b6c201d363613..33448e5e8046649f555cd5eaccad063aa4beb62c 100644 --- a/frameworks/native/audioeffect/src/audio_effect_chain.cpp +++ b/frameworks/native/audioeffect/src/audio_effect_chain.cpp @@ -144,9 +144,9 @@ int32_t AudioEffectChain::SetEffectParamToHandle(AudioEffectHandle handle, Audio { AudioEffectTransInfo cmdInfo = {sizeof(AudioEffectConfig), &ioBufferConfig_}; AudioEffectTransInfo replyInfo = {sizeof(int32_t), &replyData}; + std::vector paramBuffer(sizeof(AudioEffectParam) + NUM_SET_EFFECT_PARAM * sizeof(int32_t)); // Set param - AudioEffectParam *effectParam = - new AudioEffectParam[sizeof(AudioEffectParam) + NUM_SET_EFFECT_PARAM * sizeof(int32_t)]; + AudioEffectParam *effectParam = reinterpret_cast(paramBuffer.data()); effectParam->status = 0; effectParam->paramSize = sizeof(int32_t); effectParam->valueSize = 0; @@ -171,39 +171,70 @@ int32_t AudioEffectChain::SetEffectParamToHandle(AudioEffectHandle handle, Audio AUDIO_DEBUG_LOG("set ap integration volume: %{public}u", *(data - 1)); cmdInfo = {sizeof(AudioEffectParam) + sizeof(int32_t) * NUM_SET_EFFECT_PARAM, effectParam}; int32_t ret = (*handle)->command(handle, EFFECT_CMD_SET_PARAM, &cmdInfo, &replyInfo); - delete[] effectParam; + return ret; +} + +int32_t AudioEffectChain::SetEffectProperty(const std::string &effect, const std::string &property) +{ + std::lock_guard lock(reloadMutex_); + int32_t ret = 0; + int32_t size = standByEffectHandles_.size(); + for (int32_t index = 0; index < size; index++) { + auto &handle = standByEffectHandles_[index]; + auto const &effectName = effectNames_[index]; + if (effect == effectName) { + int32_t replyData = 0; + const char *propCstr = property.c_str(); + AudioEffectTransInfo cmdInfo = {sizeof(const char *), reinterpret_cast(&propCstr)}; + AudioEffectTransInfo replyInfo = {sizeof(int32_t), &replyData}; + ret = (*handle)->command(handle, EFFECT_CMD_SET_PROPERTY, &cmdInfo, &replyInfo); + CHECK_AND_RETURN_RET_LOG(ret == 0, ret, + "[%{public}s] with mode [%{public}s], %{public}s effect EFFECT_CMD_SET_PROPERTY fail", + sceneType_.c_str(), effectMode_.c_str(), effectName.c_str()); + } + } return ret; } void AudioEffectChain::AddEffectHandle(AudioEffectHandle handle, AudioEffectLibrary *libHandle, - AudioEffectScene currSceneType) + AudioEffectScene currSceneType, const std::string &effectName, const std::string &effectProperty) { int32_t ret; int32_t replyData = 0; AudioEffectTransInfo cmdInfo = {sizeof(AudioEffectConfig), &ioBufferConfig_}; AudioEffectTransInfo replyInfo = {sizeof(int32_t), &replyData}; ret = (*handle)->command(handle, EFFECT_CMD_INIT, &cmdInfo, &replyInfo); - CHECK_AND_RETURN_LOG(ret == 0, "[%{public}s] with mode [%{public}s], %{pubilc}s lib EFFECT_CMD_INIT fail", - sceneType_.c_str(), effectMode_.c_str(), libHandle->name); + CHECK_AND_RETURN_LOG(ret == 0, "[%{public}s] with mode [%{public}s], %{public}s effect EFFECT_CMD_INIT fail", + sceneType_.c_str(), effectMode_.c_str(), effectName.c_str()); ret = (*handle)->command(handle, EFFECT_CMD_ENABLE, &cmdInfo, &replyInfo); - CHECK_AND_RETURN_LOG(ret == 0, "[%{public}s] with mode [%{public}s], %{pubilc}s lib EFFECT_CMD_ENABLE fail", - sceneType_.c_str(), effectMode_.c_str(), libHandle->name); + CHECK_AND_RETURN_LOG(ret == 0, "[%{public}s] with mode [%{public}s], %{public}s effect EFFECT_CMD_ENABLE fail", + sceneType_.c_str(), effectMode_.c_str(), effectName.c_str()); CHECK_AND_RETURN_LOG(SetEffectParamToHandle(handle, currSceneType, replyData) == 0, - "[%{public}s] with mode [%{public}s], %{pubilc}s lib EFFECT_CMD_SET_PARAM fail", sceneType_.c_str(), - effectMode_.c_str(), libHandle->name); + "[%{public}s] with mode [%{public}s], %{public}s effect EFFECT_CMD_SET_PARAM fail", sceneType_.c_str(), + effectMode_.c_str(), effectName.c_str()); + + if (!effectProperty.empty()) { + const char *propCstr = effectProperty.c_str(); + cmdInfo = {sizeof(const char *), &propCstr}; + ret = (*handle)->command(handle, EFFECT_CMD_SET_PROPERTY, &cmdInfo, &replyInfo); + CHECK_AND_RETURN_LOG(ret == 0, + "[%{public}s] with mode [%{public}s], %{public}s effect EFFECT_CMD_SET_PROPERTY fail", + sceneType_.c_str(), effectMode_.c_str(), effectName.c_str()); + } cmdInfo = {sizeof(AudioEffectConfig), &ioBufferConfig_}; ret = (*handle)->command(handle, EFFECT_CMD_SET_CONFIG, &cmdInfo, &replyInfo); - CHECK_AND_RETURN_LOG(ret == 0, "[%{public}s] with mode [%{public}s], %{pubilc}s lib EFFECT_CMD_SET_CONFIG fail", - sceneType_.c_str(), effectMode_.c_str(), libHandle->name); + CHECK_AND_RETURN_LOG(ret == 0, "[%{public}s] with mode [%{public}s], %{public}s effect EFFECT_CMD_SET_CONFIG fail", + sceneType_.c_str(), effectMode_.c_str(), effectName.c_str()); ret = (*handle)->command(handle, EFFECT_CMD_GET_CONFIG, &cmdInfo, &cmdInfo); - CHECK_AND_RETURN_LOG(ret == 0, "[%{public}s] with mode [%{public}s], %{pubilc}s lib EFFECT_CMD_GET_CONFIG fail", - sceneType_.c_str(), effectMode_.c_str(), libHandle->name); + CHECK_AND_RETURN_LOG(ret == 0, "[%{public}s] with mode [%{public}s], %{public}s effect EFFECT_CMD_GET_CONFIG fail", + sceneType_.c_str(), effectMode_.c_str(), effectName.c_str()); Swap(ioBufferConfig_.inputCfg, ioBufferConfig_.outputCfg); // pass outputCfg to next algo as inputCfg standByEffectHandles_.emplace_back(handle); + effectNames_.emplace_back(effectName); libHandles_.emplace_back(libHandle); latency_ += static_cast(replyData); } diff --git a/frameworks/native/audioeffect/src/audio_effect_chain_manager.cpp b/frameworks/native/audioeffect/src/audio_effect_chain_manager.cpp index f395811ed7949adeefa85db3eb8fcd3dec3c2aae..121aa64958a08c0158cae2bc1b363e9cbf8025a3 100644 --- a/frameworks/native/audioeffect/src/audio_effect_chain_manager.cpp +++ b/frameworks/native/audioeffect/src/audio_effect_chain_manager.cpp @@ -49,10 +49,12 @@ static int32_t FindEffectLib(const std::string &effect, std::shared_ptr &libEntry, std::string &libName) { for (const std::shared_ptr &lib : effectLibraryList) { - if (lib->libraryName == effect) { - libName = lib->libraryName; - libEntry = lib; - return SUCCESS; + for (const auto &effectName : lib->effectName) { + if (effectName == effect) { + libName = lib->libraryName; + libEntry = lib; + return SUCCESS; + } } } return ERROR; @@ -88,6 +90,7 @@ AudioEffectChainManager::AudioEffectChainManager() SceneTypeToSessionIDMap_.clear(); SessionIDToEffectInfoMap_.clear(); SceneTypeToEffectChainCountBackupMap_.clear(); + effectPropertyMap_.clear(); deviceType_ = DEVICE_TYPE_SPEAKER; deviceSink_ = DEFAULT_DEVICE_SINK; isInitialized_ = false; @@ -279,7 +282,9 @@ void AudioEffectChainManager::InitAudioEffectChainManager(std::vector effects; for (std::string effectName: efc.apply) { - effects.emplace_back(effectName); + if (EffectToLibraryEntryMap_.count(effectName)) { + effects.emplace_back(effectName); + } } EffectChainToEffectsMap_[key] = effects; } @@ -293,6 +298,8 @@ void AudioEffectChainManager::InitAudioEffectChainManager(std::vectorsecond; } } + // Construct effectPropertyMap_ that stores effect's property + effectPropertyMap_ = effectChainManagerParam.effectDefaultProperty; AUDIO_INFO_LOG("EffectToLibraryEntryMap size %{public}zu", EffectToLibraryEntryMap_.size()); AUDIO_DEBUG_LOG("EffectChainToEffectsMap size %{public}zu, SceneTypeAndModeToEffectChainNameMap size %{public}zu", @@ -397,8 +404,9 @@ int32_t AudioEffectChainManager::SetAudioEffectChainDynamic(const std::string &s currSceneType = GetSceneTypeFromSpatializationSceneType(static_cast(GetKeyFromValue( AUDIO_SUPPORTED_SCENE_TYPES, sceneType == DEFAULT_SCENE_TYPE ? DEFAULT_PRESET_SCENE : sceneType))); } + auto propIter = effectPropertyMap_.find(effect); audioEffectChain->AddEffectHandle(handle, EffectToLibraryEntryMap_[effect]->audioEffectLibHandle, - currSceneType); + currSceneType, effect, propIter == effectPropertyMap_.end() ? "" : propIter->second); } audioEffectChain->ResetIoBufferConfig(); @@ -1355,13 +1363,28 @@ bool AudioEffectChainManager::CheckIfSpkDsp() int32_t AudioEffectChainManager::SetAudioEffectProperty(const AudioEffectPropertyArray &propertyArray) { + std::lock_guard lock(dynamicMutex_); + for (const auto &property : propertyArray.property) { + effectPropertyMap_.insert_or_assign(property.effectClass, property.effectProp); + for (const auto &[sceneType, effectChain] : SceneTypeToEffectChainMap_) { + if (effectChain) { + effectChain->SetEffectProperty(property.effectClass, property.effectProp); + } + } + } return AUDIO_OK; } int32_t AudioEffectChainManager::GetAudioEffectProperty(AudioEffectPropertyArray &propertyArray) { + std::lock_guard lock(dynamicMutex_); + propertyArray.property.clear(); + for (const auto &[effect, prop] : effectPropertyMap_) { + if (!prop.empty()) { + propertyArray.property.emplace_back(AudioEffectProperty{effect, prop}); + } + } return AUDIO_OK; } - } // namespace AudioStandard } // namespace OHOS diff --git a/frameworks/native/audioeffect/src/audio_enhance_chain.cpp b/frameworks/native/audioeffect/src/audio_enhance_chain.cpp index a85aa6e4a1f2249bf00c012d23b06ae29371778e..b29f34789f543e59d665bacbf0d45c4f7ef7d88b 100644 --- a/frameworks/native/audioeffect/src/audio_enhance_chain.cpp +++ b/frameworks/native/audioeffect/src/audio_enhance_chain.cpp @@ -122,13 +122,19 @@ int32_t AudioEnhanceChain::SetEnhanceParamToHandle(AudioEffectHandle handle) return SUCCESS; } -void AudioEnhanceChain::AddEnhanceHandle(AudioEffectHandle handle, AudioEffectLibrary *libHandle) +void AudioEnhanceChain::AddEnhanceHandle(AudioEffectHandle handle, AudioEffectLibrary *libHandle, + const std::string &enhance, const std::string &property) { std::lock_guard lock(chainMutex_); int32_t ret = 0; AudioEffectTransInfo cmdInfo = {}; AudioEffectTransInfo replyInfo = {}; + if (SetPropertyToHandle(handle, property) != SUCCESS) { + AUDIO_INFO_LOG("[%{public}s] %{public}s effect EFFECT_CMD_SET_PROPERTY fail", + sceneType_.c_str(), enhance.c_str()); + } + uint32_t maxSampleRate = DEFAULT_SAMPLE_RATE; replyInfo.data = &maxSampleRate; replyInfo.size = sizeof(maxSampleRate); @@ -242,5 +248,33 @@ int32_t AudioEnhanceChain::ApplyEnhanceChain(std::unique_ptr &enh return SUCCESS; } +int32_t AudioEnhanceChain::SetEnhanceProperty(const std::string &enhance, const std::string &property) +{ + std::lock_guard lock(chainMutex_); + int32_t ret = 0; + int32_t size = standByEnhanceHandles_.size(); + for (int32_t index = 0; index < size; index++) { + auto &handle = standByEnhanceHandles_[index]; + auto const &enhanceName = enhanceNames_[index]; + if (enhance == enhanceName) { + if (SetPropertyToHandle(handle, property) != SUCCESS) { + AUDIO_INFO_LOG("[%{public}s] %{public}s effect EFFECT_CMD_SET_PROPERTY fail", + sceneType_.c_str(), enhance.c_str()); + ret = ERROR; + } + } + } + return ret; +} + +int32_t AudioEnhanceChain::SetPropertyToHandle(AudioEffectHandle handle, const std::string &property) +{ + if (property.empty()) { return SUCCESS; } + int32_t replyData = 0; + const char *propCstr = property.c_str(); + AudioEffectTransInfo cmdInfo = {sizeof(const char *), reinterpret_cast(&propCstr)}; + AudioEffectTransInfo replyInfo = {sizeof(int32_t), &replyData}; + return (*handle)->command(handle, EFFECT_CMD_SET_PROPERTY, &cmdInfo, &replyInfo); +} } // namespace AudioStandard } // namespace OHOS \ No newline at end of file diff --git a/frameworks/native/audioeffect/src/audio_enhance_chain_manager.cpp b/frameworks/native/audioeffect/src/audio_enhance_chain_manager.cpp index c5c6fff67ef67afb9436917a28715692e8009c41..b1782c24aaa0f649ff812ee1a011d422bfc0600a 100644 --- a/frameworks/native/audioeffect/src/audio_enhance_chain_manager.cpp +++ b/frameworks/native/audioeffect/src/audio_enhance_chain_manager.cpp @@ -40,10 +40,12 @@ static int32_t FindEnhanceLib(const std::string &enhance, std::shared_ptr &libEntry, std::string &libName) { for (const std::shared_ptr &lib : enhanceLibraryList) { - if (lib->libraryName == enhance) { - libName = lib->libraryName; - libEntry = lib; - return SUCCESS; + for (const auto &effectName : lib->effectName) { + if (effectName == enhance) { + libName = lib->libraryName; + libEntry = lib; + return SUCCESS; + } } } return ERROR; @@ -117,7 +119,9 @@ void AudioEnhanceChainManager::InitAudioEnhanceChainManager(std::vector enhances; for (std::string enhanceName : enhanceChain.apply) { - enhances.emplace_back(enhanceName); + if (enhanceToLibraryEntryMap_.count(enhanceName)) { + enhances.emplace_back(enhanceName); + } } enhanceChainToEnhancesMap_[key] = enhances; } @@ -125,6 +129,9 @@ void AudioEnhanceChainManager::InitAudioEnhanceChainManager(std::vectorfirst] = item->second; } + // Construct enhancePropertyMap_ that stores effect's property + enhancePropertyMap_ = managerParam.effectDefaultProperty; + AUDIO_INFO_LOG("enhanceToLibraryEntryMap_ size %{public}zu \ enhanceToLibraryNameMap_ size %{public}zu \ sceneTypeAndModeToEnhanceChainNameMap_ size %{public}zu", @@ -304,7 +311,9 @@ int32_t AudioEnhanceChainManager::SetAudioEnhanceChainDynamic(const uint32_t sce int32_t ret = enhanceToLibraryEntryMap_[enhance]->audioEffectLibHandle->createEffect(descriptor, &handle); CHECK_AND_CONTINUE_LOG(ret == 0, "EnhanceToLibraryEntryMap[%{public}s] createEffect fail", enhance.c_str()); - audioEnhanceChain->AddEnhanceHandle(handle, enhanceToLibraryEntryMap_[enhance]->audioEffectLibHandle); + auto propIter = enhancePropertyMap_.find(enhance); + audioEnhanceChain->AddEnhanceHandle(handle, enhanceToLibraryEntryMap_[enhance]->audioEffectLibHandle, + enhance, propIter == enhancePropertyMap_.end() ? "" : propIter->second); } if (audioEnhanceChain->IsEmptyEnhanceHandles()) { @@ -402,15 +411,6 @@ bool AudioEnhanceChainManager::IsEmptyEnhanceChain() return ret; } -int32_t AudioEnhanceChainManager::SetAudioEnhanceProperty(const AudioEnhancePropertyArray &propertyArray) -{ - return AUDIO_OK; -} -int32_t AudioEnhanceChainManager::GetAudioEnhanceProperty(AudioEnhancePropertyArray &propertyArray) -{ - return AUDIO_OK; -} - int32_t AudioEnhanceChainManager::CopyToEnhanceBuffer(void *data, uint32_t length) { std::lock_guard lock(chainManagerMutex_); @@ -500,5 +500,35 @@ int32_t AudioEnhanceChainManager::SetStreamVolumeInfo(const uint32_t &sessionId, AUDIO_INFO_LOG("success, sessionId: %{public}d, streamVol: %{public}f", sessionId_, streamVol_); return SUCCESS; } + +int32_t AudioEnhanceChainManager::SetAudioEnhanceProperty(const AudioEnhancePropertyArray &propertyArray) +{ + std::lock_guard lock(chainManagerMutex_); + int32_t ret = 0; + for (const auto &property : propertyArray.property) { + enhancePropertyMap_.insert_or_assign(property.enhanceClass, property.enhanceProp); + for (const auto &[sceneType, enhanceChain] : sceneTypeToEnhanceChainMap_) { + if (enhanceChain) { + ret = enhanceChain->SetEnhanceProperty(property.enhanceClass, property.enhanceProp); + CHECK_AND_RETURN_RET_LOG(ret == 0, ERR_OPERATION_FAILED, "set property failed"); + } + } + } + return 0; +} + +int32_t AudioEnhanceChainManager::GetAudioEnhanceProperty(AudioEnhancePropertyArray &propertyArray) +{ + std::lock_guard lock(chainManagerMutex_); + propertyArray.property.clear(); + for (const auto &[effect, prop] : enhancePropertyMap_) { + if (!prop.empty()) { + propertyArray.property.emplace_back(AudioEnhanceProperty{effect, prop}); + AUDIO_INFO_LOG("effect %{public}s is now %{public}s mode", + effect.c_str(), prop.c_str()); + } + } + return AUDIO_OK; +} } // namespace AudioStandard } // namespace OHOS diff --git a/frameworks/native/audioeffect/test/unittest/effect_unit_test/src/audio_effect_chain_manager_unit_test.cpp b/frameworks/native/audioeffect/test/unittest/effect_unit_test/src/audio_effect_chain_manager_unit_test.cpp index e64412aad54cc1b98541db00d6b427e9f16413bc..6fe85c13c2599ac76e94843ab8e065666fba4d8a 100644 --- a/frameworks/native/audioeffect/test/unittest/effect_unit_test/src/audio_effect_chain_manager_unit_test.cpp +++ b/frameworks/native/audioeffect/test/unittest/effect_unit_test/src/audio_effect_chain_manager_unit_test.cpp @@ -18,6 +18,7 @@ #include "audio_effect_chain_manager_unit_test.h" +#include #include #include #include @@ -42,7 +43,6 @@ constexpr uint32_t INFOCHANNELS = 2; constexpr uint64_t INFOCHANNELLAYOUT = 0x3; vector DEFAULT_EFFECT_CHAINS = {{"EFFECTCHAIN_SPK_MUSIC", {}, ""}, {"EFFECTCHAIN_BT_MUSIC", {}, ""}}; - EffectChainManagerParam DEFAULT_EFFECT_CHAIN_MANAGER_PARAM{ 3, "SCENE_DEFAULT", @@ -52,6 +52,8 @@ EffectChainManagerParam DEFAULT_EFFECT_CHAIN_MANAGER_PARAM{ {{"effect1", "property1"}, {"effect4", "property5"}, {"effect1", "property4"}} }; +AudioEffectPropertyArray DEFAULT_AUDIO_PROPERTY_ARRAY = { { {"effect19", "property19"}, {"effect8", "property10"} } }; + vector> DEFAULT_EFFECT_LIBRARY_LIST = {}; SessionEffectInfo DEFAULT_INFO = { "EFFECT_DEFAULT", @@ -67,12 +69,12 @@ void AudioEffectChainManagerUnitTest::TearDownTestCase(void) {} void AudioEffectChainManagerUnitTest::SetUp(void) {} void AudioEffectChainManagerUnitTest::TearDown(void) {} -/** -* @tc.name : Test CreateAudioEffectChainDynamic API -* @tc.number : CreateAudioEffectChainDynamic_001 -* @tc.desc : Test CreateAudioEffectChainDynamic interface(using empty use case). -* Test GetDeviceTypeName interface and SetAudioEffectChainDynamic interface simultaneously. -*/ +/* + * tc.name : Test CreateAudioEffectChainDynamic API + * tc.number : CreateAudioEffectChainDynamic_001 + * tc.desc : Test CreateAudioEffectChainDynamic interface(using empty use case). + * Test GetDeviceTypeName interface and SetAudioEffectChainDynamic interface simultaneously. + */ HWTEST(AudioEffectChainManagerUnitTest, CreateAudioEffectChainDynamic_001, TestSize.Level1) { string sceneType = ""; @@ -85,12 +87,12 @@ HWTEST(AudioEffectChainManagerUnitTest, CreateAudioEffectChainDynamic_001, TestS AudioEffectChainManager::GetInstance()->ResetInfo(); } -/** -* @tc.name : Test CreateAudioEffectChainDynamic API -* @tc.number : CreateAudioEffectChainDynamic_002 -* @tc.desc : Test CreateAudioEffectChainDynamic interface(using abnormal use case). -* Test GetDeviceTypeName interface and SetAudioEffectChainDynamic interface simultaneously. -*/ +/* + * tc.name : Test CreateAudioEffectChainDynamic API + * tc.number : CreateAudioEffectChainDynamic_002 + * tc.desc : Test CreateAudioEffectChainDynamic interface(using abnormal use case). + * Test GetDeviceTypeName interface and SetAudioEffectChainDynamic interface simultaneously. + */ HWTEST(AudioEffectChainManagerUnitTest, CreateAudioEffectChainDynamic_002, TestSize.Level1) { string sceneType = "123"; @@ -103,12 +105,12 @@ HWTEST(AudioEffectChainManagerUnitTest, CreateAudioEffectChainDynamic_002, TestS AudioEffectChainManager::GetInstance()->ResetInfo(); } -/** -* @tc.name : Test CreateAudioEffectChainDynamic API -* @tc.number : CreateAudioEffectChainDynamic_003 -* @tc.desc : Test CreateAudioEffectChainDynamic interface(using correct use case). -* Test GetDeviceTypeName interface and SetAudioEffectChainDynamic interface simultaneously. -*/ +/* + * tc.name : Test CreateAudioEffectChainDynamic API + * tc.number : CreateAudioEffectChainDynamic_003 + * tc.desc : Test CreateAudioEffectChainDynamic interface(using correct use case). + * Test GetDeviceTypeName interface and SetAudioEffectChainDynamic interface simultaneously. + */ HWTEST(AudioEffectChainManagerUnitTest, CreateAudioEffectChainDynamic_003, TestSize.Level1) { string sceneType = "SCENE_MOVIE"; @@ -121,11 +123,11 @@ HWTEST(AudioEffectChainManagerUnitTest, CreateAudioEffectChainDynamic_003, TestS AudioEffectChainManager::GetInstance()->ResetInfo(); } -/** -* @tc.name : Test CheckAndAddSessionID API -* @tc.number : CheckAndAddSessionID_001 -* @tc.desc : Test CheckAndAddSessionID interface. -*/ +/* + * tc.name : Test CheckAndAddSessionID API + * tc.number : CheckAndAddSessionID_001 + * tc.desc : Test CheckAndAddSessionID interface. + */ HWTEST(AudioEffectChainManagerUnitTest, CheckAndAddSessionID_001, TestSize.Level1) { string sessionID = "123456"; @@ -135,11 +137,11 @@ HWTEST(AudioEffectChainManagerUnitTest, CheckAndAddSessionID_001, TestSize.Level AudioEffectChainManager::GetInstance()->ResetInfo(); } -/** -* @tc.name : Test CheckAndRemoveSessionID API -* @tc.number : CheckAndRemoveSessionID_001 -* @tc.desc : Test CheckAndRemoveSessionID interface(using incorrect use case). -*/ +/* + * tc.name : Test CheckAndRemoveSessionID API + * tc.number : CheckAndRemoveSessionID_001 + * tc.desc : Test CheckAndRemoveSessionID interface(using incorrect use case). + */ HWTEST(AudioEffectChainManagerUnitTest, CheckAndRemoveSessionID_001, TestSize.Level1) { string sessionID = "123456"; @@ -150,11 +152,11 @@ HWTEST(AudioEffectChainManagerUnitTest, CheckAndRemoveSessionID_001, TestSize.Le AudioEffectChainManager::GetInstance()->ResetInfo(); } -/** -* @tc.name : Test CheckAndRemoveSessionID API -* @tc.number : CheckAndRemoveSessionID_002 -* @tc.desc : Test CheckAndRemoveSessionID interface(using correct use case). -*/ +/* + * tc.name : Test CheckAndRemoveSessionID API + * tc.number : CheckAndRemoveSessionID_002 + * tc.desc : Test CheckAndRemoveSessionID interface(using correct use case). + */ HWTEST(AudioEffectChainManagerUnitTest, CheckAndRemoveSessionID_002, TestSize.Level1) { string sessionID = "123456"; @@ -165,11 +167,11 @@ HWTEST(AudioEffectChainManagerUnitTest, CheckAndRemoveSessionID_002, TestSize.Le AudioEffectChainManager::GetInstance()->ResetInfo(); } -/** -* @tc.name : Test CheckAndRemoveSessionID API -* @tc.number : CheckAndRemoveSessionID_003 -* @tc.desc : Test CheckAndRemoveSessionID interface(without using CheckAndAddSessionID interface). -*/ +/* + * tc.name : Test CheckAndRemoveSessionID API + * tc.number : CheckAndRemoveSessionID_003 + * tc.desc : Test CheckAndRemoveSessionID interface(without using CheckAndAddSessionID interface). + */ HWTEST(AudioEffectChainManagerUnitTest, CheckAndRemoveSessionID_003, TestSize.Level1) { string sessionID = "123456"; @@ -179,11 +181,11 @@ HWTEST(AudioEffectChainManagerUnitTest, CheckAndRemoveSessionID_003, TestSize.Le AudioEffectChainManager::GetInstance()->ResetInfo(); } -/** -* @tc.name : Test ReleaseAudioEffectChainDynamic API -* @tc.number : ReleaseAudioEffectChainDynamic_001 -* @tc.desc : Test ReleaseAudioEffectChainDynamic interface(using empty use case). -*/ +/* + * tc.name : Test ReleaseAudioEffectChainDynamic API + * tc.number : ReleaseAudioEffectChainDynamic_001 + * tc.desc : Test ReleaseAudioEffectChainDynamic interface(using empty use case). + */ HWTEST(AudioEffectChainManagerUnitTest, ReleaseAudioEffectChainDynamic_001, TestSize.Level1) { string sceneType = ""; @@ -196,11 +198,11 @@ HWTEST(AudioEffectChainManagerUnitTest, ReleaseAudioEffectChainDynamic_001, Test AudioEffectChainManager::GetInstance()->ResetInfo(); } -/** -* @tc.name : Test ReleaseAudioEffectChainDynamic API -* @tc.number : ReleaseAudioEffectChainDynamic_002 -* @tc.desc : Test ReleaseAudioEffectChainDynamic interface(using incorrect use case). -*/ +/* + * tc.name : Test ReleaseAudioEffectChainDynamic API + * tc.number : ReleaseAudioEffectChainDynamic_002 + * tc.desc : Test ReleaseAudioEffectChainDynamic interface(using incorrect use case). + */ HWTEST(AudioEffectChainManagerUnitTest, ReleaseAudioEffectChainDynamic_002, TestSize.Level1) { string sceneType = "123"; @@ -213,11 +215,11 @@ HWTEST(AudioEffectChainManagerUnitTest, ReleaseAudioEffectChainDynamic_002, Test AudioEffectChainManager::GetInstance()->ResetInfo(); } -/** -* @tc.name : Test ReleaseAudioEffectChainDynamic API -* @tc.number : ReleaseAudioEffectChainDynamic_003 -* @tc.desc : Test ReleaseAudioEffectChainDynamic interface(using correct use case). -*/ +/* + * tc.name : Test ReleaseAudioEffectChainDynamic API + * tc.number : ReleaseAudioEffectChainDynamic_003 + * tc.desc : Test ReleaseAudioEffectChainDynamic interface(using correct use case). + */ HWTEST(AudioEffectChainManagerUnitTest, ReleaseAudioEffectChainDynamic_003, TestSize.Level1) { string sceneType = "SCENE_MOVIE"; @@ -230,11 +232,11 @@ HWTEST(AudioEffectChainManagerUnitTest, ReleaseAudioEffectChainDynamic_003, Test AudioEffectChainManager::GetInstance()->ResetInfo(); } -/** -* @tc.name : Test ExistAudioEffectChain API -* @tc.number : ExistAudioEffectChain_001 -* @tc.desc : Test ExistAudioEffectChain interface(without using InitAudioEffectChainManager). -*/ +/* + * tc.name : Test ExistAudioEffectChain API + * tc.number : ExistAudioEffectChain_001 + * tc.desc : Test ExistAudioEffectChain interface(without using InitAudioEffectChainManager). + */ HWTEST(AudioEffectChainManagerUnitTest, ExistAudioEffectChain_001, TestSize.Level1) { string sceneType = "SCENE_MOVIE"; @@ -247,11 +249,11 @@ HWTEST(AudioEffectChainManagerUnitTest, ExistAudioEffectChain_001, TestSize.Leve AudioEffectChainManager::GetInstance()->ResetInfo(); } -/** -* @tc.name : Test ExistAudioEffectChain API -* @tc.number : ExistAudioEffectChain_002 -* @tc.desc : Test ExistAudioEffectChain interface(using correct use case). -*/ +/* + * tc.name : Test ExistAudioEffectChain API + * tc.number : ExistAudioEffectChain_002 + * tc.desc : Test ExistAudioEffectChain interface(using correct use case). + */ HWTEST(AudioEffectChainManagerUnitTest, ExistAudioEffectChain_002, TestSize.Level1) { string sceneType = "SCENE_MOVIE"; @@ -267,11 +269,11 @@ HWTEST(AudioEffectChainManagerUnitTest, ExistAudioEffectChain_002, TestSize.Leve AudioEffectChainManager::GetInstance()->ResetInfo(); } -/** -* @tc.name : Test ExistAudioEffectChain API -* @tc.number : ExistAudioEffectChain_003 -* @tc.desc : Test ExistAudioEffectChain interface(using empty use case). -*/ +/* + * tc.name : Test ExistAudioEffectChain API + * tc.number : ExistAudioEffectChain_003 + * tc.desc : Test ExistAudioEffectChain interface(using empty use case). + */ HWTEST(AudioEffectChainManagerUnitTest, ExistAudioEffectChain_003, TestSize.Level1) { string sceneType = ""; @@ -287,11 +289,11 @@ HWTEST(AudioEffectChainManagerUnitTest, ExistAudioEffectChain_003, TestSize.Leve AudioEffectChainManager::GetInstance()->ResetInfo(); } -/** -* @tc.name : Test ExistAudioEffectChain API -* @tc.number : ExistAudioEffectChain_004 -* @tc.desc : Test ExistAudioEffectChain interface(using incorrect use case). -*/ +/* + * tc.name : Test ExistAudioEffectChain API + * tc.number : ExistAudioEffectChain_004 + * tc.desc : Test ExistAudioEffectChain interface(using incorrect use case). + */ HWTEST(AudioEffectChainManagerUnitTest, ExistAudioEffectChain_004, TestSize.Level1) { string sceneType = "123"; @@ -307,11 +309,11 @@ HWTEST(AudioEffectChainManagerUnitTest, ExistAudioEffectChain_004, TestSize.Leve AudioEffectChainManager::GetInstance()->ResetInfo(); } -/** -* @tc.name : Test ExistAudioEffectChain API -* @tc.number : ExistAudioEffectChain_005 -* @tc.desc : Test ExistAudioEffectChain interface(without using CreateAudioEffectChainDynamic). -*/ +/* + * tc.name : Test ExistAudioEffectChain API + * tc.number : ExistAudioEffectChain_005 + * tc.desc : Test ExistAudioEffectChain interface(without using CreateAudioEffectChainDynamic). + */ HWTEST(AudioEffectChainManagerUnitTest, ExistAudioEffectChain_005, TestSize.Level1) { string sceneType = "SCENE_MOVIE"; @@ -326,11 +328,11 @@ HWTEST(AudioEffectChainManagerUnitTest, ExistAudioEffectChain_005, TestSize.Leve AudioEffectChainManager::GetInstance()->ResetInfo(); } -/** -* @tc.name : Test ApplyAudioEffectChain API -* @tc.number : ApplyAudioEffectChain_001 -* @tc.desc : Test ApplyAudioEffectChain interface(using empty use case). -*/ +/* + * tc.name : Test ApplyAudioEffectChain API + * tc.number : ApplyAudioEffectChain_001 + * tc.desc : Test ApplyAudioEffectChain interface(using empty use case). + */ HWTEST(AudioEffectChainManagerUnitTest, ApplyAudioEffectChain_001, TestSize.Level1) { float* bufIn; @@ -354,11 +356,11 @@ HWTEST(AudioEffectChainManagerUnitTest, ApplyAudioEffectChain_001, TestSize.Leve AudioEffectChainManager::GetInstance()->ResetInfo(); } -/** -* @tc.name : Test ApplyAudioEffectChain API -* @tc.number : ApplyAudioEffectChain_002 -* @tc.desc : Test ApplyAudioEffectChain interface(using correct use case). -*/ +/* + * tc.name : Test ApplyAudioEffectChain API + * tc.number : ApplyAudioEffectChain_002 + * tc.desc : Test ApplyAudioEffectChain interface(using correct use case). + */ HWTEST(AudioEffectChainManagerUnitTest, ApplyAudioEffectChain_002, TestSize.Level1) { float* bufIn; @@ -382,11 +384,11 @@ HWTEST(AudioEffectChainManagerUnitTest, ApplyAudioEffectChain_002, TestSize.Leve AudioEffectChainManager::GetInstance()->ResetInfo(); } -/** -* @tc.name : Test ApplyAudioEffectChain API -* @tc.number : ApplyAudioEffectChain_003 -* @tc.desc : Test ApplyAudioEffectChain interface(using abnormal use case). -*/ +/* + * tc.name : Test ApplyAudioEffectChain API + * tc.number : ApplyAudioEffectChain_003 + * tc.desc : Test ApplyAudioEffectChain interface(using abnormal use case). + */ HWTEST(AudioEffectChainManagerUnitTest, ApplyAudioEffectChain_003, TestSize.Level1) { float* bufIn; @@ -410,11 +412,11 @@ HWTEST(AudioEffectChainManagerUnitTest, ApplyAudioEffectChain_003, TestSize.Leve AudioEffectChainManager::GetInstance()->ResetInfo(); } -/** -* @tc.name : Test ApplyAudioEffectChain API -* @tc.number : ApplyAudioEffectChain_004 -* @tc.desc : Test ApplyAudioEffectChain interface(without using CreateAudioEffectChainDynamic interface). -*/ +/* + * tc.name : Test ApplyAudioEffectChain API + * tc.number : ApplyAudioEffectChain_004 + * tc.desc : Test ApplyAudioEffectChain interface(without using CreateAudioEffectChainDynamic interface). + */ HWTEST(AudioEffectChainManagerUnitTest, ApplyAudioEffectChain_004, TestSize.Level1) { float* bufIn; @@ -437,12 +439,12 @@ HWTEST(AudioEffectChainManagerUnitTest, ApplyAudioEffectChain_004, TestSize.Leve AudioEffectChainManager::GetInstance()->ResetInfo(); } -/** -* @tc.name : Test SetOutputDeviceSink API -* @tc.number : SetOutputDeviceSink_001 -* @tc.desc : Test SetOutputDeviceSink interface(using correct use case), -* test SetSpkOffloadState interface simultaneously. -*/ +/* + * tc.name : Test SetOutputDeviceSink API + * tc.number : SetOutputDeviceSink_001 + * tc.desc : Test SetOutputDeviceSink interface(using correct use case), + * test SetSpkOffloadState interface simultaneously. + */ HWTEST(AudioEffectChainManagerUnitTest, SetOutputDeviceSink_001, TestSize.Level1) { int32_t device = 2; @@ -454,12 +456,12 @@ HWTEST(AudioEffectChainManagerUnitTest, SetOutputDeviceSink_001, TestSize.Level1 AudioEffectChainManager::GetInstance()->ResetInfo(); } -/** -* @tc.name : Test SetOutputDeviceSink API -* @tc.number : SetOutputDeviceSink_002 -* @tc.desc : Test SetOutputDeviceSink interface(using empty use case), -* test SetSpkOffloadState interface simultaneously. -*/ +/* + * tc.name : Test SetOutputDeviceSink API + * tc.number : SetOutputDeviceSink_002 + * tc.desc : Test SetOutputDeviceSink interface(using empty use case), + * test SetSpkOffloadState interface simultaneously. + */ HWTEST(AudioEffectChainManagerUnitTest, SetOutputDeviceSink_002, TestSize.Level1) { int32_t device = 2; @@ -471,12 +473,12 @@ HWTEST(AudioEffectChainManagerUnitTest, SetOutputDeviceSink_002, TestSize.Level1 AudioEffectChainManager::GetInstance()->ResetInfo(); } -/** -* @tc.name : Test SetOutputDeviceSink API -* @tc.number : SetOutputDeviceSink_003 -* @tc.desc : Test SetOutputDeviceSink interface(using abnormal use case), -* test SetSpkOffloadState interface simultaneously. -*/ +/* + * tc.name : Test SetOutputDeviceSink API + * tc.number : SetOutputDeviceSink_003 + * tc.desc : Test SetOutputDeviceSink interface(using abnormal use case), + * test SetSpkOffloadState interface simultaneously. + */ HWTEST(AudioEffectChainManagerUnitTest, SetOutputDeviceSink_003, TestSize.Level1) { int32_t device = 2; @@ -488,11 +490,11 @@ HWTEST(AudioEffectChainManagerUnitTest, SetOutputDeviceSink_003, TestSize.Level1 AudioEffectChainManager::GetInstance()->ResetInfo(); } -/** -* @tc.name : Test GetDeviceSinkName API -* @tc.number : GetDeviceSinkName_001 -* @tc.desc : Test GetDeviceSinkName interface. -*/ +/* + * tc.name : Test GetDeviceSinkName API + * tc.number : GetDeviceSinkName_001 + * tc.desc : Test GetDeviceSinkName interface. + */ HWTEST(AudioEffectChainManagerUnitTest, GetDeviceSinkName_001, TestSize.Level1) { string result = AudioEffectChainManager::GetInstance()->GetDeviceSinkName(); @@ -501,11 +503,11 @@ HWTEST(AudioEffectChainManagerUnitTest, GetDeviceSinkName_001, TestSize.Level1) AudioEffectChainManager::GetInstance()->ResetInfo(); } -/** -* @tc.name : Test GetOffloadEnabled API -* @tc.number : GetOffloadEnabled_001 -* @tc.desc : Test GetOffloadEnabled interface. -*/ +/* + * tc.name : Test GetOffloadEnabled API + * tc.number : GetOffloadEnabled_001 + * tc.desc : Test GetOffloadEnabled interface. + */ HWTEST(AudioEffectChainManagerUnitTest, GetOffloadEnabled_001, TestSize.Level1) { bool result = AudioEffectChainManager::GetInstance()->GetOffloadEnabled(); @@ -514,21 +516,21 @@ HWTEST(AudioEffectChainManagerUnitTest, GetOffloadEnabled_001, TestSize.Level1) AudioEffectChainManager::GetInstance()->ResetInfo(); } -/** -* @tc.name : Test Dump API -* @tc.number : Dump_001 -* @tc.desc : Test Dump interface. -*/ +/* + * tc.name : Test Dump API + * tc.number : Dump_001 + * tc.desc : Test Dump interface. + */ HWTEST(AudioEffectChainManagerUnitTest, Dump_001, TestSize.Level1) { AudioEffectChainManager::GetInstance()->Dump(); } -/** -* @tc.name : Test UpdateMultichannelConfig API -* @tc.number : UpdateMultichannelConfig_001 -* @tc.desc : Test UpdateMultichannelConfig interface(using correct use case). -*/ +/* + * tc.name : Test UpdateMultichannelConfig API + * tc.number : UpdateMultichannelConfig_001 + * tc.desc : Test UpdateMultichannelConfig interface(using correct use case). + */ HWTEST(AudioEffectChainManagerUnitTest, UpdateMultichannelConfig_001, TestSize.Level1) { string sceneType = "SCENE_MOVIE"; @@ -541,11 +543,11 @@ HWTEST(AudioEffectChainManagerUnitTest, UpdateMultichannelConfig_001, TestSize.L AudioEffectChainManager::GetInstance()->ResetInfo(); } -/** -* @tc.name : Test UpdateMultichannelConfig API -* @tc.number : UpdateMultichannelConfig_002 -* @tc.desc : Test UpdateMultichannelConfig interface(using abnormal use case). -*/ +/* + * tc.name : Test UpdateMultichannelConfig API + * tc.number : UpdateMultichannelConfig_002 + * tc.desc : Test UpdateMultichannelConfig interface(using abnormal use case). + */ HWTEST(AudioEffectChainManagerUnitTest, UpdateMultichannelConfig_002, TestSize.Level1) { string sceneType = "123"; @@ -558,11 +560,11 @@ HWTEST(AudioEffectChainManagerUnitTest, UpdateMultichannelConfig_002, TestSize.L AudioEffectChainManager::GetInstance()->ResetInfo(); } -/** -* @tc.name : Test UpdateMultichannelConfig API -* @tc.number : UpdateMultichannelConfig_003 -* @tc.desc : Test UpdateMultichannelConfig interface(using empty use case). -*/ +/* + * tc.name : Test UpdateMultichannelConfig API + * tc.number : UpdateMultichannelConfig_003 + * tc.desc : Test UpdateMultichannelConfig interface(using empty use case). + */ HWTEST(AudioEffectChainManagerUnitTest, UpdateMultichannelConfig_003, TestSize.Level1) { string sceneType = ""; @@ -575,11 +577,11 @@ HWTEST(AudioEffectChainManagerUnitTest, UpdateMultichannelConfig_003, TestSize.L AudioEffectChainManager::GetInstance()->ResetInfo(); } -/** -* @tc.name : Test UpdateMultichannelConfig API -* @tc.number : UpdateMultichannelConfig_004 -* @tc.desc : Test UpdateMultichannelConfig interface(without using CreateAudioEffectChainDynamic interface). -*/ +/* + * tc.name : Test UpdateMultichannelConfig API + * tc.number : UpdateMultichannelConfig_004 + * tc.desc : Test UpdateMultichannelConfig interface(without using CreateAudioEffectChainDynamic interface). + */ HWTEST(AudioEffectChainManagerUnitTest, UpdateMultichannelConfig_004, TestSize.Level1) { string sceneType = ""; @@ -591,11 +593,11 @@ HWTEST(AudioEffectChainManagerUnitTest, UpdateMultichannelConfig_004, TestSize.L AudioEffectChainManager::GetInstance()->ResetInfo(); } -/** -* @tc.name : Test InitAudioEffectChainDynamic API -* @tc.number : InitAudioEffectChainDynamic_001 -* @tc.desc : Test InitAudioEffectChainDynamic interface(without using InitAudioEffectChainManager interface). -*/ +/* + * tc.name : Test InitAudioEffectChainDynamic API + * tc.number : InitAudioEffectChainDynamic_001 + * tc.desc : Test InitAudioEffectChainDynamic interface(without using InitAudioEffectChainManager interface). + */ HWTEST(AudioEffectChainManagerUnitTest, InitAudioEffectChainDynamic_001, TestSize.Level1) { string sceneType = "SCENE_MOVIE"; @@ -605,11 +607,11 @@ HWTEST(AudioEffectChainManagerUnitTest, InitAudioEffectChainDynamic_001, TestSiz AudioEffectChainManager::GetInstance()->ResetInfo(); } -/** -* @tc.name : Test InitAudioEffectChainDynamic API -* @tc.number : InitAudioEffectChainDynamic_002 -* @tc.desc : Test InitAudioEffectChainDynamic interface(using correct use case). -*/ +/* + * tc.name : Test InitAudioEffectChainDynamic API + * tc.number : InitAudioEffectChainDynamic_002 + * tc.desc : Test InitAudioEffectChainDynamic interface(using correct use case). + */ HWTEST(AudioEffectChainManagerUnitTest, InitAudioEffectChainDynamic_002, TestSize.Level1) { string sceneType = "SCENE_MOVIE"; @@ -621,11 +623,11 @@ HWTEST(AudioEffectChainManagerUnitTest, InitAudioEffectChainDynamic_002, TestSiz AudioEffectChainManager::GetInstance()->ResetInfo(); } -/** -* @tc.name : Test InitAudioEffectChainDynamic API -* @tc.number : InitAudioEffectChainDynamic_003 -* @tc.desc : Test InitAudioEffectChainDynamic interface(using incorrect use case). -*/ +/* + * tc.name : Test InitAudioEffectChainDynamic API + * tc.number : InitAudioEffectChainDynamic_003 + * tc.desc : Test InitAudioEffectChainDynamic interface(using incorrect use case). + */ HWTEST(AudioEffectChainManagerUnitTest, InitAudioEffectChainDynamic_003, TestSize.Level1) { string sceneType = "123"; @@ -637,11 +639,11 @@ HWTEST(AudioEffectChainManagerUnitTest, InitAudioEffectChainDynamic_003, TestSiz AudioEffectChainManager::GetInstance()->ResetInfo(); } -/** -* @tc.name : Test InitAudioEffectChainDynamic API -* @tc.number : InitAudioEffectChainDynamic_004 -* @tc.desc : Test InitAudioEffectChainDynamic interface(using empty use case). -*/ +/* + * tc.name : Test InitAudioEffectChainDynamic API + * tc.number : InitAudioEffectChainDynamic_004 + * tc.desc : Test InitAudioEffectChainDynamic interface(using empty use case). + */ HWTEST(AudioEffectChainManagerUnitTest, InitAudioEffectChainDynamic_004, TestSize.Level1) { string sceneType = ""; @@ -653,12 +655,12 @@ HWTEST(AudioEffectChainManagerUnitTest, InitAudioEffectChainDynamic_004, TestSiz AudioEffectChainManager::GetInstance()->ResetInfo(); } -/** -* @tc.name : Test UpdateSpatializationState API -* @tc.number : UpdateSpatializationState_001 -* @tc.desc : Test UpdateSpatializationState interface.Test UpdateSensorState, -* DeleteAllChains and RecoverAllChains interface simultaneously. -*/ +/* + * tc.name : Test UpdateSpatializationState API + * tc.number : UpdateSpatializationState_001 + * tc.desc : Test UpdateSpatializationState interface.Test UpdateSensorState, + * DeleteAllChains and RecoverAllChains interface simultaneously. + */ HWTEST(AudioEffectChainManagerUnitTest, UpdateSpatializationState_001, TestSize.Level1) { AudioSpatializationState spatializationState = {false, false}; @@ -668,12 +670,12 @@ HWTEST(AudioEffectChainManagerUnitTest, UpdateSpatializationState_001, TestSize. AudioEffectChainManager::GetInstance()->ResetInfo(); } -/** -* @tc.name : Test UpdateSpatializationState API -* @tc.number : UpdateSpatializationState_002 -* @tc.desc : Test UpdateSpatializationState interface.Test UpdateSensorState, -* DeleteAllChains and RecoverAllChains interface simultaneously. -*/ +/* + * tc.name : Test UpdateSpatializationState API + * tc.number : UpdateSpatializationState_002 + * tc.desc : Test UpdateSpatializationState interface.Test UpdateSensorState, + * DeleteAllChains and RecoverAllChains interface simultaneously. + */ HWTEST(AudioEffectChainManagerUnitTest, UpdateSpatializationState_002, TestSize.Level1) { AudioSpatializationState spatializationState = {true, true}; @@ -683,11 +685,11 @@ HWTEST(AudioEffectChainManagerUnitTest, UpdateSpatializationState_002, TestSize. AudioEffectChainManager::GetInstance()->ResetInfo(); } -/** -* @tc.name : Test SetHdiParam API -* @tc.number : SetHdiParam_001 -* @tc.desc : Test SetHdiParam interface(without using InitAudioEffectChainManager interface). -*/ +/* + * tc.name : Test SetHdiParam API + * tc.number : SetHdiParam_001 + * tc.desc : Test SetHdiParam interface(without using InitAudioEffectChainManager interface). + */ HWTEST(AudioEffectChainManagerUnitTest, SetHdiParam_001, TestSize.Level1) { string sceneType = "SCENE_MOVIE"; @@ -699,11 +701,11 @@ HWTEST(AudioEffectChainManagerUnitTest, SetHdiParam_001, TestSize.Level1) AudioEffectChainManager::GetInstance()->ResetInfo(); } -/** -* @tc.name : Test SetHdiParam API -* @tc.number : SetHdiParam_002 -* @tc.desc : Test SetHdiParam interface(enabled = true). -*/ +/* + * tc.name : Test SetHdiParam API + * tc.number : SetHdiParam_002 + * tc.desc : Test SetHdiParam interface(enabled = true). + */ HWTEST(AudioEffectChainManagerUnitTest, SetHdiParam_002, TestSize.Level1) { string sceneType = "SCENE_MOVIE"; @@ -717,11 +719,11 @@ HWTEST(AudioEffectChainManagerUnitTest, SetHdiParam_002, TestSize.Level1) AudioEffectChainManager::GetInstance()->ResetInfo(); } -/** -* @tc.name : Test SetHdiParam API -* @tc.number : SetHdiParam_003 -* @tc.desc : Test SetHdiParam interface(enabled = false). -*/ +/* + * tc.name : Test SetHdiParam API + * tc.number : SetHdiParam_003 + * tc.desc : Test SetHdiParam interface(enabled = false). + */ HWTEST(AudioEffectChainManagerUnitTest, SetHdiParam_003, TestSize.Level1) { string sceneType = "SCENE_MOVIE"; @@ -735,11 +737,11 @@ HWTEST(AudioEffectChainManagerUnitTest, SetHdiParam_003, TestSize.Level1) AudioEffectChainManager::GetInstance()->ResetInfo(); } -/** -* @tc.name : Test SetHdiParam API -* @tc.number : SetHdiParam_004 -* @tc.desc : Test SetHdiParam interface(using empty use case). -*/ +/* + * tc.name : Test SetHdiParam API + * tc.number : SetHdiParam_004 + * tc.desc : Test SetHdiParam interface(using empty use case). + */ HWTEST(AudioEffectChainManagerUnitTest, SetHdiParam_004, TestSize.Level1) { string sceneType = ""; @@ -753,11 +755,11 @@ HWTEST(AudioEffectChainManagerUnitTest, SetHdiParam_004, TestSize.Level1) AudioEffectChainManager::GetInstance()->ResetInfo(); } -/** -* @tc.name : Test SetHdiParam API -* @tc.number : SetHdiParam_005 -* @tc.desc : Test SetHdiParam interface(using incorrect use case). -*/ +/* + * tc.name : Test SetHdiParam API + * tc.number : SetHdiParam_005 + * tc.desc : Test SetHdiParam interface(using incorrect use case). + */ HWTEST(AudioEffectChainManagerUnitTest, SetHdiParam_005, TestSize.Level1) { string sceneType = "123"; @@ -771,11 +773,11 @@ HWTEST(AudioEffectChainManagerUnitTest, SetHdiParam_005, TestSize.Level1) AudioEffectChainManager::GetInstance()->ResetInfo(); } -/** -* @tc.name : Test SessionInfoMapAdd API -* @tc.number : SessionInfoMapAdd_001 -* @tc.desc : Test SessionInfoMapAdd interface. -*/ +/* + * tc.name : Test SessionInfoMapAdd API + * tc.number : SessionInfoMapAdd_001 + * tc.desc : Test SessionInfoMapAdd interface. + */ HWTEST(AudioEffectChainManagerUnitTest, SessionInfoMapAdd_001, TestSize.Level1) { string sessionID = "123456"; @@ -785,11 +787,11 @@ HWTEST(AudioEffectChainManagerUnitTest, SessionInfoMapAdd_001, TestSize.Level1) AudioEffectChainManager::GetInstance()->ResetInfo(); } -/** -* @tc.name : Test SessionInfoMapAdd API -* @tc.number : SessionInfoMapAdd_002 -* @tc.desc : Test SessionInfoMapAdd interface(using empty use case). -*/ +/* + * tc.name : Test SessionInfoMapAdd API + * tc.number : SessionInfoMapAdd_002 + * tc.desc : Test SessionInfoMapAdd interface(using empty use case). + */ HWTEST(AudioEffectChainManagerUnitTest, SessionInfoMapAdd_002, TestSize.Level1) { string sessionID = ""; @@ -799,11 +801,11 @@ HWTEST(AudioEffectChainManagerUnitTest, SessionInfoMapAdd_002, TestSize.Level1) AudioEffectChainManager::GetInstance()->ResetInfo(); } -/** -* @tc.name : Test SessionInfoMapDelete API -* @tc.number : SessionInfoMapDelete_001 -* @tc.desc : Test SessionInfoMapDelete interface(without using SessionInfoMapAdd interface). -*/ +/* + * tc.name : Test SessionInfoMapDelete API + * tc.number : SessionInfoMapDelete_001 + * tc.desc : Test SessionInfoMapDelete interface(without using SessionInfoMapAdd interface). + */ HWTEST(AudioEffectChainManagerUnitTest, SessionInfoMapDelete_001, TestSize.Level1) { string sceneType = "SCENE_MOVIE"; @@ -814,11 +816,11 @@ HWTEST(AudioEffectChainManagerUnitTest, SessionInfoMapDelete_001, TestSize.Level AudioEffectChainManager::GetInstance()->ResetInfo(); } -/** -* @tc.name : Test SessionInfoMapDelete API -* @tc.number : SessionInfoMapDelete_002 -* @tc.desc : Test SessionInfoMapDelete interface(using correct use case). -*/ +/* + * tc.name : Test SessionInfoMapDelete API + * tc.number : SessionInfoMapDelete_002 + * tc.desc : Test SessionInfoMapDelete interface(using correct use case). + */ HWTEST(AudioEffectChainManagerUnitTest, SessionInfoMapDelete_002, TestSize.Level1) { string sceneType = "SCENE_MOVIE"; @@ -832,11 +834,11 @@ HWTEST(AudioEffectChainManagerUnitTest, SessionInfoMapDelete_002, TestSize.Level AudioEffectChainManager::GetInstance()->ResetInfo(); } -/** -* @tc.name : Test SessionInfoMapDelete API -* @tc.number : SessionInfoMapDelete_003 -* @tc.desc : Test SessionInfoMapDelete interface(using incorrect use case). -*/ +/* + * tc.name : Test SessionInfoMapDelete API + * tc.number : SessionInfoMapDelete_003 + * tc.desc : Test SessionInfoMapDelete interface(using incorrect use case). + */ HWTEST(AudioEffectChainManagerUnitTest, SessionInfoMapDelete_003, TestSize.Level1) { string sceneType = "123"; @@ -848,11 +850,11 @@ HWTEST(AudioEffectChainManagerUnitTest, SessionInfoMapDelete_003, TestSize.Level AudioEffectChainManager::GetInstance()->ResetInfo(); } -/** -* @tc.name : Test SessionInfoMapDelete API -* @tc.number : SessionInfoMapDelete_004 -* @tc.desc : Test SessionInfoMapDelete interface(using empty use case). -*/ +/* + * tc.name : Test SessionInfoMapDelete API + * tc.number : SessionInfoMapDelete_004 + * tc.desc : Test SessionInfoMapDelete interface(using empty use case). + */ HWTEST(AudioEffectChainManagerUnitTest, SessionInfoMapDelete_004, TestSize.Level1) { string sceneType = ""; @@ -864,11 +866,11 @@ HWTEST(AudioEffectChainManagerUnitTest, SessionInfoMapDelete_004, TestSize.Level AudioEffectChainManager::GetInstance()->ResetInfo(); } -/** -* @tc.name : Test ReturnEffectChannelInfo API -* @tc.number : ReturnEffectChannelInfo_001 -* @tc.desc : Test ReturnEffectChannelInfo interface(without using SessionInfoMapAdd interface). -*/ +/* + * tc.name : Test ReturnEffectChannelInfo API + * tc.number : ReturnEffectChannelInfo_001 + * tc.desc : Test ReturnEffectChannelInfo interface(without using SessionInfoMapAdd interface). + */ HWTEST(AudioEffectChainManagerUnitTest, ReturnEffectChannelInfo_001, TestSize.Level1) { string sceneType = "SCENE_MOVIE"; @@ -881,11 +883,11 @@ HWTEST(AudioEffectChainManagerUnitTest, ReturnEffectChannelInfo_001, TestSize.Le AudioEffectChainManager::GetInstance()->ResetInfo(); } -/** -* @tc.name : Test ReturnEffectChannelInfo API -* @tc.number : ReturnEffectChannelInfo_002 -* @tc.desc : Test ReturnEffectChannelInfo interface(using correct use case). -*/ +/* + * tc.name : Test ReturnEffectChannelInfo API + * tc.number : ReturnEffectChannelInfo_002 + * tc.desc : Test ReturnEffectChannelInfo interface(using correct use case). + */ HWTEST(AudioEffectChainManagerUnitTest, ReturnEffectChannelInfo_002, TestSize.Level1) { string sceneType = "SCENE_MOVIE"; @@ -906,11 +908,11 @@ HWTEST(AudioEffectChainManagerUnitTest, ReturnEffectChannelInfo_002, TestSize.Le AudioEffectChainManager::GetInstance()->ResetInfo(); } -/** -* @tc.name : Test ReturnEffectChannelInfo API -* @tc.number : ReturnEffectChannelInfo_003 -* @tc.desc : Test ReturnEffectChannelInfo interface(using incorrect use case). -*/ +/* + * tc.name : Test ReturnEffectChannelInfo API + * tc.number : ReturnEffectChannelInfo_003 + * tc.desc : Test ReturnEffectChannelInfo interface(using incorrect use case). + */ HWTEST(AudioEffectChainManagerUnitTest, ReturnEffectChannelInfo_003, TestSize.Level1) { string sceneType = "123"; @@ -925,11 +927,11 @@ HWTEST(AudioEffectChainManagerUnitTest, ReturnEffectChannelInfo_003, TestSize.Le AudioEffectChainManager::GetInstance()->ResetInfo(); } -/** -* @tc.name : Test ReturnEffectChannelInfo API -* @tc.number : ReturnEffectChannelInfo_004 -* @tc.desc : Test ReturnEffectChannelInfo interface(using empty use case). -*/ +/* + * tc.name : Test ReturnEffectChannelInfo API + * tc.number : ReturnEffectChannelInfo_004 + * tc.desc : Test ReturnEffectChannelInfo interface(using empty use case). + */ HWTEST(AudioEffectChainManagerUnitTest, ReturnEffectChannelInfo_004, TestSize.Level1) { string sceneType = ""; @@ -944,11 +946,11 @@ HWTEST(AudioEffectChainManagerUnitTest, ReturnEffectChannelInfo_004, TestSize.Le AudioEffectChainManager::GetInstance()->ResetInfo(); } -/** -* @tc.name : Test ReturnMultiChannelInfo API -* @tc.number : ReturnMultiChannelInfo_001 -* @tc.desc : Test ReturnMultiChannelInfo interface. -*/ +/* + * tc.name : Test ReturnMultiChannelInfo API + * tc.number : ReturnMultiChannelInfo_001 + * tc.desc : Test ReturnMultiChannelInfo interface. + */ HWTEST(AudioEffectChainManagerUnitTest, ReturnMultiChannelInfo_001, TestSize.Level1) { string sceneType = "SCENE_MOVIE"; @@ -962,11 +964,11 @@ HWTEST(AudioEffectChainManagerUnitTest, ReturnMultiChannelInfo_001, TestSize.Lev AudioEffectChainManager::GetInstance()->ResetInfo(); } -/** -* @tc.name : Test RegisterEffectChainCountBackupMap API -* @tc.number : RegisterEffectChainCountBackupMap_001 -* @tc.desc : Test RegisterEffectChainCountBackupMap interface. -*/ +/* + * tc.name : Test RegisterEffectChainCountBackupMap API + * tc.number : RegisterEffectChainCountBackupMap_001 + * tc.desc : Test RegisterEffectChainCountBackupMap interface. + */ HWTEST(AudioEffectChainManagerUnitTest, RegisterEffectChainCountBackupMap_001, TestSize.Level1) { string sceneType = "SCENE_MOVIE"; @@ -976,11 +978,11 @@ HWTEST(AudioEffectChainManagerUnitTest, RegisterEffectChainCountBackupMap_001, T AudioEffectChainManager::GetInstance()->ResetInfo(); } -/** -* @tc.name : Test RegisterEffectChainCountBackupMap API -* @tc.number : RegisterEffectChainCountBackupMap_002 -* @tc.desc : Test RegisterEffectChainCountBackupMap interface. -*/ +/* + * tc.name : Test RegisterEffectChainCountBackupMap API + * tc.number : RegisterEffectChainCountBackupMap_002 + * tc.desc : Test RegisterEffectChainCountBackupMap interface. + */ HWTEST(AudioEffectChainManagerUnitTest, RegisterEffectChainCountBackupMap_002, TestSize.Level1) { string sceneType = "SCENE_MOVIE"; @@ -990,11 +992,11 @@ HWTEST(AudioEffectChainManagerUnitTest, RegisterEffectChainCountBackupMap_002, T AudioEffectChainManager::GetInstance()->ResetInfo(); } -/** -* @tc.name : Test RegisterEffectChainCountBackupMap API -* @tc.number : RegisterEffectChainCountBackupMap_003 -* @tc.desc : Test RegisterEffectChainCountBackupMap interface(using empty use case). -*/ +/* + * tc.name : Test RegisterEffectChainCountBackupMap API + * tc.number : RegisterEffectChainCountBackupMap_003 + * tc.desc : Test RegisterEffectChainCountBackupMap interface(using empty use case). + */ HWTEST(AudioEffectChainManagerUnitTest, RegisterEffectChainCountBackupMap_003, TestSize.Level1) { string sceneType = "SCENE_MOVIE"; @@ -1004,12 +1006,12 @@ HWTEST(AudioEffectChainManagerUnitTest, RegisterEffectChainCountBackupMap_003, T AudioEffectChainManager::GetInstance()->ResetInfo(); } -/** -* @tc.name : Test EffectRotationUpdate API -* @tc.number : EffectRotationUpdate_001 -* @tc.desc : Test EffectRotationUpdate interface. -* Test EffectDspRotationUpdate and EffectApRotationUpdate simultaneously. -*/ +/* + * tc.name : Test EffectRotationUpdate API + * tc.number : EffectRotationUpdate_001 + * tc.desc : Test EffectRotationUpdate interface. + * Test EffectDspRotationUpdate and EffectApRotationUpdate simultaneously. + */ HWTEST(AudioEffectChainManagerUnitTest, EffectRotationUpdate_001, TestSize.Level1) { uint32_t rotationState = 0; @@ -1019,12 +1021,12 @@ HWTEST(AudioEffectChainManagerUnitTest, EffectRotationUpdate_001, TestSize.Level AudioEffectChainManager::GetInstance()->ResetInfo(); } -/** -* @tc.name : Test EffectRotationUpdate API -* @tc.number : EffectRotationUpdate_002 -* @tc.desc : Test EffectRotationUpdate interface. -* Test EffectDspRotationUpdate and EffectApRotationUpdate simultaneously. -*/ +/* + * tc.name : Test EffectRotationUpdate API + * tc.number : EffectRotationUpdate_002 + * tc.desc : Test EffectRotationUpdate interface. + * Test EffectDspRotationUpdate and EffectApRotationUpdate simultaneously. + */ HWTEST(AudioEffectChainManagerUnitTest, EffectRotationUpdate_002, TestSize.Level1) { uint32_t rotationState = 1; @@ -1033,11 +1035,11 @@ HWTEST(AudioEffectChainManagerUnitTest, EffectRotationUpdate_002, TestSize.Level EXPECT_EQ(SUCCESS, result); } -/** -* @tc.name : Test EffectVolumeUpdate API -* @tc.number : EffectVolumeUpdate_001 -* @tc.desc : Test EffectVolumeUpdate interface.Test EffectDspVolumeUpdate and EffectApVolumeUpdate simultaneously. -*/ +/* + * tc.name : Test EffectVolumeUpdate API + * tc.number : EffectVolumeUpdate_001 + * tc.desc : Test EffectVolumeUpdate interface.Test EffectDspVolumeUpdate and EffectApVolumeUpdate simultaneously. + */ HWTEST(AudioEffectChainManagerUnitTest, StreamVolumeUpdate_001, TestSize.Level1) { string sessionIDString = "123456"; @@ -1049,12 +1051,12 @@ HWTEST(AudioEffectChainManagerUnitTest, StreamVolumeUpdate_001, TestSize.Level1) AudioEffectChainManager::GetInstance()->ResetInfo(); } -/** -* @tc.name : Test EffectVolumeUpdate API -* @tc.number : EffectVolumeUpdate_002 -* @tc.desc : Test EffectVolumeUpdate interface(using abnormal use case). -* Test EffectDspVolumeUpdate and EffectApVolumeUpdate simultaneously. -*/ +/* + * tc.name : Test EffectVolumeUpdate API + * tc.number : EffectVolumeUpdate_002 + * tc.desc : Test EffectVolumeUpdate interface(using abnormal use case). + * Test EffectDspVolumeUpdate and EffectApVolumeUpdate simultaneously. + */ HWTEST(AudioEffectChainManagerUnitTest, SystemVolumeUpdate_001, TestSize.Level1) { float systemVolume = 0.888; @@ -1066,11 +1068,11 @@ HWTEST(AudioEffectChainManagerUnitTest, SystemVolumeUpdate_001, TestSize.Level1) AudioEffectChainManager::GetInstance()->ResetInfo(); } -/** -* @tc.name : Test GetLatency API -* @tc.number : GetLatency_001 -* @tc.desc : Test GetLatency interface. -*/ +/* + * tc.name : Test GetLatency API + * tc.number : GetLatency_001 + * tc.desc : Test GetLatency interface. + */ HWTEST(AudioEffectChainManagerUnitTest, GetLatency_001, TestSize.Level1) { string sessionID = "123456" ; @@ -1081,11 +1083,11 @@ HWTEST(AudioEffectChainManagerUnitTest, GetLatency_001, TestSize.Level1) AudioEffectChainManager::GetInstance()->ResetInfo(); } -/** -* @tc.name : Test GetLatency API -* @tc.number : GetLatency_002 -* @tc.desc : Test GetLatency interface(using empty use case). -*/ +/* + * tc.name : Test GetLatency API + * tc.number : GetLatency_002 + * tc.desc : Test GetLatency interface(using empty use case). + */ HWTEST(AudioEffectChainManagerUnitTest, GetLatency_002, TestSize.Level1) { string sessionID = "" ; @@ -1096,13 +1098,12 @@ HWTEST(AudioEffectChainManagerUnitTest, GetLatency_002, TestSize.Level1) AudioEffectChainManager::GetInstance()->ResetInfo(); } - -/** -* @tc.name : Test SetSpatializationSceneType API -* @tc.number : SetSpatializationSceneType_001 -* @tc.desc : Test SetSpatializationSceneType interface. -* Test GetSceneTypeFromSpatializationSceneType and UpdateEffectChainParams interface simultaneously. -*/ +/* + * tc.name : Test SetSpatializationSceneType API + * tc.number : SetSpatializationSceneType_001 + * tc.desc : Test SetSpatializationSceneType interface. + * Test GetSceneTypeFromSpatializationSceneType and UpdateEffectChainParams interface simultaneously. + */ HWTEST(AudioEffectChainManagerUnitTest, SetSpatializationSceneType_001, TestSize.Level1) { AudioSpatializationSceneType spatializationSceneType = SPATIALIZATION_SCENE_TYPE_DEFAULT; @@ -1112,11 +1113,11 @@ HWTEST(AudioEffectChainManagerUnitTest, SetSpatializationSceneType_001, TestSize AudioEffectChainManager::GetInstance()->ResetInfo(); } -/** -* @tc.name : Test GetCurSpatializationEnabled API -* @tc.number : GetCurSpatializationEnabled_001 -* @tc.desc : Test GetCurSpatializationEnabled interface. -*/ +/* + * tc.name : Test GetCurSpatializationEnabled API + * tc.number : GetCurSpatializationEnabled_001 + * tc.desc : Test GetCurSpatializationEnabled interface. + */ HWTEST(AudioEffectChainManagerUnitTest, GetCurSpatializationEnabled_001, TestSize.Level1) { bool result = AudioEffectChainManager::GetInstance()->GetCurSpatializationEnabled(); @@ -1124,14 +1125,56 @@ HWTEST(AudioEffectChainManagerUnitTest, GetCurSpatializationEnabled_001, TestSiz AudioEffectChainManager::GetInstance()->ResetInfo(); } -/** -* @tc.name : Test ResetEffectBuffer API -* @tc.number : ResetEffectBuffer_001 -* @tc.desc : Test ResetEffectBuffer interface. -*/ +/* + * tc.name : Test ResetEffectBuffer API + * tc.number : ResetEffectBuffer_001 + * tc.desc : Test ResetEffectBuffer interface. + */ HWTEST(AudioEffectChainManagerUnitTest, ResetEffectBuffer_001, TestSize.Level1) { AudioEffectChainManager::GetInstance()->ResetEffectBuffer(); } + +/* + * tc.name : Test GetAudioEffectProperty API + * tc.number : GetAudioEffectProperty_001 + * tc.desc : Test GetAudioEffectProperty interface. + */ +HWTEST(AudioEffectChainManagerUnitTest, GetAudioEffectProperty_001, TestSize.Level1) +{ + AudioEffectChainManager::GetInstance()->ResetInfo(); + AudioEffectChainManager::GetInstance()->InitAudioEffectChainManager(DEFAULT_EFFECT_CHAINS, + DEFAULT_EFFECT_CHAIN_MANAGER_PARAM, DEFAULT_EFFECT_LIBRARY_LIST); + AudioEffectPropertyArray properties; + auto ret = AudioEffectChainManager::GetInstance()->GetAudioEffectProperty(properties); + EXPECT_EQ(SUCCESS, ret); + for (auto &[effect, property] : DEFAULT_EFFECT_CHAIN_MANAGER_PARAM.effectDefaultProperty) { + auto it = std::find(properties.property.begin(), properties.property.end(), + AudioEffectProperty{effect, property}); + EXPECT_NE(properties.property.end(), it); + } +} + +/* + * tc.name : Test SetAudioEffectProperty API + * tc.number : SetAudioEffectProperty_001 + * tc.desc : Test SetAudioEffectProperty interface. + */ +HWTEST(AudioEffectChainManagerUnitTest, SetAudioEffectProperty_001, TestSize.Level1) +{ + AudioEffectChainManager *audioEffectChainManager = AudioEffectChainManager::GetInstance(); + audioEffectChainManager->ResetInfo(); + audioEffectChainManager->InitAudioEffectChainManager(DEFAULT_EFFECT_CHAINS, + DEFAULT_EFFECT_CHAIN_MANAGER_PARAM, DEFAULT_EFFECT_LIBRARY_LIST); + auto ret = audioEffectChainManager->SetAudioEffectProperty(DEFAULT_AUDIO_PROPERTY_ARRAY); + EXPECT_EQ(SUCCESS, ret); + AudioEffectPropertyArray properties; + ret = audioEffectChainManager->GetAudioEffectProperty(properties); + EXPECT_EQ(SUCCESS, ret); + for (const auto &property : DEFAULT_AUDIO_PROPERTY_ARRAY.property) { + auto it = std::find(properties.property.begin(), properties.property.end(), property); + EXPECT_NE(properties.property.end(), it); + } +} } // namespace AudioStandard } // namespace OHOS \ No newline at end of file diff --git a/interfaces/inner_api/native/audiocommon/include/audio_effect.h b/interfaces/inner_api/native/audiocommon/include/audio_effect.h index f7f586ed3a5627b7a3b578dc3b7685f4c69d8207..719c226263294320d25a066a948f3ca3695884c7 100644 --- a/interfaces/inner_api/native/audiocommon/include/audio_effect.h +++ b/interfaces/inner_api/native/audiocommon/include/audio_effect.h @@ -260,6 +260,10 @@ const std::unordered_map SUPPORTED_DEVICE_TYPE { struct AudioEnhanceProperty { std::string enhanceClass; std::string enhanceProp; + friend bool operator==(const AudioEnhanceProperty &lhs, const AudioEnhanceProperty &rhs) + { + return lhs.enhanceClass == rhs.enhanceClass && lhs.enhanceProp == rhs.enhanceProp; + } bool Marshalling(Parcel &parcel) const { return parcel.WriteString(enhanceClass)&& @@ -279,6 +283,10 @@ struct AudioEnhancePropertyArray { struct AudioEffectProperty { std::string effectClass; std::string effectProp; + friend bool operator==(const AudioEffectProperty &lhs, const AudioEffectProperty &rhs) + { + return lhs.effectClass == rhs.effectClass && lhs.effectProp == rhs.effectProp; + } bool Marshalling(Parcel &parcel) const { return parcel.WriteString(effectClass)&& @@ -303,7 +311,8 @@ enum AudioEffectCommandCode { EFFECT_CMD_SET_PARAM = 4, EFFECT_CMD_GET_PARAM = 5, EFFECT_CMD_GET_CONFIG = 6, - EFFECT_CMD_SET_IMU = 7 + EFFECT_CMD_SET_IMU = 7, + EFFECT_CMD_SET_PROPERTY = 8 }; enum AudioEffectParamSetCode { diff --git a/services/audio_policy/server/include/service/effect/audio_effect_manager.h b/services/audio_policy/server/include/service/effect/audio_effect_manager.h index dc16d85972dfb98cbd5f3e02464e9e89a8b20ee6..c0a94e51972763419f8248c35339a3431314de55 100644 --- a/services/audio_policy/server/include/service/effect/audio_effect_manager.h +++ b/services/audio_policy/server/include/service/effect/audio_effect_manager.h @@ -43,8 +43,11 @@ public: void ConstructEffectChainManagerParam(EffectChainManagerParam &effectChainMgrParam); void ConstructEnhanceChainManagerParam(EffectChainManagerParam &enhanceChainMgrParam); int32_t QueryEffectManagerSceneMode(SupportedEffectConfig &supportedEffectConfig); - int32_t GetSupportedAudioEffectProperty(const DeviceType& deviceType, AudioEffectPropertyArray &propertyArray); - int32_t GetSupportedAudioEnhanceProperty(const DeviceType& deviceType, AudioEnhancePropertyArray &propertyArray); + int32_t AddSupportedAudioEffectPropertyByDevice(const DeviceType& deviceType, + std::set> &mergedSet); + int32_t AddSupportedAudioEnhancePropertyByDevice(const DeviceType& deviceType, + std::set> &mergedSet); + private: OriginalEffectConfig oriEffectConfig_; std::vector availableEffects_; @@ -53,6 +56,10 @@ private: bool isMasterSinkAvailable_ = false; bool isEffectChainManagerAvailable_ = false; std::vector postSceneTypeSet_; + std::unordered_map>> device2EffectPropertySet_; + std::unordered_map>> device2EnhancePropertySet_; + std::unordered_map effectDefaultProperty_; + std::unordered_map enhanceDefaultProperty_; void UpdateAvailableAEConfig(OriginalEffectConfig &aeConfig); void UpdateEffectChains(std::vector &availableLayout); @@ -63,6 +70,14 @@ private: void UpdateDuplicateDevice(ProcessNew &processNew); int32_t UpdateUnavailableEffectChains(std::vector &availableLayout, ProcessNew &processNew); bool VerifySceneMappingItem(const SceneMappingItem &item); + void UpdateSupportedEffectProperty(const Device &device, + std::unordered_map>> &device2PropertySet); + void UpdateDuplicateProcessNew(std::vector &availableLayout, ProcessNew &processNew); + void ConstructDefaultEffectProperty(const std::string &chainName, + std::unordered_map &defaultProperty); + int32_t AddSupportedPropertyByDeviceInner(const DeviceType& deviceType, + std::set> &mergedSet, + const std::unordered_map>> &device2PropertySet); }; } // namespce AudioStandard } // namespace OHOS diff --git a/services/audio_policy/server/src/service/audio_policy_service.cpp b/services/audio_policy/server/src/service/audio_policy_service.cpp index b6ecbf3985df559d135795389f2d30825d7cbebc..fca41895eded015736649c3866da366342b3a4b1 100644 --- a/services/audio_policy/server/src/service/audio_policy_service.cpp +++ b/services/audio_policy/server/src/service/audio_policy_service.cpp @@ -8426,19 +8426,35 @@ void AudioPolicyService::LoadHdiEffectModel() int32_t AudioPolicyService::GetSupportedAudioEffectProperty(AudioEffectPropertyArray &propertyArray) { + std::set> mergedSet = {}; + // Get supported property for all device + audioEffectManager_.AddSupportedAudioEffectPropertyByDevice(DEVICE_TYPE_INVALID, mergedSet); std::vector> descriptor = GetDevices(OUTPUT_DEVICES_FLAG); for (auto &item : descriptor) { - audioEffectManager_.GetSupportedAudioEffectProperty(item->getType(), propertyArray); + audioEffectManager_.AddSupportedAudioEffectPropertyByDevice(item->getType(), mergedSet); } + propertyArray.property.reserve(mergedSet.size()); + std::transform(mergedSet.begin(), mergedSet.end(), std::back_inserter(propertyArray.property), + [](const std::pair& p) { + return AudioEffectProperty{p.first, p.second}; + }); return AUDIO_OK; } int32_t AudioPolicyService::GetSupportedAudioEnhanceProperty(AudioEnhancePropertyArray &propertyArray) { - std::vector> descriptor = GetDevices(INPUT_DEVICES_FLAG); + std::set> mergedSet = {}; + // Get supported property for all device + audioEffectManager_.AddSupportedAudioEnhancePropertyByDevice(DEVICE_TYPE_INVALID, mergedSet); + std::vector> descriptor = GetDevices(INPUT_DEVICES_FLAG); for (auto &item : descriptor) { - audioEffectManager_.GetSupportedAudioEnhanceProperty(item->getType(), propertyArray); + audioEffectManager_.AddSupportedAudioEnhancePropertyByDevice(item->getType(), mergedSet); } + propertyArray.property.reserve(mergedSet.size()); + std::transform(mergedSet.begin(), mergedSet.end(), std::back_inserter(propertyArray.property), + [](const std::pair& p) { + return AudioEnhanceProperty{p.first, p.second}; + }); return AUDIO_OK; } diff --git a/services/audio_policy/server/src/service/effect/audio_effect_manager.cpp b/services/audio_policy/server/src/service/effect/audio_effect_manager.cpp index 32ce5ab08f20a08e5113af8f96fd219ca62b0b8c..607ab5d0ab242d829bab6d07d901081199102561 100644 --- a/services/audio_policy/server/src/service/effect/audio_effect_manager.cpp +++ b/services/audio_policy/server/src/service/effect/audio_effect_manager.cpp @@ -209,7 +209,7 @@ void AudioEffectManager::UpdateEffectChains(std::vector &availableL int32_t count = 0; std::vector deviceDelIdx; for (const auto &ec: supportedEffectConfig_.effectChains) { - for (auto &effectName: ec.apply) { + for (const auto &effectName: ec.apply) { auto it = std::find_if(availableEffects_.begin(), availableEffects_.end(), [&effectName](const Effect &effect) { return effect.name == effectName; @@ -485,9 +485,54 @@ int32_t AudioEffectManager::UpdateUnavailableEffectChains(std::vector>> &device2PropertySet) +{ + auto chainName = device.chain; + auto effectChain = std::find_if(supportedEffectConfig_.effectChains.begin(), + supportedEffectConfig_.effectChains.end(), + [&chainName](const EffectChain& x) { + return x.name == chainName; + }); + if (effectChain == supportedEffectConfig_.effectChains.end()) { + return; + } + for (const auto &effectName : effectChain->apply) { + auto effectIter = std::find_if(availableEffects_.begin(), availableEffects_.end(), + [&effectName](const Effect& effect) { + return effect.name == effectName; + }); + if (effectIter == availableEffects_.end()) { + continue; + } + for (const auto &property : effectIter->effectProperty) { + auto deviceIter = device2PropertySet.find(device.type); + if (deviceIter == device2PropertySet.end()) { + device2PropertySet[device.type].insert({effectIter->name, property}); + } else { + deviceIter->second.insert({effectIter->name, property}); + } + AUDIO_INFO_LOG("device %{public}s support effect [%{public}s, %{public}s]", + device.type.c_str(), effectIter->name.c_str(), property.c_str()); + } + } +} + +void AudioEffectManager::UpdateDuplicateProcessNew(std::vector &availableLayout, ProcessNew &processNew) +{ + UpdateEffectChains(availableLayout); + UpdateDuplicateBypassMode(processNew); + UpdateDuplicateMode(processNew); + UpdateDuplicateDevice(processNew); + UpdateDuplicateDefaultScene(processNew); + UpdateDuplicateScene(processNew); + if (UpdateUnavailableEffectChains(availableLayout, supportedEffectConfig_.preProcessNew) != 0) { + existDefault_ = -1; + } +} + void AudioEffectManager::BuildAvailableAEConfig() { - int32_t ret = 0 ; std::vector availableLayout; existDefault_ = 1; if (oriEffectConfig_.effectChains.size() == 0) { @@ -513,28 +558,22 @@ void AudioEffectManager::BuildAvailableAEConfig() // Update duplicate defined modes, devices, and unsupported effect chain. UpdateAvailableAEConfig(oriEffectConfig_); - ProcessNew preProcessNew = supportedEffectConfig_.preProcessNew; - ProcessNew postProcessNew = supportedEffectConfig_.postProcessNew; + UpdateDuplicateProcessNew(availableLayout, supportedEffectConfig_.preProcessNew); + UpdateDuplicateProcessNew(availableLayout, supportedEffectConfig_.postProcessNew); - UpdateEffectChains(availableLayout); - UpdateDuplicateBypassMode(supportedEffectConfig_.preProcessNew); - UpdateDuplicateMode(supportedEffectConfig_.preProcessNew); - UpdateDuplicateDevice(supportedEffectConfig_.preProcessNew); - UpdateDuplicateDefaultScene(supportedEffectConfig_.preProcessNew); - UpdateDuplicateScene(supportedEffectConfig_.preProcessNew); - ret = UpdateUnavailableEffectChains(availableLayout, supportedEffectConfig_.preProcessNew); - if (ret != 0) { - existDefault_ = -1; + for (auto &stream : supportedEffectConfig_.preProcessNew.stream) { + for (auto &streamMode : stream.streamEffectMode) { + for (auto &device : streamMode.devicePort) { + UpdateSupportedEffectProperty(device, device2EnhancePropertySet_); + } + } } - - UpdateDuplicateBypassMode(supportedEffectConfig_.postProcessNew); - UpdateDuplicateMode(supportedEffectConfig_.postProcessNew); - UpdateDuplicateDevice(supportedEffectConfig_.postProcessNew); - UpdateDuplicateDefaultScene(supportedEffectConfig_.postProcessNew); - UpdateDuplicateScene(supportedEffectConfig_.postProcessNew); - ret = UpdateUnavailableEffectChains(availableLayout, supportedEffectConfig_.postProcessNew); - if (ret != 0) { - existDefault_ = -1; + for (auto &stream : supportedEffectConfig_.postProcessNew.stream) { + for (auto &streamMode : stream.streamEffectMode) { + for (auto &device : streamMode.devicePort) { + UpdateSupportedEffectProperty(device, device2EffectPropertySet_); + } + } } } @@ -562,14 +601,48 @@ void AddKeyValueIntoMap(std::unordered_map &map, std::string &ke map[key] = value; } +void AudioEffectManager::ConstructDefaultEffectProperty(const std::string &chainName, + std::unordered_map &effectDefaultProperty) +{ + auto effectChain = std::find_if(supportedEffectConfig_.effectChains.begin(), + supportedEffectConfig_.effectChains.end(), + [&chainName](const EffectChain& x) { + return x.name == chainName; + }); + if (effectChain == supportedEffectConfig_.effectChains.end()) { + return; + } + for (const auto &effectName : effectChain->apply) { + auto effectIter = std::find_if(availableEffects_.begin(), availableEffects_.end(), + [&effectName](const Effect& effect) { + return effect.name == effectName; + }); + if (effectIter == availableEffects_.end()) { + continue; + } + // if 0 property, no need to set default + if (effectIter->effectProperty.size() > 0) { + // first assign, and no need to assign twice + if (!effectDefaultProperty.count(effectIter->name)) { + // only first property is default set + effectDefaultProperty[effectIter->name] = effectIter->effectProperty[0]; + AUDIO_INFO_LOG("effect %{public}s defaultProperty is %{public}s", + effectIter->name.c_str(), effectIter->effectProperty[0].c_str()); + } + } + } +} + void AudioEffectManager::ConstructEffectChainManagerParam(EffectChainManagerParam &effectChainMgrParam) { std::unordered_map &map = effectChainMgrParam.sceneTypeToChainNameMap; + std::unordered_map &effectDefaultProperty = effectChainMgrParam.effectDefaultProperty; effectChainMgrParam.maxExtraNum = oriEffectConfig_.postProcess.maxExtSceneNum; std::string sceneType; std::string sceneMode; std::string key; + for (auto &scene: supportedEffectConfig_.postProcessNew.stream) { sceneType = scene.scene; if (scene.priority == PRIOR_SCENE) { @@ -583,6 +656,7 @@ void AudioEffectManager::ConstructEffectChainManagerParam(EffectChainManagerPara for (auto &device: mode.devicePort) { key = sceneType + "_&_" + sceneMode + "_&_" + device.type; AddKeyValueIntoMap(map, key, device.chain); + ConstructDefaultEffectProperty(device.chain, effectDefaultProperty); } } } @@ -593,6 +667,7 @@ void AudioEffectManager::ConstructEffectChainManagerParam(EffectChainManagerPara void AudioEffectManager::ConstructEnhanceChainManagerParam(EffectChainManagerParam &enhanceChainMgrParam) { std::unordered_map &map = enhanceChainMgrParam.sceneTypeToChainNameMap; + std::unordered_map &enhanceDefaultProperty = enhanceChainMgrParam.effectDefaultProperty; enhanceChainMgrParam.maxExtraNum = oriEffectConfig_.preProcess.maxExtSceneNum; std::string sceneType; @@ -613,21 +688,41 @@ void AudioEffectManager::ConstructEnhanceChainManagerParam(EffectChainManagerPar for (auto &device: mode.devicePort) { key = sceneType + "_&_" + sceneMode; AddKeyValueIntoMap(map, key, device.chain); + ConstructDefaultEffectProperty(device.chain, enhanceDefaultProperty); } } } AUDIO_INFO_LOG("Constructed SceneTypeAndModeToEnhanceChainNameMap at policy, size is %{public}d", (int32_t)map.size()); } -int32_t AudioEffectManager::GetSupportedAudioEffectProperty(const DeviceType &deviceType, - AudioEffectPropertyArray &propertyArray) + +int32_t AudioEffectManager::AddSupportedPropertyByDeviceInner(const DeviceType& deviceType, + std::set> &mergedSet, + const std::unordered_map>> &device2PropertySet) { + auto deviceIter = SUPPORTED_DEVICE_TYPE.find(deviceType); + if (deviceIter == SUPPORTED_DEVICE_TYPE.end()) { + AUDIO_ERR_LOG("device not supported."); + return -1; + } + auto deviceStr = deviceType == DEVICE_TYPE_INVALID ? "" : deviceIter->second; + auto propertySetIter = device2PropertySet.find(deviceStr); + if (propertySetIter != device2PropertySet.end()) { + mergedSet.insert(propertySetIter->second.begin(), propertySetIter->second.end()); + } return AUDIO_OK; } -int32_t AudioEffectManager::GetSupportedAudioEnhanceProperty(const DeviceType &deviceType, - AudioEnhancePropertyArray &propertyArray) + +int32_t AudioEffectManager::AddSupportedAudioEffectPropertyByDevice(const DeviceType &deviceType, + std::set> &mergedSet) { - return AUDIO_OK; + return AddSupportedPropertyByDeviceInner(deviceType, mergedSet, device2EffectPropertySet_); +} + +int32_t AudioEffectManager::AddSupportedAudioEnhancePropertyByDevice(const DeviceType &deviceType, + std::set> &mergedSet) +{ + return AddSupportedPropertyByDeviceInner(deviceType, mergedSet, device2EnhancePropertySet_); } } // namespce AudioStandard } // namespace OHOS diff --git a/services/audio_service/client/src/audio_manager_proxy.cpp b/services/audio_service/client/src/audio_manager_proxy.cpp index 8744647612111a69bccec5e21a0f24db6cf2f4c0..61f2d51b8dfa12377177b20f42aefe6039147c4d 100644 --- a/services/audio_service/client/src/audio_manager_proxy.cpp +++ b/services/audio_service/client/src/audio_manager_proxy.cpp @@ -817,7 +817,7 @@ void AudioManagerProxy::RequestThreadPriority(uint32_t tid, string bundleName) CHECK_AND_RETURN_LOG(error == ERR_NONE, "RequestThreadPriority failed, error: %{public}d", error); } -static void MarshellEffectChainMgrParam(const EffectChainManagerParam &effectChainMgrParam, MessageParcel &data) +static void MarshallEffectChainMgrParam(const EffectChainManagerParam &effectChainMgrParam, MessageParcel &data) { data.WriteInt32(effectChainMgrParam.maxExtraNum); data.WriteString(effectChainMgrParam.defaultSceneName); @@ -870,8 +870,8 @@ bool AudioManagerProxy::CreateEffectChainManager(std::vector &effec } } - MarshellEffectChainMgrParam(effectParam, dataParcel); - MarshellEffectChainMgrParam(enhanceParam, dataParcel); + MarshallEffectChainMgrParam(effectParam, dataParcel); + MarshallEffectChainMgrParam(enhanceParam, dataParcel); error = Remote()->SendRequest( static_cast(AudioServerInterfaceCode::CREATE_AUDIO_EFFECT_CHAIN_MANAGER), diff --git a/services/audio_service/server/src/audio_manager_stub.cpp b/services/audio_service/server/src/audio_manager_stub.cpp index c208e03ef583d8addacd8429afca22ebd8fda589..7670161e8eaa9d126c642a163fc2bb7293272bca 100644 --- a/services/audio_service/server/src/audio_manager_stub.cpp +++ b/services/audio_service/server/src/audio_manager_stub.cpp @@ -435,7 +435,7 @@ int AudioManagerStub::HandleRequestThreadPriority(MessageParcel &data, MessagePa return AUDIO_OK; } -static bool UnmarshellEffectChainMgrParam(EffectChainManagerParam &effectChainMgrParam, MessageParcel &data) +static bool UnmarshallEffectChainMgrParam(EffectChainManagerParam &effectChainMgrParam, MessageParcel &data) { effectChainMgrParam.maxExtraNum = data.ReadInt32(); effectChainMgrParam.defaultSceneName = data.ReadString(); @@ -478,7 +478,7 @@ int AudioManagerStub::HandleCreateAudioEffectChainManager(MessageParcel &data, M for (i = 0; i < countChains; i++) { int32_t count = data.ReadInt32(); CHECK_AND_RETURN_RET_LOG(count >= 0 && count <= AUDIO_EFFECT_COUNT_PER_CHAIN_UPPER_LIMIT, - AUDIO_ERR, "Create audio effect chains failed, invalid count"); + AUDIO_ERR, "Create audio effect chains failed, invalid effect count"); countEffect.emplace_back(count); } @@ -493,7 +493,7 @@ int AudioManagerStub::HandleCreateAudioEffectChainManager(MessageParcel &data, M EffectChainManagerParam effectParam; EffectChainManagerParam enhanceParam; - if (!UnmarshellEffectChainMgrParam(effectParam, data) || !UnmarshellEffectChainMgrParam(enhanceParam, data)) { + if (!UnmarshallEffectChainMgrParam(effectParam, data) || !UnmarshallEffectChainMgrParam(enhanceParam, data)) { return AUDIO_ERR; }