From e317737cee51017a333b3fe15676af5d3268f216 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9F=A6=E5=9B=BD=E5=BA=86?= Date: Fri, 24 May 2024 10:13:41 +0800 Subject: [PATCH] =?UTF-8?q?0524=E5=91=8A=E8=AD=A6=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 韦国庆 --- .../audiomanager/managersink/src/daudio_sink_manager.cpp | 2 ++ .../audiomanager/managersource/src/daudio_source_dev.cpp | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/services/audiomanager/managersink/src/daudio_sink_manager.cpp b/services/audiomanager/managersink/src/daudio_sink_manager.cpp index cafc375e..f2d0dc1f 100644 --- a/services/audiomanager/managersink/src/daudio_sink_manager.cpp +++ b/services/audiomanager/managersink/src/daudio_sink_manager.cpp @@ -202,6 +202,8 @@ int32_t DAudioSinkManager::CreateAudioDevice(const std::string &devId) std::string eventContent = std::string(jsonData); cJSON_free(jsonData); cJSON_Delete(jParam); + int32_t SLEEP_TIME = 300; + std::this_thread::sleep_for(std::chrono::milliseconds(SLEEP_TIME)); NotifyEvent(devId, CTRL_OPENED, eventContent); return DH_SUCCESS; } diff --git a/services/audiomanager/managersource/src/daudio_source_dev.cpp b/services/audiomanager/managersource/src/daudio_source_dev.cpp index 6847aae1..930a2adb 100644 --- a/services/audiomanager/managersource/src/daudio_source_dev.cpp +++ b/services/audiomanager/managersource/src/daudio_source_dev.cpp @@ -117,7 +117,11 @@ void DAudioSourceDev::SetRegDataType(const std::string &capability) return; } cJSON *dataType = cJSON_GetObjectItem(jParam, KEY_DATATYPE); - CHECK_NULL_AND_FREE_VOID(dataType, jParam); + if (dataType == nullptr || !cJSON_IsString(dataType)) { + DHLOGE("The key dataType is null."); + cJSON_Delete(jParam); + return; + } DHLOGI("RegData type is : %{public}s.", dataType->valuestring); std::string typeStr(dataType->valuestring); if (typeStr == KEY_TYPE_FULL) { -- Gitee