From fb8886c78571c58878dab3b17c7796c9706c3711 Mon Sep 17 00:00:00 2001 From: XuWentao Date: Tue, 16 Jul 2024 19:53:32 +0800 Subject: [PATCH 1/6] SampleRateAlignment Signed-off-by: XuWentao --- .../include/audio_enhance_chain_adapter.h | 2 +- .../include/audio_enhance_chain_manager.h | 3 +- .../src/audio_enhance_chain_adapter.cpp | 40 +++++++------------ .../src/audio_enhance_chain_manager.cpp | 21 +++++----- .../pulseaudio/modules/hdi/hdi_source.c | 29 +++++++++++++- .../modules/hdi/module_hdi_source.c | 32 ++++++++++++++- .../native/pulseaudio/modules/hdi/userdata.h | 1 + .../server/src/pa_adapter_manager.cpp | 6 +++ 8 files changed, 90 insertions(+), 44 deletions(-) diff --git a/frameworks/native/audioeffect/include/audio_enhance_chain_adapter.h b/frameworks/native/audioeffect/include/audio_enhance_chain_adapter.h index 9f9db4fc1e..783cc898d3 100644 --- a/frameworks/native/audioeffect/include/audio_enhance_chain_adapter.h +++ b/frameworks/native/audioeffect/include/audio_enhance_chain_adapter.h @@ -29,7 +29,7 @@ int32_t EnhanceChainManagerCreateCb(const char *sceneType, const char *enhanceMo const char *downDevice); int32_t EnhanceChainManagerReleaseCb(const char *sceneType, const char *upDevice, const char *downDevice); bool EnhanceChainManagerExist(const char *sceneKey); -pa_sample_spec EnhanceChainManagerGetAlgoConfig(const char *sceneType, const char *upDevice, const char *downDevice); +int32_t EnhanceChainManagerGetAlgoConfig(const char *sceneKey, pa_sample_spec *spec); bool EnhanceChainManagerIsEmptyEnhanceChain(); int32_t EnhanceChainManagerInitEnhanceBuffer(); int32_t CopyToEnhanceBufferAdapter(void *data, uint32_t length); diff --git a/frameworks/native/audioeffect/include/audio_enhance_chain_manager.h b/frameworks/native/audioeffect/include/audio_enhance_chain_manager.h index f8c16b6200..7ba2b52a5b 100644 --- a/frameworks/native/audioeffect/include/audio_enhance_chain_manager.h +++ b/frameworks/native/audioeffect/include/audio_enhance_chain_manager.h @@ -42,8 +42,7 @@ public: int32_t ReleaseAudioEnhanceChainDynamic(const std::string &sceneType, const std::string &upDevice, const std::string &downDevice); bool ExistAudioEnhanceChain(const std::string &sceneKey); - AudioBufferConfig AudioEnhanceChainGetAlgoConfig(const std::string &sceneType, const std::string &upDevice, - const std::string &downDevice); + int32_t AudioEnhanceChainGetAlgoConfig(const std::string &sceneKey, AudioBufferConfig &config); bool IsEmptyEnhanceChain(); int32_t InitEnhanceBuffer(); int32_t CopyToEnhanceBuffer(void *data, uint32_t length); diff --git a/frameworks/native/audioeffect/src/audio_enhance_chain_adapter.cpp b/frameworks/native/audioeffect/src/audio_enhance_chain_adapter.cpp index 3f0791f7db..03e8763d78 100644 --- a/frameworks/native/audioeffect/src/audio_enhance_chain_adapter.cpp +++ b/frameworks/native/audioeffect/src/audio_enhance_chain_adapter.cpp @@ -105,41 +105,31 @@ bool EnhanceChainManagerExist(const char *sceneKey) return audioEnhanceChainMananger->ExistAudioEnhanceChain(sceneKeyString); } -pa_sample_spec EnhanceChainManagerGetAlgoConfig(const char *sceneType, const char *upDevice, const char *downDevice) +int32_t EnhanceChainManagerGetAlgoConfig(const char *sceneKey, pa_sample_spec *spec) { - pa_sample_spec spec; - pa_sample_spec_init(&spec); AudioEnhanceChainManager *audioEnhanceChainMananger = AudioEnhanceChainManager::GetInstance(); CHECK_AND_RETURN_RET_LOG(audioEnhanceChainMananger != nullptr, - spec, "null audioEnhanceChainManager"); - std::string sceneTypeString = ""; - std::string upDeviceString = ""; - std::string downDeviceString = ""; - if (sceneType) { - sceneTypeString = sceneType; - } - if (upDevice) { - upDeviceString = upDevice; - } - if (downDevice) { - downDeviceString = downDevice; + ERROR, "null audioEnhanceChainManager"); + std::string sceneKeyString = ""; + if (sceneKey) { + sceneKeyString = sceneKey; } - AudioBufferConfig config = audioEnhanceChainMananger->AudioEnhanceChainGetAlgoConfig(sceneTypeString, - upDeviceString, downDeviceString); - if (config.samplingRate == 0) { - return spec; + AudioBufferConfig config = {}; + uint32_t ret = audioEnhanceChainMananger->AudioEnhanceChainGetAlgoConfig(sceneKeyString, config); + if (ret != 0 || config.samplingRate == 0) { + return ERROR; } - pa_sample_spec sampleSpec; - sampleSpec.rate = config.samplingRate; - sampleSpec.channels = static_cast(config.channels); + spec->rate = config.samplingRate; + spec->channels = static_cast(config.channels); auto item = FORMAT_CONVERT_MAP.find(config.format); if (item != FORMAT_CONVERT_MAP.end()) { - sampleSpec.format = item->second; + spec->format = item->second; } else { - sampleSpec.format = PA_SAMPLE_INVALID; + spec->format = PA_SAMPLE_INVALID; + return ERROR; } - return sampleSpec; + return SUCCESS; } bool EnhanceChainManagerIsEmptyEnhanceChain() diff --git a/frameworks/native/audioeffect/src/audio_enhance_chain_manager.cpp b/frameworks/native/audioeffect/src/audio_enhance_chain_manager.cpp index fc14b98171..2f89f6d6f0 100644 --- a/frameworks/native/audioeffect/src/audio_enhance_chain_manager.cpp +++ b/frameworks/native/audioeffect/src/audio_enhance_chain_manager.cpp @@ -312,22 +312,19 @@ bool AudioEnhanceChainManager::ExistAudioEnhanceChain(const std::string &sceneKe return !audioEnhanceChain->IsEmptyEnhanceHandles(); } -AudioBufferConfig AudioEnhanceChainManager::AudioEnhanceChainGetAlgoConfig(const std::string &sceneType, - const std::string &upDevice, const std::string &downDevice) +int32_t AudioEnhanceChainManager::AudioEnhanceChainGetAlgoConfig(const std::string &sceneKey, AudioBufferConfig &config) { std::lock_guard lock(chainManagerMutex_); - AudioBufferConfig config = {}; - CHECK_AND_RETURN_RET_LOG(isInitialized_, config, "has not been initialized"); - std::string sceneTypeAndDeviceKey = sceneType + "_&_" + upDevice + "_&_" + downDevice; - if (!sceneTypeToEnhanceChainMap_.count(sceneTypeAndDeviceKey)) { - AUDIO_ERR_LOG("sceneTypeToEnhanceChainMap_ have not %{public}s", sceneTypeAndDeviceKey.c_str()); - return config; + CHECK_AND_RETURN_RET_LOG(isInitialized_, ERROR, "has not been initialized"); + if (!sceneTypeToEnhanceChainMap_.count(sceneKey)) { + AUDIO_ERR_LOG("sceneTypeToEnhanceChainMap_ have not %{public}s", sceneKey.c_str()); + return ERROR; } - auto audioEnhanceChain = sceneTypeToEnhanceChainMap_[sceneTypeAndDeviceKey]; - CHECK_AND_RETURN_RET_LOG(audioEnhanceChain != nullptr, config, "[%{public}s] get config faild", - sceneTypeAndDeviceKey.c_str()); + auto audioEnhanceChain = sceneTypeToEnhanceChainMap_[sceneKey]; + CHECK_AND_RETURN_RET_LOG(audioEnhanceChain != nullptr, ERROR, "[%{public}s] get config faild", + sceneKey.c_str()); audioEnhanceChain->GetAlgoConfig(config); - return config; + return SUCCESS; } bool AudioEnhanceChainManager::IsEmptyEnhanceChain() diff --git a/frameworks/native/pulseaudio/modules/hdi/hdi_source.c b/frameworks/native/pulseaudio/modules/hdi/hdi_source.c index f3ec205acb..d6538cefa2 100644 --- a/frameworks/native/pulseaudio/modules/hdi/hdi_source.c +++ b/frameworks/native/pulseaudio/modules/hdi/hdi_source.c @@ -121,6 +121,9 @@ static void UserdataFree(struct Userdata *u) if (u->sceneToCountMap) { pa_hashmap_free(u->sceneToCountMap); } + if (u->sceneToResamplerMap) { + pa_hashmap_free(u->sceneToResamplerMap); + } pa_xfree(u); } @@ -330,6 +333,21 @@ static int GetCapturerFrameFromHdi(pa_memchunk *chunk, const struct Userdata *u) return 0; } +static void sampleAlignment(const char *sceneKey, pa_memchunk *enhanceChunk, pa_memchunk *rChunk, struct Userdata *u) +{ + pa_assert(sceneKey); + pa_assert(enhanceChunk); + pa_assert(u); + + pa_resampler *resampler = (pa_resampler *)pa_hashmap_get(u->sceneToResamplerMap, sceneKey); + if (resampler != NULL) { + pa_resampler_run(resampler, enhanceChunk, rChunk); + } else { + *rChunk = *enhanceChunk; + pa_memblock_ref(rChunk->memblock); + } +} + static int32_t GetCapturerFrameFromHdiAndProcess(pa_memchunk *chunk, struct Userdata *u) { if (GetCapturerFrameFromHdi(chunk, u) != 0) { @@ -353,12 +371,16 @@ static int32_t GetCapturerFrameFromHdiAndProcess(pa_memchunk *chunk, struct User char *sceneKey = (char *)scene; AUDIO_DEBUG_LOG("Now sceneKey is : %{public}s", sceneKey); - pa_memchunk enhanceChunk; + pa_memchunk enhanceChunk, rChunk; enhanceChunk.length = chunk->length; enhanceChunk.memblock = pa_memblock_new(u->core->mempool, enhanceChunk.length); pa_memchunk_memcpy(&enhanceChunk, chunk); - EnhanceProcessAndPost(u->source, sceneKey, &enhanceChunk); + sampleAlignment(sceneKey, &enhanceChunk, &rChunk, u); + EnhanceProcessAndPost(u->source, sceneKey, &rChunk); pa_memblock_unref(enhanceChunk.memblock); + if (rChunk.memblock) { + pa_memblock_unref(rChunk.memblock); + } } pa_memblock_unref(chunk->memblock); @@ -629,6 +651,9 @@ static void InitUserdataAttrs(pa_modargs *ma, struct Userdata *u, const pa_sampl u->sceneToCountMap = pa_hashmap_new_full(pa_idxset_string_hash_func, pa_idxset_string_compare_func, pa_xfree, pa_xfree); + + u->sceneToResamplerMap = pa_hashmap_new_full(pa_idxset_string_hash_func, pa_idxset_string_compare_func, + NULL, (pa_free_cb_t) pa_resampler_free); } pa_source *PaHdiSourceNew(pa_module *m, pa_modargs *ma, const char *driver) diff --git a/frameworks/native/pulseaudio/modules/hdi/module_hdi_source.c b/frameworks/native/pulseaudio/modules/hdi/module_hdi_source.c index e64021adba..ecc5394fa8 100644 --- a/frameworks/native/pulseaudio/modules/hdi/module_hdi_source.c +++ b/frameworks/native/pulseaudio/modules/hdi/module_hdi_source.c @@ -95,8 +95,8 @@ static bool DecreaseScenekeyCount(pa_hashmap *sceneMap, const char *key) (*num)--; if (*num == 0) { pa_hashmap_remove_and_free(sceneMap, key); + return true; } - return true; } return false; } @@ -113,8 +113,26 @@ static pa_hook_result_t SourceOutputProplistChangedCb(pa_core *c, pa_source_outp return PA_HOOK_OK; } +static void SetResampler(pa_source_output *so, const pa_sample_spec *algoConfig, + const char *sceneKey, pa_hashmap *resamplerMap) +{ + AUDIO_INFO_LOG("SOURCE rate = %{public}d ALGO rate = %{public}d ", + so->source->sample_spec.rate, algoConfig->rate); + if (!pa_sample_spec_equal(&so->source->sample_spec, algoConfig)) { + pa_resampler *preResampler = pa_resampler_new(so->source->core->mempool, + &so->source->sample_spec, &so->source->channel_map, + algoConfig, &so->source->channel_map, + so->source->core->lfe_crossover_freq, + PA_RESAMPLER_AUTO, + PA_RESAMPLER_VARIABLE_RATE); + pa_hashmap_put(resamplerMap, pa_xstrdup(sceneKey), preResampler); + pa_resampler_set_input_rate(so->thread_info.resampler, algoConfig->rate); + } +} + static pa_hook_result_t SourceOutputPutCb(pa_core *c, pa_source_output *so) { + struct Userdata *u = (struct Userdata *)so->source->userdata; AUDIO_INFO_LOG("Trigger SourceOutputPutCb"); pa_assert(c); const char *sceneType = pa_proplist_gets(so->proplist, "scene.type"); @@ -128,7 +146,6 @@ static pa_hook_result_t SourceOutputPutCb(pa_core *c, pa_source_output *so) return PA_HOOK_OK; } EnhanceChainManagerInitEnhanceBuffer(); - struct Userdata *u = (struct Userdata *)so->source->userdata; char sceneKey[MAX_SCENE_NAME_LEN]; ret = ConcatStr(sceneType, upDevice, downDevice, sceneKey, MAX_SCENE_NAME_LEN); if (ret != 0) { @@ -136,6 +153,14 @@ static pa_hook_result_t SourceOutputPutCb(pa_core *c, pa_source_output *so) return PA_HOOK_OK; } IncreaseScenekeyCount(u->sceneToCountMap, sceneKey); + pa_sample_spec algoConfig; + pa_sample_spec_init(&algoConfig); + ret = EnhanceChainManagerGetAlgoConfig(sceneKey, &algoConfig); + if (ret != 0) { + AUDIO_ERR_LOG("Get algo config failed"); + return PA_HOOK_OK; + } + SetResampler(so, &algoConfig, sceneKey, u->sceneToResamplerMap); return PA_HOOK_OK; } @@ -155,6 +180,9 @@ static pa_hook_result_t SourceOutputUnlinkCb(pa_core *c, pa_source_output *so) return PA_HOOK_OK; } DecreaseScenekeyCount(u->sceneToCountMap, sceneKey); + if (DecreaseScenekeyCount(u->sceneToCountMap, sceneKey)) { + pa_hashmap_remove_and_free(u->sceneToResamplerMap, sceneKey); + } return PA_HOOK_OK; } diff --git a/frameworks/native/pulseaudio/modules/hdi/userdata.h b/frameworks/native/pulseaudio/modules/hdi/userdata.h index f377329f39..1797736e24 100644 --- a/frameworks/native/pulseaudio/modules/hdi/userdata.h +++ b/frameworks/native/pulseaudio/modules/hdi/userdata.h @@ -44,6 +44,7 @@ struct Userdata { struct CapturerSourceAdapter *sourceAdapter; pa_usec_t delayTime; pa_hashmap *sceneToCountMap; + pa_hashmap *sceneToResamplerMap; }; #endif \ No newline at end of file diff --git a/services/audio_service/server/src/pa_adapter_manager.cpp b/services/audio_service/server/src/pa_adapter_manager.cpp index 2657800821..ceee91fddc 100644 --- a/services/audio_service/server/src/pa_adapter_manager.cpp +++ b/services/audio_service/server/src/pa_adapter_manager.cpp @@ -839,6 +839,12 @@ const std::string PaAdapterManager::GetEnhanceSceneName(SourceType sourceType) case SOURCE_TYPE_VOICE_COMMUNICATION: name = "SCENE_VOIP_UP"; break; + case SOURCE_TYPE_VOICE_TRANSCRIPTION: + name = "SCENE_PRE_ENHANCE"; + break; + case SOURCE_TYPE_VOICE_MESSAGE: + name = "SCENE_ASR"; + break; default: name = "SCENE_OTHERS"; } -- Gitee From dbc838b371bb62180602d8d2d59fad34f0a1c620 Mon Sep 17 00:00:00 2001 From: XuWentao Date: Thu, 18 Jul 2024 16:15:58 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BB=8E=E7=AE=97?= =?UTF-8?q?=E6=B3=95=E8=8E=B7=E5=8F=96=E9=87=87=E6=A0=B7=E7=8E=87=E9=80=BB?= =?UTF-8?q?=E8=BE=91=20Signed-off-by:=20XuWentao=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../native/audioeffect/src/audio_enhance_chain.cpp | 9 +++++++++ .../native/pulseaudio/modules/hdi/module_hdi_source.c | 1 - 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/frameworks/native/audioeffect/src/audio_enhance_chain.cpp b/frameworks/native/audioeffect/src/audio_enhance_chain.cpp index 5a90c1ebef..86b91259d3 100644 --- a/frameworks/native/audioeffect/src/audio_enhance_chain.cpp +++ b/frameworks/native/audioeffect/src/audio_enhance_chain.cpp @@ -116,6 +116,15 @@ void AudioEnhanceChain::AddEnhanceHandle(AudioEffectHandle handle, AudioEffectLi AudioEffectTransInfo cmdInfo = {}; AudioEffectTransInfo replyInfo = {}; + uint32_t maxSampleRate = DEFAULT_SAMPLE_RATE; + replyInfo.data = &maxSampleRate; + replyInfo.size = sizeof(maxSampleRate); + ret = (*handle)->command(handle, EFFECT_CMD_GET_CONFIG, &cmdInfo, &replyInfo); + if (ret) { + AUDIO_ERR_LOG("get algo maxSampleRate failed!"); + } + algoSupportedConfig_.sampleRate = maxSampleRate; + cmdInfo.data = static_cast(&algoSupportedConfig_); cmdInfo.size = sizeof(algoSupportedConfig_); diff --git a/frameworks/native/pulseaudio/modules/hdi/module_hdi_source.c b/frameworks/native/pulseaudio/modules/hdi/module_hdi_source.c index 16609c9363..74d5f58751 100644 --- a/frameworks/native/pulseaudio/modules/hdi/module_hdi_source.c +++ b/frameworks/native/pulseaudio/modules/hdi/module_hdi_source.c @@ -202,7 +202,6 @@ static pa_hook_result_t SourceOutputUnlinkCb(pa_core *c, pa_source_output *so) AUDIO_ERR_LOG("Get sceneKey of sourceOutput to unlink failed"); return PA_HOOK_OK; } - DecreaseScenekeyCount(u->sceneToCountMap, sceneKey); if (DecreaseScenekeyCount(u->sceneToCountMap, sceneKey)) { pa_hashmap_remove_and_free(u->sceneToResamplerMap, sceneKey); } -- Gitee From 1630c3938e9d442ce4140994efc6548e39bdaa61 Mon Sep 17 00:00:00 2001 From: XuWentao Date: Thu, 18 Jul 2024 19:14:39 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E5=88=A0=E9=99=A4case=20SOURCE=5FTYPE=5FVO?= =?UTF-8?q?ICE=5FMESSAGE=E9=80=BB=E8=BE=91=20Signed-off-by:=20XuWentao=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- services/audio_service/server/src/pa_adapter_manager.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/services/audio_service/server/src/pa_adapter_manager.cpp b/services/audio_service/server/src/pa_adapter_manager.cpp index ceee91fddc..243f960abd 100644 --- a/services/audio_service/server/src/pa_adapter_manager.cpp +++ b/services/audio_service/server/src/pa_adapter_manager.cpp @@ -842,9 +842,6 @@ const std::string PaAdapterManager::GetEnhanceSceneName(SourceType sourceType) case SOURCE_TYPE_VOICE_TRANSCRIPTION: name = "SCENE_PRE_ENHANCE"; break; - case SOURCE_TYPE_VOICE_MESSAGE: - name = "SCENE_ASR"; - break; default: name = "SCENE_OTHERS"; } -- Gitee From c0c47bff1f097fc2830fdc01c14ac51736ffff2f Mon Sep 17 00:00:00 2001 From: XuWentao Date: Thu, 18 Jul 2024 19:56:42 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E5=88=A0=E9=99=A4case=20SOURCE=5FTYPE=5FVO?= =?UTF-8?q?ICE=5FTRANSCRIPTION?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: XuWentao --- .../inner_api/native/audiocommon/include/audio_source_type.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/interfaces/inner_api/native/audiocommon/include/audio_source_type.h b/interfaces/inner_api/native/audiocommon/include/audio_source_type.h index ba56934348..7db3b6020d 100644 --- a/interfaces/inner_api/native/audiocommon/include/audio_source_type.h +++ b/interfaces/inner_api/native/audiocommon/include/audio_source_type.h @@ -35,7 +35,8 @@ enum SourceType { SOURCE_TYPE_VIRTUAL_CAPTURE = 9, // only for voice call SOURCE_TYPE_VOICE_MESSAGE = 10, SOURCE_TYPE_REMOTE_CAST = 11, - SOURCE_TYPE_MAX = SOURCE_TYPE_REMOTE_CAST + SOURCE_TYPE_VOICE_TRANSCRIPTION = 12, + SOURCE_TYPE_MAX = SOURCE_TYPE_VOICE_TRANSCRIPTION }; typedef enum { -- Gitee From 23d85a87ae93030483e25da37e4a5c9631890cd9 Mon Sep 17 00:00:00 2001 From: XuWentao Date: Fri, 19 Jul 2024 15:21:06 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E6=A3=80=E8=A7=86=E6=84=8F=E8=A7=81?= =?UTF-8?q?=E4=BF=AE=E6=94=B9-=E5=88=A4=E7=A9=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: XuWentao --- frameworks/native/pulseaudio/modules/hdi/hdi_source.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/frameworks/native/pulseaudio/modules/hdi/hdi_source.c b/frameworks/native/pulseaudio/modules/hdi/hdi_source.c index fff9bfc71f..8a0cac75a6 100644 --- a/frameworks/native/pulseaudio/modules/hdi/hdi_source.c +++ b/frameworks/native/pulseaudio/modules/hdi/hdi_source.c @@ -66,6 +66,8 @@ #define MAX_SCENE_NUM 5 const char *DEVICE_CLASS_REMOTE = "remote"; +const int32_t SUCCESS = 0; +const int32_t ERROR = -1; static int PaHdiCapturerInit(struct Userdata *u); static void PaHdiCapturerExit(struct Userdata *u); @@ -333,11 +335,11 @@ static int GetCapturerFrameFromHdi(pa_memchunk *chunk, const struct Userdata *u) return 0; } -static void sampleAlignment(const char *sceneKey, pa_memchunk *enhanceChunk, pa_memchunk *rChunk, struct Userdata *u) +static int32_t SampleAlignment(const char *sceneKey, pa_memchunk *enhanceChunk, pa_memchunk *rChunk, struct Userdata *u) { - pa_assert(sceneKey); - pa_assert(enhanceChunk); - pa_assert(u); + CHECK_AND_RETURN_RET_LOG(sceneKey != NULL, ERROR, "sceneKey is null"); + CHECK_AND_RETURN_RET_LOG(enhanceChunk != NULL, ERROR, "enhanceChunk is null"); + CHECK_AND_RETURN_RET_LOG(u != NULL, ERROR, "Userdata is null"); pa_resampler *resampler = (pa_resampler *)pa_hashmap_get(u->sceneToResamplerMap, sceneKey); if (resampler != NULL) { @@ -346,6 +348,7 @@ static void sampleAlignment(const char *sceneKey, pa_memchunk *enhanceChunk, pa_ *rChunk = *enhanceChunk; pa_memblock_ref(rChunk->memblock); } + return SUCCESS; } static int32_t GetCapturerFrameFromHdiAndProcess(pa_memchunk *chunk, struct Userdata *u) -- Gitee From 2a139cf9b745aef9f23b154c8140b13197e2155c Mon Sep 17 00:00:00 2001 From: XuWentao Date: Fri, 19 Jul 2024 15:54:37 +0800 Subject: [PATCH 6/6] =?UTF-8?q?SampleAlignment=E8=B0=83=E7=94=A8=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: XuWentao --- frameworks/native/pulseaudio/modules/hdi/hdi_source.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frameworks/native/pulseaudio/modules/hdi/hdi_source.c b/frameworks/native/pulseaudio/modules/hdi/hdi_source.c index 8a0cac75a6..eb36e98412 100644 --- a/frameworks/native/pulseaudio/modules/hdi/hdi_source.c +++ b/frameworks/native/pulseaudio/modules/hdi/hdi_source.c @@ -378,7 +378,7 @@ static int32_t GetCapturerFrameFromHdiAndProcess(pa_memchunk *chunk, struct User enhanceChunk.length = chunk->length; enhanceChunk.memblock = pa_memblock_new(u->core->mempool, enhanceChunk.length); pa_memchunk_memcpy(&enhanceChunk, chunk); - sampleAlignment(sceneKey, &enhanceChunk, &rChunk, u); + SampleAlignment(sceneKey, &enhanceChunk, &rChunk, u); EnhanceProcessAndPost(u->source, sceneKey, &rChunk); pa_memblock_unref(enhanceChunk.memblock); if (rChunk.memblock) { -- Gitee