From 7d191338da700c1294cf5185900352502a72eb19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=92=8B=E5=BF=97=E5=BA=86?= Date: Tue, 10 Dec 2024 11:28:18 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E9=9F=B3=E6=95=88=E6=8C=81=E4=B9=85?= =?UTF-8?q?=E5=8C=96=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 蒋志庆 --- .../src/audio_enhance_chain_manager.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/frameworks/native/audioeffect/src/audio_enhance_chain_manager.cpp b/frameworks/native/audioeffect/src/audio_enhance_chain_manager.cpp index 993324256d..99ddcdc355 100644 --- a/frameworks/native/audioeffect/src/audio_enhance_chain_manager.cpp +++ b/frameworks/native/audioeffect/src/audio_enhance_chain_manager.cpp @@ -819,7 +819,7 @@ int32_t AudioEnhanceChainManager::SetAudioEnhancePropertyToChains(AudioEffectPro AUDIO_DEBUG_LOG("effectClass->name %{public}s effectProp->category %{public}s", property.name.c_str(), property.category.c_str()); ret = enhanceChain->SetEnhanceProperty(property.name, property.category); - CHECK_AND_CONTINUE_LOG(ret = AUDIO_OK, "set property failed[%{public}d]", ret); + CHECK_AND_CONTINUE_LOG(ret == AUDIO_OK, "set property failed[%{public}d]", ret); } } return ret; @@ -828,28 +828,33 @@ int32_t AudioEnhanceChainManager::SetAudioEnhancePropertyToChains(AudioEffectPro int32_t AudioEnhanceChainManager::SetAudioEnhanceProperty(const AudioEnhancePropertyArray &propertyArray, DeviceType deviceType) { + int32_t ret = 0; std::lock_guard lock(chainManagerMutex_); for (const auto &property : propertyArray.property) { enhancePropertyMap_.insert_or_assign(property.enhanceClass, property.enhanceProp); - SetAudioEnhancePropertyToChains(property); std::string deviceTypeName = ""; GetDeviceTypeName(deviceType, deviceTypeName); std::string key = property.enhanceClass + "_&_" + deviceTypeName; - WriteEnhancePropertyToDb(key, property.enhanceProp); + ret = WriteEnhancePropertyToDb(key, property.enhanceProp); + if (ret != SUCCESS) { + AUDIO_ERR_LOG("fail, WriteEnhancePropertyToDb, ErrCode: %{public}d", ret); + continue; + } + SetAudioEnhancePropertyToChains(property); } return 0; } int32_t AudioEnhanceChainManager::SetAudioEnhancePropertyToChains(AudioEnhanceProperty property) { - int32_t ret = 0; + int32_t ret = AUDIO_OK; 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"); + CHECK_AND_RETURN_RET_LOG(ret == AUDIO_OK, ERR_OPERATION_FAILED, "set property failed"); } } - return 0; + return ret; } int32_t AudioEnhanceChainManager::WriteEnhancePropertyToDb(const std::string &key, const std::string &property) -- Gitee From 44a2f061c8744782a499541183dacb2ee78bb577 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=92=8B=E5=BF=97=E5=BA=86?= Date: Tue, 10 Dec 2024 15:54:06 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E9=9F=B3=E6=95=88=E6=8C=81=E4=B9=85?= =?UTF-8?q?=E5=8C=96=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 蒋志庆 --- .../src/audio_enhance_chain_manager.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/frameworks/native/audioeffect/src/audio_enhance_chain_manager.cpp b/frameworks/native/audioeffect/src/audio_enhance_chain_manager.cpp index 99ddcdc355..f1fc23ea12 100644 --- a/frameworks/native/audioeffect/src/audio_enhance_chain_manager.cpp +++ b/frameworks/native/audioeffect/src/audio_enhance_chain_manager.cpp @@ -794,7 +794,7 @@ int32_t AudioEnhanceChainManager::SetStreamVolumeInfo(const uint32_t &sessionId, int32_t AudioEnhanceChainManager::SetAudioEnhanceProperty(const AudioEffectPropertyArrayV3 &propertyArray, DeviceType deviceType) { - int32_t ret = 0; + int32_t ret = SUCCESS; std::lock_guard lock(chainManagerMutex_); for (const auto &property : propertyArray.property) { enhancePropertyMap_.insert_or_assign(property.name, property.category); @@ -808,18 +808,18 @@ int32_t AudioEnhanceChainManager::SetAudioEnhanceProperty(const AudioEffectPrope } SetAudioEnhancePropertyToChains(property); } - return AUDIO_OK; + return SUCCESS; } int32_t AudioEnhanceChainManager::SetAudioEnhancePropertyToChains(AudioEffectPropertyV3 property) { - int32_t ret = AUDIO_OK; + int32_t ret = SUCCESS; for (const auto &[sceneType, enhanceChain] : sceneTypeToEnhanceChainMap_) { if (enhanceChain) { AUDIO_DEBUG_LOG("effectClass->name %{public}s effectProp->category %{public}s", property.name.c_str(), property.category.c_str()); ret = enhanceChain->SetEnhanceProperty(property.name, property.category); - CHECK_AND_CONTINUE_LOG(ret == AUDIO_OK, "set property failed[%{public}d]", ret); + CHECK_AND_CONTINUE_LOG(ret == SUCCESS, "set property failed[%{public}d]", ret); } } return ret; @@ -828,7 +828,7 @@ int32_t AudioEnhanceChainManager::SetAudioEnhancePropertyToChains(AudioEffectPro int32_t AudioEnhanceChainManager::SetAudioEnhanceProperty(const AudioEnhancePropertyArray &propertyArray, DeviceType deviceType) { - int32_t ret = 0; + int32_t ret = SUCCESS; std::lock_guard lock(chainManagerMutex_); for (const auto &property : propertyArray.property) { enhancePropertyMap_.insert_or_assign(property.enhanceClass, property.enhanceProp); @@ -842,19 +842,19 @@ int32_t AudioEnhanceChainManager::SetAudioEnhanceProperty(const AudioEnhanceProp } SetAudioEnhancePropertyToChains(property); } - return 0; + return SUCCESS; } int32_t AudioEnhanceChainManager::SetAudioEnhancePropertyToChains(AudioEnhanceProperty property) { - int32_t ret = AUDIO_OK; + int32_t ret = SUCCESS; for (const auto &[sceneType, enhanceChain] : sceneTypeToEnhanceChainMap_) { if (enhanceChain) { ret = enhanceChain->SetEnhanceProperty(property.enhanceClass, property.enhanceProp); - CHECK_AND_RETURN_RET_LOG(ret == AUDIO_OK, ERR_OPERATION_FAILED, "set property failed"); + CHECK_AND_RETURN_RET_LOG(ret == SUCCESS, ERR_OPERATION_FAILED, "set property failed"); } } - return ret; + return ret; } int32_t AudioEnhanceChainManager::WriteEnhancePropertyToDb(const std::string &key, const std::string &property) -- Gitee