From 60c8a270b77aae0aa9f7880e8909c5c45907621d Mon Sep 17 00:00:00 2001 From: s30056362 Date: Thu, 2 Jan 2025 14:37:28 +0800 Subject: [PATCH 1/4] fix cpp crash Signed-off-by: s30056362 --- frameworks/native/pulseaudio/modules/hdi/hdi_source.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/frameworks/native/pulseaudio/modules/hdi/hdi_source.c b/frameworks/native/pulseaudio/modules/hdi/hdi_source.c index 1afd27fdb8..fb7733b15d 100644 --- a/frameworks/native/pulseaudio/modules/hdi/hdi_source.c +++ b/frameworks/native/pulseaudio/modules/hdi/hdi_source.c @@ -1222,6 +1222,12 @@ int32_t CreateCaptureDataThread(pa_module *m, struct Userdata *u) pa_atomic_store(&u->captureFlag, 0); pa_atomic_store(&u->quitCaptureFlag, 0); + + if (!(u->CaptureMq = pa_asyncmsgq_new(0))) { + AUDIO_ERR_LOG("Failed to create u->CaptureMq"); + return -1; + } + u->eventFd = eventfd(0, EFD_NONBLOCK); u->rtpollItem = pa_rtpoll_item_new(u->rtpoll, PA_RTPOLL_NEVER, 1); struct pollfd *pollFd = pa_rtpoll_item_get_pollfd(u->rtpollItem, NULL); @@ -1239,10 +1245,6 @@ int32_t CreateCaptureDataThread(pa_module *m, struct Userdata *u) AUDIO_ERR_LOG("threadCapMq init failed."); return -1; } - if (!(u->CaptureMq = pa_asyncmsgq_new(0))) { - AUDIO_ERR_LOG("Failed to create u->CaptureMq"); - return -1; - } if (!(u->threadCap = pa_thread_new("OS_CaptureData", ThreadCaptureData, u))) { AUDIO_ERR_LOG("Failed to create capture-data thread!"); -- Gitee From e7ebf1a1415966d0d4a3ae357ffe2560a2932d2c Mon Sep 17 00:00:00 2001 From: s30056362 Date: Thu, 2 Jan 2025 15:39:17 +0800 Subject: [PATCH 2/4] fix cpp crash in FreeThread Signed-off-by: s30056362 --- .../pulseaudio/modules/hdi/hdi_source.c | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/frameworks/native/pulseaudio/modules/hdi/hdi_source.c b/frameworks/native/pulseaudio/modules/hdi/hdi_source.c index fb7733b15d..8fc0bf83c6 100644 --- a/frameworks/native/pulseaudio/modules/hdi/hdi_source.c +++ b/frameworks/native/pulseaudio/modules/hdi/hdi_source.c @@ -220,19 +220,18 @@ static void FreeThread(struct Userdata *u) pa_thread_free(u->thread); } - pa_memchunk chunk; - int32_t code = 0; - int32_t missedMsgqNum = 0; - while (pa_asyncmsgq_get(u->CaptureMq, NULL, &code, NULL, NULL, &chunk, 0) == 0) { - pa_memblock_unref(chunk.memblock); - pa_asyncmsgq_done(u->CaptureMq, 0); - missedMsgqNum++; - } - if (missedMsgqNum > 0) { - AUDIO_ERR_LOG("OS_ProcessCapData missed message num: %{public}u", missedMsgqNum); - } - if (u->CaptureMq) { + pa_memchunk chunk; + int32_t code = 0; + int32_t missedMsgqNum = 0; + while (pa_asyncmsgq_get(u->CaptureMq, NULL, &code, NULL, NULL, &chunk, 0) == 0) { + pa_memblock_unref(chunk.memblock); + pa_asyncmsgq_done(u->CaptureMq, 0); + missedMsgqNum++; + } + if (missedMsgqNum > 0) { + AUDIO_ERR_LOG("OS_ProcessCapData missed message num: %{public}u", missedMsgqNum); + } pa_asyncmsgq_unref(u->CaptureMq); } -- Gitee From 63d84a1e0b1b47228e9e60a9c795df5de9de18c1 Mon Sep 17 00:00:00 2001 From: Maninblack Date: Thu, 2 Jan 2025 12:49:54 +0000 Subject: [PATCH 3/4] add err log Signed-off-by: Maninblack --- frameworks/native/pulseaudio/modules/hdi/hdi_source.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/frameworks/native/pulseaudio/modules/hdi/hdi_source.c b/frameworks/native/pulseaudio/modules/hdi/hdi_source.c index 8fc0bf83c6..938fe7288e 100644 --- a/frameworks/native/pulseaudio/modules/hdi/hdi_source.c +++ b/frameworks/native/pulseaudio/modules/hdi/hdi_source.c @@ -233,6 +233,8 @@ static void FreeThread(struct Userdata *u) AUDIO_ERR_LOG("OS_ProcessCapData missed message num: %{public}u", missedMsgqNum); } pa_asyncmsgq_unref(u->CaptureMq); + } else { + AUDIO_ERR_LOG("CaptureMq is null"); } pa_thread_mq_done(&u->threadMq); -- Gitee From 8e3cb7d705502bc5517e0fd73060f1395d531fde Mon Sep 17 00:00:00 2001 From: Maninblack Date: Thu, 2 Jan 2025 13:03:11 +0000 Subject: [PATCH 4/4] add defines Signed-off-by: Maninblack --- services/audio_service/BUILD.gn | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/services/audio_service/BUILD.gn b/services/audio_service/BUILD.gn index 000ba4072a..b4594249e5 100644 --- a/services/audio_service/BUILD.gn +++ b/services/audio_service/BUILD.gn @@ -460,11 +460,6 @@ audio_ohos_library("audio_service") { "../../frameworks/native/playbackcapturer:playback_capturer", ] - if (audio_framework_feature_offline_effect) { - public_deps = - [ "../../frameworks/native/offlineaudioeffect:offline_audio_effect" ] - } - external_deps = [ "ability_base:want", "access_token:libaccesstoken_sdk", @@ -488,6 +483,13 @@ audio_ohos_library("audio_service") { public_external_deps = [ "libxml2:libxml2" ] defines = [] + + if (audio_framework_feature_offline_effect) { + public_deps = + [ "../../frameworks/native/offlineaudioeffect:offline_audio_effect" ] + defines += [ "FEATURE_OFFLINE_EFFECT" ] + } + if (audio_framework_config_policy_enable) { defines += [ "USE_CONFIG_POLICY" ] external_deps += [ "config_policy:configpolicy_util" ] -- Gitee