From 0a9ae0c5b35e35da4d61f9964fdcd96ffc460595 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E7=9D=BF?= Date: Wed, 10 Sep 2025 14:55:21 +0800 Subject: [PATCH 1/3] remote offload add mutex MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 李睿 --- .../hdiadapter_new/sink/remote_offload_audio_render_sink.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/frameworks/native/hdiadapter_new/sink/remote_offload_audio_render_sink.cpp b/frameworks/native/hdiadapter_new/sink/remote_offload_audio_render_sink.cpp index daf723be94..6f0c2a27d6 100644 --- a/frameworks/native/hdiadapter_new/sink/remote_offload_audio_render_sink.cpp +++ b/frameworks/native/hdiadapter_new/sink/remote_offload_audio_render_sink.cpp @@ -763,6 +763,7 @@ int32_t RemoteOffloadAudioRenderSink::UpdateAppsUid(const std::vector & int32_t RemoteOffloadAudioRenderSink::Drain(AudioDrainType type) { Trace trace("RemoteOffloadAudioRenderSink::Drain"); + std::lock_guard lock(sinkMutex_); CHECK_AND_RETURN_RET_LOG(audioRender_ != nullptr, ERR_INVALID_HANDLE, "render is nullptr"); auto drainType = static_cast(type); int32_t ret = audioRender_->DrainBuffer(drainType); @@ -788,6 +789,7 @@ void RemoteOffloadAudioRenderSink::RegistOffloadHdiCallback(std::function lock(sinkMutex_); CHECK_AND_RETURN_RET_LOG(audioRender_ != nullptr, ERR_INVALID_HANDLE, "render is nullptr"); CHECK_AND_RETURN_RET_LOG(!isFlushing_.load(), ERR_OPERATION_FAILED, "during flushing"); -- Gitee From 42ad071b8ef0bdff10c294fe03ddd91dff128eda Mon Sep 17 00:00:00 2001 From: audio_lr Date: Wed, 10 Sep 2025 12:44:48 +0000 Subject: [PATCH 2/3] update frameworks/native/hdiadapter_new/sink/remote_offload_audio_render_sink.cpp. Signed-off-by: audio_lr --- .../hdiadapter_new/sink/remote_offload_audio_render_sink.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/frameworks/native/hdiadapter_new/sink/remote_offload_audio_render_sink.cpp b/frameworks/native/hdiadapter_new/sink/remote_offload_audio_render_sink.cpp index 6f0c2a27d6..f2869788a4 100644 --- a/frameworks/native/hdiadapter_new/sink/remote_offload_audio_render_sink.cpp +++ b/frameworks/native/hdiadapter_new/sink/remote_offload_audio_render_sink.cpp @@ -326,6 +326,7 @@ std::string RemoteOffloadAudioRenderSink::GetAudioParameter(const AudioParamKey int32_t RemoteOffloadAudioRenderSink::SetVolume(float left, float right) { + std::lock_guard lock(sinkMutex_); std::lock_guard lock(switchDeviceMutex_); Trace trace("RemoteOffloadAudioRenderSink::SetVolume"); @@ -657,6 +658,7 @@ void RemoteOffloadAudioRenderSink::SetAudioBalanceValue(float audioBalance) int32_t RemoteOffloadAudioRenderSink::SetSinkMuteForSwitchDevice(bool mute) { + std::lock_guard lock(sinkMutex_); std::lock_guard lock(switchDeviceMutex_); AUDIO_INFO_LOG("set offload mute %{public}d", mute); @@ -780,6 +782,8 @@ void RemoteOffloadAudioRenderSink::RegistOffloadHdiCallback(std::function lock(sinkMutex_); + CHECK_AND_RETURN_RET_LOG(audioRender_ != nullptr, ERR_INVALID_HANDLE, "render is nullptr"); int32_t ret = audioRender_->RegCallback(hdiCallback_.callback_, (int8_t)0); if (ret != SUCCESS) { AUDIO_WARNING_LOG("fail, error code: %{public}d", ret); -- Gitee From b24871e1af302c36dcfb380f05c32644201f5434 Mon Sep 17 00:00:00 2001 From: audio_lr Date: Wed, 10 Sep 2025 13:35:10 +0000 Subject: [PATCH 3/3] update frameworks/native/hdiadapter_new/sink/remote_offload_audio_render_sink.cpp. Signed-off-by: audio_lr --- .../hdiadapter_new/sink/remote_offload_audio_render_sink.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frameworks/native/hdiadapter_new/sink/remote_offload_audio_render_sink.cpp b/frameworks/native/hdiadapter_new/sink/remote_offload_audio_render_sink.cpp index f2869788a4..8464ea6a6e 100644 --- a/frameworks/native/hdiadapter_new/sink/remote_offload_audio_render_sink.cpp +++ b/frameworks/native/hdiadapter_new/sink/remote_offload_audio_render_sink.cpp @@ -326,7 +326,7 @@ std::string RemoteOffloadAudioRenderSink::GetAudioParameter(const AudioParamKey int32_t RemoteOffloadAudioRenderSink::SetVolume(float left, float right) { - std::lock_guard lock(sinkMutex_); + std::lock_guard sinkLock(sinkMutex_); std::lock_guard lock(switchDeviceMutex_); Trace trace("RemoteOffloadAudioRenderSink::SetVolume"); @@ -658,7 +658,7 @@ void RemoteOffloadAudioRenderSink::SetAudioBalanceValue(float audioBalance) int32_t RemoteOffloadAudioRenderSink::SetSinkMuteForSwitchDevice(bool mute) { - std::lock_guard lock(sinkMutex_); + std::lock_guard sinkLock(sinkMutex_); std::lock_guard lock(switchDeviceMutex_); AUDIO_INFO_LOG("set offload mute %{public}d", mute); -- Gitee