From 322720de00bcf70a8489c6de7169fcf52c4b8567 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BD=AD=E4=BE=9D=E5=96=A7?= Date: Tue, 2 Sep 2025 10:49:31 +0800 Subject: [PATCH 1/3] hearingAidReload MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 彭依喧 --- .../pipe/src/audio_capturer_session.cpp | 44 ++++--------------- 1 file changed, 9 insertions(+), 35 deletions(-) diff --git a/services/audio_policy/server/domain/pipe/src/audio_capturer_session.cpp b/services/audio_policy/server/domain/pipe/src/audio_capturer_session.cpp index eb0b9e0ba1..bf3ecc542f 100644 --- a/services/audio_policy/server/domain/pipe/src/audio_capturer_session.cpp +++ b/services/audio_policy/server/domain/pipe/src/audio_capturer_session.cpp @@ -317,41 +317,15 @@ int32_t AudioCapturerSession::ReloadCaptureSessionSoftLink() { std::lock_guard lock(onCapturerSessionChangedMutex_); hearingAidReloadFlag_ = false; - bool hasSession = false; - auto pipes = AudioPipeManager::GetPipeManager()->GetPipeList(); - if (pipes.empty()) { - AUDIO_ERR_LOG("pipes invalid"); - return ERR_INVALID_OPERATION; - } + + const std::vector> pipes = AudioPipeManager::GetPipeManager()->GetPipeLIst(); + CHECK_AND_RETURN_RET_LOG(!pipes.empty(), ERR_INVALID_OPERATION, "pipes invalid"); + AudioStreamDescriptor targetStream; - for (auto pipe : pipes) { - if (pipe == nullptr || pipe->streamDescriptors_.empty()) { - AUDIO_WARNING_LOG("pipe invalid"); - continue; - } - if (pipe->pipeRole_ == AudioPipeRole::PIPE_ROLE_OUTPUT || (pipe->routeFlag_ & AUDIO_INPUT_FLAG_FAST) != 0) { - AUDIO_INFO_LOG("ignore pipe for pipeRole_: %{public}d, routeFlag_: %{public}d", - pipe->pipeRole_, pipe->routeFlag_); - continue; - } - for (auto streamDescriptor : pipe->streamDescriptors_) { - if (streamDescriptor == nullptr || - sessionWithNormalSourceType_.find(streamDescriptor->sessionId_) == - sessionWithNormalSourceType_.end()) { - AUDIO_WARNING_LOG("streamDescriptor invalid"); - continue; - } - SourceType higherSourceType = sessionWithNormalSourceType_[streamDescriptor->sessionId_].sourceType; - if (streamDescriptor->streamStatus_ != AudioStreamStatus::STREAM_STATUS_STARTED || - specialSourceTypeSet_.count(higherSourceType) != 0) { - continue; - } - if (IsHigherPrioritySourceType(higherSourceType, targetStream.capturerInfo_.sourceType)) { - hasSession = true; - streamDescriptor->CopyToStruct(targetStream); - } - } - } + + const int32_t softLinkSessionId = 0; + bool hasSession = false; + hasSession = HandleNormalInputPipes(pipes, softLinkSessionId, targetStream, hasSession); CHECK_AND_RETURN_RET_LOG(hasSession, SUCCESS, "no need to reload session"); AUDIO_INFO_LOG("start reload session: %{public}u", targetStream.sessionId_); @@ -365,7 +339,7 @@ int32_t AudioCapturerSession::ReloadCaptureSession(uint32_t sessionId, SessionOp { AUDIO_INFO_LOG("prepare reload session: %{public}u with operation: %{public}d", sessionId, operation); std::lock_guard lock(onCapturerSessionChangedMutex_); - CHECK_AND_RETURN_RET_LOG(!hearingAidReloadFlag_, SUCCESS, "no need to reload session"); + CHECK_AND_RETURN_RET_LOG(!hearingAidReloadFlag_, SUCCESS, "no need to reload session for hearingAid"); uint32_t targetSessionId = sessionId; AudioStreamDescriptor runningSessionInfo = {}; bool needReload = false; -- Gitee From d1d0960c35167163e4529f56e63ab8414c635e9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BD=AD=E4=BE=9D=E5=96=A7?= Date: Tue, 2 Sep 2025 11:04:40 +0800 Subject: [PATCH 2/3] hearingAidReload MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 彭依喧 --- .../server/domain/pipe/src/audio_capturer_session.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/audio_policy/server/domain/pipe/src/audio_capturer_session.cpp b/services/audio_policy/server/domain/pipe/src/audio_capturer_session.cpp index bf3ecc542f..4cad56863c 100644 --- a/services/audio_policy/server/domain/pipe/src/audio_capturer_session.cpp +++ b/services/audio_policy/server/domain/pipe/src/audio_capturer_session.cpp @@ -233,7 +233,7 @@ bool AudioCapturerSession::HandleIndependentInputpipe(const std::vector> &pipeList, uint32_t sessionId, AudioStreamDescriptor &runningSessionInfo, bool &hasSession) { -- Gitee From e4fe64f59c3999f85da0bb49f19c90995105a872 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BD=AD=E4=BE=9D=E5=96=A7?= Date: Tue, 2 Sep 2025 14:11:08 +0800 Subject: [PATCH 3/3] hearingAidReload MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 彭依喧 --- .../server/domain/pipe/src/audio_capturer_session.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/audio_policy/server/domain/pipe/src/audio_capturer_session.cpp b/services/audio_policy/server/domain/pipe/src/audio_capturer_session.cpp index 4cad56863c..08413337a5 100644 --- a/services/audio_policy/server/domain/pipe/src/audio_capturer_session.cpp +++ b/services/audio_policy/server/domain/pipe/src/audio_capturer_session.cpp @@ -318,7 +318,7 @@ int32_t AudioCapturerSession::ReloadCaptureSessionSoftLink() std::lock_guard lock(onCapturerSessionChangedMutex_); hearingAidReloadFlag_ = false; - const std::vector> pipes = AudioPipeManager::GetPipeManager()->GetPipeLIst(); + const std::vector> pipes = AudioPipeManager::GetPipeManager()->GetPipeList(); CHECK_AND_RETURN_RET_LOG(!pipes.empty(), ERR_INVALID_OPERATION, "pipes invalid"); AudioStreamDescriptor targetStream; -- Gitee