diff --git a/services/audio_policy/server/include/service/audio_policy_service.h b/services/audio_policy/server/include/service/audio_policy_service.h index 2e430ecabbee00beefb1cc23277b6094f6c78d01..6b72458b06e0967604d4605d0002de047429aaf6 100644 --- a/services/audio_policy/server/include/service/audio_policy_service.h +++ b/services/audio_policy/server/include/service/audio_policy_service.h @@ -952,7 +952,7 @@ private: std::string &networkId); int32_t GetPreferredInputStreamTypeInner(SourceType sourceType, DeviceType deviceType, int32_t flags, - std::string &networkId); + const std::string &networkId); bool NotifyRecreateRendererStream(std::unique_ptr &desc, const std::unique_ptr &rendererChangeInfo, 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 34f22f17d10b506561d5a3831189ac6c52a354ff..8b49ddf582b6cce71a3c56ab3a969ae1725d251a 100644 --- a/services/audio_policy/server/src/service/audio_policy_service.cpp +++ b/services/audio_policy/server/src/service/audio_policy_service.cpp @@ -3002,12 +3002,12 @@ bool AudioPolicyService::NotifyRecreateCapturerStream(bool isUpdateActiveDevice, "original flag is false"); // Switch between old and new stream as they have different hals std::string oldDevicePortName = GetSourcePortName(capturerChangeInfo->inputDeviceInfo.deviceType); - if ((strcmp(oldDevicePortName.c_str(), GetSourcePortName(currentActiveDevice_.deviceType_).c_str())) || + if ((strcmp(oldDevicePortName.c_str(), GetSourcePortName(GetCurrentInputDeviceType()).c_str())) || ((capturerChangeInfo->inputDeviceInfo.networkId == LOCAL_NETWORK_ID) ^ - (currentActiveDevice_.networkId_ == LOCAL_NETWORK_ID))) { + (GetCurrentInputDevice().networkId_ == LOCAL_NETWORK_ID))) { int32_t streamClass = GetPreferredInputStreamTypeInner(capturerChangeInfo->capturerInfo.sourceType, - currentActiveDevice_.deviceType_, capturerChangeInfo->capturerInfo.originalFlag, - currentActiveDevice_.networkId_); + GetCurrentInputDeviceType(), capturerChangeInfo->capturerInfo.originalFlag, + GetCurrentInputDevice().networkId_); TriggerRecreateCapturerStreamCallback(capturerChangeInfo->callerPid, capturerChangeInfo->sessionId, streamClass, reason); return true; @@ -6353,7 +6353,7 @@ int32_t AudioPolicyService::GetPreferredInputStreamType(AudioCapturerInfo &captu } int32_t AudioPolicyService::GetPreferredInputStreamTypeInner(SourceType sourceType, DeviceType deviceType, - int32_t flags, std::string &networkId) + int32_t flags, const std::string &networkId) { AUDIO_INFO_LOG("Device type: %{public}d, source type: %{public}d, flag: %{public}d", deviceType, sourceType, flags);