From 3889683660f4818978e3ea645ad73663b6299181 Mon Sep 17 00:00:00 2001 From: Tome Date: Fri, 18 Jul 2025 14:20:10 +0800 Subject: [PATCH] =?UTF-8?q?AI=20=E6=84=8F=E8=A7=81=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tome --- .../src/distributed_camera_sink_proxy.cpp | 137 ++++++++++++++---- .../base/dcamera_capture_info_cmd_test.cpp | 54 +++---- .../handler/src/dcamera_handler.cpp | 2 +- .../dcamera_sink_access_control.cpp | 2 +- .../dcamera_sink_data_process_test.cpp | 4 +- .../dcamera_source_dev.cpp | 4 + .../base/ifeeding_smoother.cpp | 9 +- .../dcamera_provider_callback_impl.cpp | 6 +- .../dcamera_provider_callback_impl_test.cpp | 10 +- .../dcamera_source_input_test.cpp | 11 +- .../dcamera_source_state_machine_test.cpp | 22 ++- .../src/pipeline/dcamera_pipeline_sink.cpp | 7 +- .../src/pipeline/dcamera_pipeline_source.cpp | 7 +- .../decoder/decode_data_process.cpp | 7 +- .../decoder/decode_data_process_common.cpp | 9 +- .../encoder/encode_data_process.cpp | 7 +- .../pipeline/dcamera_pipeline_sink_test.cpp | 40 ++--- .../decode_data_process_test.cpp | 4 +- .../encode_data_process_test.cpp | 54 +++---- 19 files changed, 258 insertions(+), 138 deletions(-) diff --git a/interfaces/inner_kits/native_cpp/camera_sink/src/distributed_camera_sink_proxy.cpp b/interfaces/inner_kits/native_cpp/camera_sink/src/distributed_camera_sink_proxy.cpp index cb2ea35a..5e1e8477 100644 --- a/interfaces/inner_kits/native_cpp/camera_sink/src/distributed_camera_sink_proxy.cpp +++ b/interfaces/inner_kits/native_cpp/camera_sink/src/distributed_camera_sink_proxy.cpp @@ -105,9 +105,20 @@ int32_t DistributedCameraSinkProxy::SubscribeLocalHardware(const std::string& dh DHLOGE("write params failed"); return DCAMERA_BAD_VALUE; } - remote->SendRequest(static_cast(IDCameraSinkInterfaceCode::SUBSCRIBE_LOCAL_HARDWARE), data, reply, - option); - int32_t result = reply.ReadInt32(); + int32_t ipcResult = remote->SendRequest(static_cast(IDCameraSinkInterfaceCode::SUBSCRIBE_LOCAL_HARDWARE), + data, reply, option); + if (ipcResult != DCAMERA_OK) { + DHLOGE("SendRequest for code failed"); + return DCAMERA_BAD_VALUE; + } + + int32_t result; + + if (!reply.ReadInt32(result)) { + DHLOGE("read reply failed"); + return DCAMERA_BAD_VALUE; + } + return result; } @@ -135,9 +146,17 @@ int32_t DistributedCameraSinkProxy::UnsubscribeLocalHardware(const std::string& DHLOGE("write params failed"); return DCAMERA_BAD_VALUE; } - remote->SendRequest(static_cast(IDCameraSinkInterfaceCode::UNSUBSCRIBE_LOCAL_HARDWARE), data, reply, - option); - int32_t result = reply.ReadInt32(); + int32_t ipcResult = remote->SendRequest( + static_cast(IDCameraSinkInterfaceCode::UNSUBSCRIBE_LOCAL_HARDWARE), data, reply, option); + if (ipcResult != DCAMERA_OK) { + DHLOGE("SendRequest for code failed"); + return DCAMERA_BAD_VALUE; + } + int32_t result; + if (!reply.ReadInt32(result)) { + DHLOGE("read reply failed"); + return DCAMERA_BAD_VALUE; + } return result; } @@ -165,10 +184,14 @@ int32_t DistributedCameraSinkProxy::StopCapture(const std::string& dhId) DHLOGE("write params failed"); return DCAMERA_BAD_VALUE; } - remote->SendRequest(static_cast(IDCameraSinkInterfaceCode::STOP_CAPTURE), data, reply, option); - int32_t result = reply.ReadInt32(); + int32_t ipcResult = remote->SendRequest( + static_cast(IDCameraSinkInterfaceCode::STOP_CAPTURE), data, reply, option); + if (ipcResult != DCAMERA_OK) { + DHLOGE("SendRequest for code failed"); + return DCAMERA_BAD_VALUE; + } DHLOGI("async dhId: %{public}s", GetAnonyString(dhId).c_str()); - return result; + return DCAMERA_OK; } int32_t DistributedCameraSinkProxy::ChannelNeg(const std::string& dhId, std::string& channelInfo) @@ -196,8 +219,17 @@ int32_t DistributedCameraSinkProxy::ChannelNeg(const std::string& dhId, std::str DHLOGE("write params failed"); return DCAMERA_BAD_VALUE; } - remote->SendRequest(static_cast(IDCameraSinkInterfaceCode::CHANNEL_NEG), data, reply, option); - int32_t result = reply.ReadInt32(); + int32_t ipcResult = remote->SendRequest( + static_cast(IDCameraSinkInterfaceCode::CHANNEL_NEG), data, reply, option); + if (ipcResult != DCAMERA_OK) { + DHLOGE("SendRequest for code failed"); + return DCAMERA_BAD_VALUE; + } + int32_t result; + if (!reply.ReadInt32(result)) { + DHLOGE("read reply failed"); + return DCAMERA_BAD_VALUE; + } return result; } @@ -205,7 +237,7 @@ int32_t DistributedCameraSinkProxy::GetCameraInfo(const std::string& dhId, std:: { DHLOGI("dhId: %{public}s", GetAnonyString(dhId).c_str()); if (dhId.empty() || dhId.size() > DID_MAX_SIZE) { - DHLOGE("parmas is invalid"); + DHLOGE("params is invalid"); return DCAMERA_BAD_VALUE; } sptr remote = Remote(); @@ -225,8 +257,17 @@ int32_t DistributedCameraSinkProxy::GetCameraInfo(const std::string& dhId, std:: DHLOGE("write params failed"); return DCAMERA_BAD_VALUE; } - remote->SendRequest(static_cast(IDCameraSinkInterfaceCode::GET_CAMERA_INFO), data, reply, option); - int32_t result = reply.ReadInt32(); + int32_t ipcResult = remote->SendRequest( + static_cast(IDCameraSinkInterfaceCode::GET_CAMERA_INFO), data, reply, option); + if (ipcResult != DCAMERA_OK) { + DHLOGE("SendRequest for code failed"); + return DCAMERA_BAD_VALUE; + } + int32_t result; + if (!reply.ReadInt32(result)) { + DHLOGE("read reply failed"); + return DCAMERA_BAD_VALUE; + } return result; } @@ -255,8 +296,17 @@ int32_t DistributedCameraSinkProxy::OpenChannel(const std::string& dhId, std::st DHLOGE("write params failed"); return DCAMERA_BAD_VALUE; } - remote->SendRequest(static_cast(IDCameraSinkInterfaceCode::OPEN_CHANNEL), data, reply, option); - int32_t result = reply.ReadInt32(); + int32_t ipcResult = remote->SendRequest( + static_cast(IDCameraSinkInterfaceCode::OPEN_CHANNEL), data, reply, option); + if (ipcResult != DCAMERA_OK) { + DHLOGE("SendRequest for code failed"); + return DCAMERA_BAD_VALUE; + } + int32_t result; + if (!reply.ReadInt32(result)) { + DHLOGE("read reply failed"); + return DCAMERA_BAD_VALUE; + } DHLOGI("DistributedCameraSinkProxy OpenChannel End,result: %{public}d", result); return result; } @@ -285,8 +335,17 @@ int32_t DistributedCameraSinkProxy::CloseChannel(const std::string& dhId) DHLOGE("write params failed"); return DCAMERA_BAD_VALUE; } - remote->SendRequest(static_cast(IDCameraSinkInterfaceCode::CLOSE_CHANNEL), data, reply, option); - int32_t result = reply.ReadInt32(); + int32_t ipcResult = remote->SendRequest( + static_cast(IDCameraSinkInterfaceCode::CLOSE_CHANNEL), data, reply, option); + if (ipcResult != DCAMERA_OK) { + DHLOGE("SendRequest for code failed"); + return DCAMERA_BAD_VALUE; + } + int32_t result; + if (!reply.ReadInt32(result)) { + DHLOGE("read reply failed"); + return DCAMERA_BAD_VALUE; + } return result; } @@ -310,9 +369,17 @@ int32_t DistributedCameraSinkProxy::PauseDistributedHardware(const std::string & DHLOGE("write params failed"); return DCAMERA_BAD_VALUE; } - remote->SendRequest(static_cast(IDCameraSinkInterfaceCode::PAUSE_DISTRIBUTED_HARDWARE), - data, reply, option); - int32_t result = reply.ReadInt32(); + int32_t ipcResult = remote->SendRequest( + static_cast(IDCameraSinkInterfaceCode::PAUSE_DISTRIBUTED_HARDWARE), data, reply, option); + if (ipcResult != DCAMERA_OK) { + DHLOGE("SendRequest for code failed"); + return DCAMERA_BAD_VALUE; + } + int32_t result; + if (!reply.ReadInt32(result)) { + DHLOGE("read reply failed"); + return DCAMERA_BAD_VALUE; + } return result; } @@ -336,9 +403,17 @@ int32_t DistributedCameraSinkProxy::ResumeDistributedHardware(const std::string DHLOGE("write params failed"); return DCAMERA_BAD_VALUE; } - remote->SendRequest(static_cast(IDCameraSinkInterfaceCode::RESUME_DISTRIBUTED_HARDWARE), - data, reply, option); - int32_t result = reply.ReadInt32(); + int32_t ipcResult = remote->SendRequest( + static_cast(IDCameraSinkInterfaceCode::RESUME_DISTRIBUTED_HARDWARE), data, reply, option); + if (ipcResult != DCAMERA_OK) { + DHLOGE("SendRequest for code failed"); + return DCAMERA_BAD_VALUE; + } + int32_t result; + if (!reply.ReadInt32(result)) { + DHLOGE("read reply failed"); + return DCAMERA_BAD_VALUE; + } return result; } @@ -362,9 +437,17 @@ int32_t DistributedCameraSinkProxy::StopDistributedHardware(const std::string &n DHLOGE("write params failed"); return DCAMERA_BAD_VALUE; } - remote->SendRequest(static_cast(IDCameraSinkInterfaceCode::STOP_DISTRIBUTED_HARDWARE), - data, reply, option); - int32_t result = reply.ReadInt32(); + int32_t ipcResult = remote->SendRequest( + static_cast(IDCameraSinkInterfaceCode::STOP_DISTRIBUTED_HARDWARE), data, reply, option); + if (ipcResult != DCAMERA_OK) { + DHLOGE("SendRequest for code failed"); + return DCAMERA_BAD_VALUE; + } + int32_t result; + if (!reply.ReadInt32(result)) { + DHLOGE("read reply failed"); + return DCAMERA_BAD_VALUE; + } return result; } } // namespace DistributedHardware diff --git a/services/cameraservice/base/test/unittest/common/base/dcamera_capture_info_cmd_test.cpp b/services/cameraservice/base/test/unittest/common/base/dcamera_capture_info_cmd_test.cpp index 19d58ec9..647a0c48 100755 --- a/services/cameraservice/base/test/unittest/common/base/dcamera_capture_info_cmd_test.cpp +++ b/services/cameraservice/base/test/unittest/common/base/dcamera_capture_info_cmd_test.cpp @@ -32,7 +32,7 @@ public: }; static const std::string TEST_CAPTURE_INFO_CMD_JSON_LACK_TYPE = R"({ - "dhId": "camrea_0", + "dhId": "camera_0", "Command": "CAPTURE", "Value": [ {"Width": 1920, "Height": 1080, "Format": 1, "DataSpace": 1, @@ -43,7 +43,7 @@ static const std::string TEST_CAPTURE_INFO_CMD_JSON_LACK_TYPE = R"({ static const std::string TEST_CAPTURE_INFO_CMD_JSON_TYPE_EXCEPTION = R"({ "Type": 0, - "dhId": "camrea_0", + "dhId": "camera_0", "Command": "CAPTURE", "Value": [ {"Width": 1920, "Height": 1080, "Format": 1, "DataSpace": 1, @@ -75,7 +75,7 @@ static const std::string TEST_CAPTURE_INFO_CMD_JSON_DHID_EXCEPTION = R"({ static const std::string TEST_CAPTURE_INFO_CMD_JSON_LACK_COMMAND = R"({ "Type": "OPERATION", - "dhId": "camrea_0", + "dhId": "camera_0", "Value": [ {"Width": 1920, "Height": 1080, "Format": 1, "DataSpace": 1, "IsCapture": true, "EncodeType": 1, "StreamType": 1, @@ -85,7 +85,7 @@ static const std::string TEST_CAPTURE_INFO_CMD_JSON_LACK_COMMAND = R"({ static const std::string TEST_CAPTURE_INFO_CMD_JSON_COMMAND_EXCEPTION = R"({ "Type": "OPERATION", - "dhId": "camrea_0", + "dhId": "camera_0", "Command": 0, "Value": [ {"Width": 1920, "Height": 1080, "Format": 1, "DataSpace": 1, @@ -96,13 +96,13 @@ static const std::string TEST_CAPTURE_INFO_CMD_JSON_COMMAND_EXCEPTION = R"({ static const std::string TEST_CAPTURE_INFO_CMD_JSON_LACK_VALUE = R"({ "Type": "OPERATION", - "dhId": "camrea_0", + "dhId": "camera_0", "Command": "CAPTURE", })"; static const std::string TEST_CAPTURE_INFO_CMD_JSON_VALUE_ARRAY = R"({ "Type": "OPERATION", - "dhId": "camrea_0", + "dhId": "camera_0", "Command": "CAPTURE", "Value":"[ {"Width": 1920, "Height": 1080, "Format": 1, "DataSpace": 1, @@ -113,7 +113,7 @@ static const std::string TEST_CAPTURE_INFO_CMD_JSON_VALUE_ARRAY = R"({ static const std::string TEST_CAPTURE_INFO_CMD_JSON_VALUE_EXCEPTION = R"({ "Type": "OPERATION", - "dhId": "camrea_0", + "dhId": "camera_0", "Command": "CAPTURE", "Value": "[ {"Width": 1920, "Height": 1080, "Format": 1, "DataSpace": 1, @@ -124,7 +124,7 @@ static const std::string TEST_CAPTURE_INFO_CMD_JSON_VALUE_EXCEPTION = R"({ static const std::string TEST_CAPTURE_INFO_CMD_JSON_LACK_VALUE_BODY_WIDTH = R"({ "Type": "OPERATION", - "dhId": "camrea_0", + "dhId": "camera_0", "Command": "CAPTURE", "Value": [ {"Height": 1080, "Format": 1, "DataSpace": 1, @@ -135,7 +135,7 @@ static const std::string TEST_CAPTURE_INFO_CMD_JSON_LACK_VALUE_BODY_WIDTH = R"({ static const std::string TEST_CAPTURE_INFO_CMD_JSON_VALUE_BODY_WIDTH_EXCEPTION = R"({ "Type": "OPERATION", - "dhId": "camrea_0", + "dhId": "camera_0", "Command": "CAPTURE", "Value": [ {"Width": "1920", "Height": 1080, "Format": 1, "DataSpace": 1, @@ -146,7 +146,7 @@ static const std::string TEST_CAPTURE_INFO_CMD_JSON_VALUE_BODY_WIDTH_EXCEPTION = static const std::string TEST_CAPTURE_INFO_CMD_JSON_LACK_VALUE_BODY_HEIGHT = R"({ "Type": "OPERATION", - "dhId": "camrea_0", + "dhId": "camera_0", "Command": "CAPTURE", "Value": [ {"Width": 1920, "Format": 1, "DataSpace": 1, @@ -157,7 +157,7 @@ static const std::string TEST_CAPTURE_INFO_CMD_JSON_LACK_VALUE_BODY_HEIGHT = R"( static const std::string TEST_CAPTURE_INFO_CMD_JSON_VALUE_BODY_HEIGHT_EXCEPTION = R"({ "Type": "OPERATION", - "dhId": "camrea_0", + "dhId": "camera_0", "Command": "CAPTURE", "Value": [ {"Width": 1920, "Height": "1080", "Format": 1, "DataSpace": 1, @@ -168,7 +168,7 @@ static const std::string TEST_CAPTURE_INFO_CMD_JSON_VALUE_BODY_HEIGHT_EXCEPTION static const std::string TEST_CAPTURE_INFO_CMD_JSON_LACK_VALUE_BODY_FORMAT = R"({ "Type": "OPERATION", - "dhId": "camrea_0", + "dhId": "camera_0", "Command": "CAPTURE", "Value": [ {"Width": 1920, "Height": 1080, "DataSpace": 1, @@ -179,7 +179,7 @@ static const std::string TEST_CAPTURE_INFO_CMD_JSON_LACK_VALUE_BODY_FORMAT = R"( static const std::string TEST_CAPTURE_INFO_CMD_JSON_VALUE_BODY_FORMAT_EXCEPTION = R"({ "Type": "OPERATION", - "dhId": "camrea_0", + "dhId": "camera_0", "Command": "CAPTURE", "Value": [ {"Width": 1920, "Height": 1080, "Format": "1", "DataSpace": 1, @@ -190,7 +190,7 @@ static const std::string TEST_CAPTURE_INFO_CMD_JSON_VALUE_BODY_FORMAT_EXCEPTION static const std::string TEST_CAPTURE_INFO_CMD_JSON_LACK_VALUE_BODY_DATASPACE = R"({ "Type": "OPERATION", - "dhId": "camrea_0", + "dhId": "camera_0", "Command": "CAPTURE", "Value": [ {"Width": 1920, "Height": 1080, "Format": 1, @@ -201,7 +201,7 @@ static const std::string TEST_CAPTURE_INFO_CMD_JSON_LACK_VALUE_BODY_DATASPACE = static const std::string TEST_CAPTURE_INFO_CMD_JSON_VALUE_BODY_DATASPACE_EXCEPTION = R"({ "Type": "OPERATION", - "dhId": "camrea_0", + "dhId": "camera_0", "Command": "CAPTURE", "Value": [ {"Width": 1920, "Height": 1080, "Format": 1, "DataSpace": "1", @@ -212,7 +212,7 @@ static const std::string TEST_CAPTURE_INFO_CMD_JSON_VALUE_BODY_DATASPACE_EXCEPTI static const std::string TEST_CAPTURE_INFO_CMD_JSON_LACK_VALUE_BODY_ISCAPTURE = R"({ "Type": "OPERATION", - "dhId": "camrea_0", + "dhId": "camera_0", "Command": "CAPTURE", "Value": [ {"Width": 1920, "Height": 1080, "Format": 1, "DataSpace": 1, @@ -223,7 +223,7 @@ static const std::string TEST_CAPTURE_INFO_CMD_JSON_LACK_VALUE_BODY_ISCAPTURE = static const std::string TEST_CAPTURE_INFO_CMD_JSON_VALUE_BODY_ISCAPTURE_EXCEPTION = R"({ "Type": "OPERATION", - "dhId": "camrea_0", + "dhId": "camera_0", "Command": "CAPTURE", "Value": [ {"Width": 1920, "Height": 1080, "Format": 1, "DataSpace": 1, @@ -234,7 +234,7 @@ static const std::string TEST_CAPTURE_INFO_CMD_JSON_VALUE_BODY_ISCAPTURE_EXCEPTI static const std::string TEST_CAPTURE_INFO_CMD_JSON_LACK_VALUE_BODY_ENCODETYPE = R"({ "Type": "OPERATION", - "dhId": "camrea_0", + "dhId": "camera_0", "Command": "CAPTURE", "Value": [ {"Width": 1920, "Height": 1080, "Format": 1, "DataSpace": 1, @@ -245,7 +245,7 @@ static const std::string TEST_CAPTURE_INFO_CMD_JSON_LACK_VALUE_BODY_ENCODETYPE = static const std::string TEST_CAPTURE_INFO_CMD_JSON_LACK_VALUE_BODY_STREAMTYPE = R"({ "Type": "OPERATION", - "dhId": "camrea_0", + "dhId": "camera_0", "Command": "CAPTURE", "Value": [ {"Width": 1920, "Height": 1080, "Format": 1, "DataSpace": 1, @@ -256,7 +256,7 @@ static const std::string TEST_CAPTURE_INFO_CMD_JSON_LACK_VALUE_BODY_STREAMTYPE = static const std::string TEST_CAPTURE_INFO_CMD_JSON_VALUE_BODY_ENCODETYPE_EXCEPTION = R"({ "Type": "OPERATION", - "dhId": "camrea_0", + "dhId": "camera_0", "Command": "CAPTURE", "Value": [ {"Width": 1920, "Height": 1080, "Format": 1, "DataSpace": 1, @@ -267,7 +267,7 @@ static const std::string TEST_CAPTURE_INFO_CMD_JSON_VALUE_BODY_ENCODETYPE_EXCEPT static const std::string TEST_CAPTURE_INFO_CMD_JSON_LACK_VALUE_BODY_CAPTURESETTINGS = R"({ "Type": "OPERATION", - "dhId": "camrea_0", + "dhId": "camera_0", "Command": "CAPTURE", "Value": [ {"Width": 1920, "Height": 1080, "Format": 1, "DataSpace": 1, @@ -277,7 +277,7 @@ static const std::string TEST_CAPTURE_INFO_CMD_JSON_LACK_VALUE_BODY_CAPTURESETTI static const std::string TEST_CAPTURE_INFO_CMD_JSON_VALUE_BODY_CAPTURESETTINGS_EXCEPTION = R"({ "Type": "OPERATION", - "dhId": "camrea_0", + "dhId": "camera_0", "Command": "CAPTURE", "Value": [ {"Width": 1920, "Height": 1080, "Format": 1, "DataSpace": 1, @@ -288,7 +288,7 @@ static const std::string TEST_CAPTURE_INFO_CMD_JSON_VALUE_BODY_CAPTURESETTINGS_E static const std::string TEST_CAPTURE_INFO_CMD_JSON_LACK_CAPTURESETTINGS_BODY_TYPE = R"({ "Type": "OPERATION", - "dhId": "camrea_0", + "dhId": "camera_0", "Command": "CAPTURE", "Value": [ {"Width": 1920, "Height": 1080, "Format": 1, "DataSpace": 1, @@ -299,7 +299,7 @@ static const std::string TEST_CAPTURE_INFO_CMD_JSON_LACK_CAPTURESETTINGS_BODY_TY static const std::string TEST_CAPTURE_INFO_CMD_JSON_CAPTURESETTINGS_BODY_TYPE_EXCEPTION = R"({ "Type": "OPERATION", - "dhId": "camrea_0", + "dhId": "camera_0", "Command": "CAPTURE", "Value": [ {"Width": 1920, "Height": 1080, "Format": 1, "DataSpace": 1, @@ -310,7 +310,7 @@ static const std::string TEST_CAPTURE_INFO_CMD_JSON_CAPTURESETTINGS_BODY_TYPE_EX static const std::string TEST_CAPTURE_INFO_CMD_JSON_LACK_CAPTURESETTINGS_BODY_VALUE = R"({ "Type": "OPERATION", - "dhId": "camrea_0", + "dhId": "camera_0", "Command": "CAPTURE", "Value": [ {"Width": 1920, "Height": 1080, "Format": 1, "DataSpace": 1, @@ -321,7 +321,7 @@ static const std::string TEST_CAPTURE_INFO_CMD_JSON_LACK_CAPTURESETTINGS_BODY_VA static const std::string TEST_CAPTURE_INFO_CMD_JSON_CAPTURESETTINGS_BODY_VALUE_EXCEPTION = R"({ "Type": "OPERATION", - "dhId": "camrea_0", + "dhId": "camera_0", "Command": "CAPTURE", "Value": [ {"Width": 1920, "Height": 1080, "Format": 1, "DataSpace": 1, @@ -332,7 +332,7 @@ static const std::string TEST_CAPTURE_INFO_CMD_JSON_CAPTURESETTINGS_BODY_VALUE_E static const std::string TEST_CAPTURE_INFO_CMD_JSON_CAPTURESETTINGS_CHECK = R"({ "Type": "OPERATION", - "dhId": "camrea_0", + "dhId": "camera_0", "Command": "CAPTURE", "Value": [ {"Width": 1920, "Height": 1080, "Format": 1, "DataSpace": 1, diff --git a/services/cameraservice/cameraoperator/handler/src/dcamera_handler.cpp b/services/cameraservice/cameraoperator/handler/src/dcamera_handler.cpp index b2d6b80f..f54f6e35 100644 --- a/services/cameraservice/cameraoperator/handler/src/dcamera_handler.cpp +++ b/services/cameraservice/cameraoperator/handler/src/dcamera_handler.cpp @@ -202,7 +202,7 @@ int32_t DCameraHandler::CreateAVCodecList(cJSON *root) MediaAVCodec::AVCodecCategory::AVCODEC_HARDWARE); if (capData == nullptr) { DHLOGI("capData is nullptr"); - return DCAMERA_BAD_VALUE; + continue; } std::string mimeType = capData->mimeType; cJSON_AddItemToArray(array, cJSON_CreateString(mimeType.c_str())); diff --git a/services/cameraservice/sinkservice/src/distributedcameramgr/dcamera_sink_access_control.cpp b/services/cameraservice/sinkservice/src/distributedcameramgr/dcamera_sink_access_control.cpp index e0dc8b5b..69aea71d 100644 --- a/services/cameraservice/sinkservice/src/distributedcameramgr/dcamera_sink_access_control.cpp +++ b/services/cameraservice/sinkservice/src/distributedcameramgr/dcamera_sink_access_control.cpp @@ -35,7 +35,7 @@ bool DCameraSinkAccessControl::NotifySensitiveSrc(const std::string& srcType) int32_t DCameraSinkAccessControl::TriggerFrame(const std::string& deviceName) { - DHLOGI("DCameraSinkAccessControl::TriggerFrame deviceName: %{public}s", deviceName.c_str()); + DHLOGI("DCameraSinkAccessControl::TriggerFrame start"); return DCAMERA_OK; } diff --git a/services/cameraservice/sinkservice/test/unittest/common/distributedcameramgr/dcamera_sink_data_process_test.cpp b/services/cameraservice/sinkservice/test/unittest/common/distributedcameramgr/dcamera_sink_data_process_test.cpp index 56a538b3..37ff4149 100644 --- a/services/cameraservice/sinkservice/test/unittest/common/distributedcameramgr/dcamera_sink_data_process_test.cpp +++ b/services/cameraservice/sinkservice/test/unittest/common/distributedcameramgr/dcamera_sink_data_process_test.cpp @@ -46,8 +46,8 @@ public: }; const int32_t SLEEP_TIME_MS = 500; -const int32_t TEST_WIDTH = 1080; -const int32_t TEST_HEIGHT = 1920; +const int32_t TEST_WIDTH = 1920; +const int32_t TEST_HEIGHT = 1080; const std::string TEST_STRING = "test_string"; const int32_t TEST_TWENTY_MS = 20000; diff --git a/services/cameraservice/sourceservice/src/distributedcameramgr/dcamera_source_dev.cpp b/services/cameraservice/sourceservice/src/distributedcameramgr/dcamera_source_dev.cpp index 0fef4a9e..fe2dd9ef 100644 --- a/services/cameraservice/sourceservice/src/distributedcameramgr/dcamera_source_dev.cpp +++ b/services/cameraservice/sourceservice/src/distributedcameramgr/dcamera_source_dev.cpp @@ -625,6 +625,10 @@ int32_t DCameraSourceDev::StartCapture(std::vector> captures; for (auto iter = captureInfos.begin(); iter != captureInfos.end(); iter++) { + if ((*iter) == nullptr) { + DHLOGE("DCameraSourceDev StartCapture captureInfos iter is nullptr"); + continue; + } std::shared_ptr capture = std::make_shared(); capture->width_ = (*iter)->width_; capture->height_ = (*iter)->height_; diff --git a/services/cameraservice/sourceservice/src/distributedcameramgr/dcameradata/feedingsmoother/base/ifeeding_smoother.cpp b/services/cameraservice/sourceservice/src/distributedcameramgr/dcameradata/feedingsmoother/base/ifeeding_smoother.cpp index 34ba50de..d548791f 100644 --- a/services/cameraservice/sourceservice/src/distributedcameramgr/dcameradata/feedingsmoother/base/ifeeding_smoother.cpp +++ b/services/cameraservice/sourceservice/src/distributedcameramgr/dcameradata/feedingsmoother/base/ifeeding_smoother.cpp @@ -238,11 +238,14 @@ int32_t IFeedingSmoother::StopSmooth() } state_ = SMOOTH_STOP; } - statistician_ = nullptr; - UnregisterListener(); smoothCon_.notify_one(); sleepCon_.notify_one(); - smoothThread_.join(); + if (smoothThread_.joinable()) { + smoothThread_.join(); + } + statistician_ = nullptr; + UnregisterListener(); + std::queue>().swap(dataQueue_); DHLOGD("Stop smooth success."); return SMOOTH_SUCCESS; diff --git a/services/cameraservice/sourceservice/src/distributedcameramgr/dcamerahdf/dcamera_provider_callback_impl.cpp b/services/cameraservice/sourceservice/src/distributedcameramgr/dcamerahdf/dcamera_provider_callback_impl.cpp index 10ce2967..4162fad7 100644 --- a/services/cameraservice/sourceservice/src/distributedcameramgr/dcamerahdf/dcamera_provider_callback_impl.cpp +++ b/services/cameraservice/sourceservice/src/distributedcameramgr/dcamerahdf/dcamera_provider_callback_impl.cpp @@ -132,7 +132,7 @@ int32_t DCameraProviderCallbackImpl::ConfigureStreams(const DHBase& dhBase, } int32_t ret = sourceDev->ConfigCameraStreams(streams); if (ret != DCAMERA_OK) { - DHLOGE("CloseSession failed, ret: %{public}d, devId: %{public}s, dhId: %{public}s", ret, + DHLOGE("ConfigCameraStreams failed, ret: %{public}d, devId: %{public}s, dhId: %{public}s", ret, GetAnonyString(devId_).c_str(), GetAnonyString(dhId_).c_str()); return FAILED; } @@ -228,14 +228,14 @@ int32_t DCameraProviderCallbackImpl::StartCapture(const DHBase& dhBase, const st bool DCameraProviderCallbackImpl::CheckCaptureInfo(const DCCaptureInfo& captureInfo) { - if (sizeof(captureInfo.streamIds_) > PARAM_MAX_SIZE || captureInfo.width_ < 0 || captureInfo.height_ < 0 || + if (captureInfo.streamIds_.size() > PARAM_MAX_SIZE || captureInfo.width_ < 0 || captureInfo.height_ < 0 || (captureInfo.width_ * captureInfo.height_ > RESOLUTION_MAX_WIDTH * RESOLUTION_MAX_HEIGHT)) { DHLOGE("captureInfo is invalid"); return false; } if (captureInfo.stride_ < 0 || captureInfo.format_ < 0 || captureInfo.dataspace_ < 0 || - sizeof(captureInfo.captureSettings_) > PARAM_MAX_SIZE) { + captureInfo.captureSettings_.size() > PARAM_MAX_SIZE) { DHLOGE("captureInfo is invalid"); return false; } diff --git a/services/cameraservice/sourceservice/test/unittest/common/distributedcameramgr/dcamera_provider_callback_impl_test.cpp b/services/cameraservice/sourceservice/test/unittest/common/distributedcameramgr/dcamera_provider_callback_impl_test.cpp index d7b4c0da..d29747e4 100644 --- a/services/cameraservice/sourceservice/test/unittest/common/distributedcameramgr/dcamera_provider_callback_impl_test.cpp +++ b/services/cameraservice/sourceservice/test/unittest/common/distributedcameramgr/dcamera_provider_callback_impl_test.cpp @@ -61,8 +61,6 @@ std::vector g_streamIdSnap; void DCameraProviderCallbackImplTest::SetUpTestCase(void) { - SetStreamInfos(); - SetCaptureInfos(); } void DCameraProviderCallbackImplTest::SetStreamInfos() @@ -134,6 +132,14 @@ void DCameraProviderCallbackImplTest::TearDownTestCase(void) void DCameraProviderCallbackImplTest::SetUp(void) { + g_streamInfosSnap.clear(); + g_captureInfoSnap.clear(); + g_cameraSettingSnap.clear(); + g_streamIdSnap.clear(); + + SetStreamInfos(); + SetCaptureInfos(); + stateListener_ = std::make_shared(); camDev_ = std::make_shared(TEST_DEVICE_ID, TEST_CAMERA_DH_ID_0, stateListener_); camDev_->InitDCameraSourceDev(); diff --git a/services/cameraservice/sourceservice/test/unittest/common/distributedcameramgr/dcamera_source_input_test.cpp b/services/cameraservice/sourceservice/test/unittest/common/distributedcameramgr/dcamera_source_input_test.cpp index 920c8592..5bc85ea0 100644 --- a/services/cameraservice/sourceservice/test/unittest/common/distributedcameramgr/dcamera_source_input_test.cpp +++ b/services/cameraservice/sourceservice/test/unittest/common/distributedcameramgr/dcamera_source_input_test.cpp @@ -56,8 +56,6 @@ std::vector g_camIndexs; void DCameraSourceInputTest::SetUpTestCase(void) { - SetStreamInfos(); - SetCaptureInfos(); } void DCameraSourceInputTest::SetStreamInfos() @@ -131,6 +129,15 @@ void DCameraSourceInputTest::TearDownTestCase(void) void DCameraSourceInputTest::SetUp(void) { + g_streamInfos.clear(); + g_captureInfos.clear(); + g_cameraSettings.clear(); + g_streamIds.clear(); + g_camIndexs.clear(); + + SetStreamInfos(); + SetCaptureInfos(); + stateListener_ = std::make_shared(); camDev_ = std::make_shared(TEST_DEVICE_ID, TEST_CAMERA_DH_ID_0, stateListener_); testInput_ = std::make_shared(TEST_DEVICE_ID, TEST_CAMERA_DH_ID_0, camDev_); diff --git a/services/cameraservice/sourceservice/test/unittest/common/distributedcameramgr/dcamera_source_state_machine_test.cpp b/services/cameraservice/sourceservice/test/unittest/common/distributedcameramgr/dcamera_source_state_machine_test.cpp index 466bdecc..1f520932 100644 --- a/services/cameraservice/sourceservice/test/unittest/common/distributedcameramgr/dcamera_source_state_machine_test.cpp +++ b/services/cameraservice/sourceservice/test/unittest/common/distributedcameramgr/dcamera_source_state_machine_test.cpp @@ -78,8 +78,6 @@ DCameraIndex g_camIndex; void DCameraSourceStateMachineTest::SetUpTestCase(void) { - SetStreamInfos(); - SetCaptureInfos(); } void DCameraSourceStateMachineTest::SetStreamInfos() @@ -157,6 +155,20 @@ void DCameraSourceStateMachineTest::TearDownTestCase(void) void DCameraSourceStateMachineTest::SetUp(void) { + g_streamInfosSnap.clear(); + g_captureInfoSnap.clear(); + g_cameraSettingSnap.clear(); + g_streamIdSnap.clear(); + g_camEvent = nullptr; + g_registParam = nullptr; + g_camIndex = {}; // Reset struct to default + g_regisStateStr = ""; + g_openStateStr = ""; + g_captureStateStr = ""; + + SetStreamInfos(); + SetCaptureInfos(); + stateListener_ = std::make_shared(); camDev_ = std::make_shared(TEST_DEVICE_ID, TEST_CAMERA_DH_ID_0, stateListener_); stateMachine_ = std::make_shared(camDev_); @@ -471,7 +483,7 @@ HWTEST_F(DCameraSourceStateMachineTest, dcamera_source_state_machine_test_009, T EXPECT_EQ(DCAMERA_OK, ret); ret = stateMachine_ ->Execute(DCAMERA_EVENT_UNREGIST, event1); - EXPECT_EQ(DCAMERA_BAD_VALUE, ret); + EXPECT_EQ(DCAMERA_NOT_FOUND, ret); ret = stateMachine_ ->Execute(static_cast(-1), event4); EXPECT_EQ(DCAMERA_WRONG_STATE, ret); @@ -571,10 +583,10 @@ HWTEST_F(DCameraSourceStateMachineTest, dcamera_source_state_machine_test_013, T EXPECT_EQ(DCAMERA_OK, ret); ret = stateMachine_ ->Execute(DCAMERA_EVENT_CLOSE, event3); - EXPECT_EQ(DCAMERA_BAD_VALUE, ret); + EXPECT_EQ(DCAMERA_OK, ret); ret = stateMachine_ ->Execute(DCAMERA_EVENT_UNREGIST, event1); - EXPECT_EQ(DCAMERA_BAD_VALUE, ret); + EXPECT_EQ(DCAMERA_NOT_FOUND, ret); ret = stateMachine_ ->Execute(static_cast(-1), event4); EXPECT_EQ(DCAMERA_WRONG_STATE, ret); diff --git a/services/data_process/src/pipeline/dcamera_pipeline_sink.cpp b/services/data_process/src/pipeline/dcamera_pipeline_sink.cpp index 58419370..d5459b52 100644 --- a/services/data_process/src/pipeline/dcamera_pipeline_sink.cpp +++ b/services/data_process/src/pipeline/dcamera_pipeline_sink.cpp @@ -71,9 +71,10 @@ int32_t DCameraPipelineSink::CreateDataProcessPipeline(PipelineType piplineType, bool DCameraPipelineSink::IsInRange(const VideoConfigParams& curConfig) { - return (curConfig.GetFrameRate() >= MIN_FRAME_RATE || curConfig.GetFrameRate() <= MAX_FRAME_RATE || - curConfig.GetWidth() >= MIN_VIDEO_WIDTH || curConfig.GetWidth() <= MAX_VIDEO_WIDTH || - curConfig.GetHeight() >= MIN_VIDEO_HEIGHT || curConfig.GetHeight() <= MAX_VIDEO_HEIGHT); + bool isWidthValid = (curConfig.GetWidth() >= MIN_VIDEO_WIDTH && curConfig.GetWidth() <= MAX_VIDEO_WIDTH); + bool isHeightValid = (curConfig.GetHeight() >= MIN_VIDEO_HEIGHT && curConfig.GetHeight() <= MAX_VIDEO_HEIGHT); + bool isFrameRateValid = (curConfig.GetFrameRate() >= MIN_FRAME_RATE && curConfig.GetFrameRate() <= MAX_FRAME_RATE); + return isWidthValid && isHeightValid && isFrameRateValid; } int32_t DCameraPipelineSink::InitDCameraPipNodes(const VideoConfigParams& sourceConfig, diff --git a/services/data_process/src/pipeline/dcamera_pipeline_source.cpp b/services/data_process/src/pipeline/dcamera_pipeline_source.cpp index 5a5b3823..ef4d3585 100644 --- a/services/data_process/src/pipeline/dcamera_pipeline_source.cpp +++ b/services/data_process/src/pipeline/dcamera_pipeline_source.cpp @@ -76,9 +76,10 @@ int32_t DCameraPipelineSource::CreateDataProcessPipeline(PipelineType piplineTyp bool DCameraPipelineSource::IsInRange(const VideoConfigParams& curConfig) { - return (curConfig.GetFrameRate() >= MIN_FRAME_RATE || curConfig.GetFrameRate() <= MAX_FRAME_RATE || - curConfig.GetWidth() >= MIN_VIDEO_WIDTH || curConfig.GetWidth() <= MAX_VIDEO_WIDTH || - curConfig.GetHeight() >= MIN_VIDEO_HEIGHT || curConfig.GetHeight() <= MAX_VIDEO_HEIGHT); + bool isWidthValid = (curConfig.GetWidth() >= MIN_VIDEO_WIDTH && curConfig.GetWidth() <= MAX_VIDEO_WIDTH); + bool isHeightValid = (curConfig.GetHeight() >= MIN_VIDEO_HEIGHT && curConfig.GetHeight() <= MAX_VIDEO_HEIGHT); + bool isFrameRateValid = (curConfig.GetFrameRate() >= MIN_FRAME_RATE && curConfig.GetFrameRate() <= MAX_FRAME_RATE); + return isWidthValid && isHeightValid && isFrameRateValid; } void DCameraPipelineSource::InitDCameraPipEvent() diff --git a/services/data_process/src/pipeline_node/multimedia_codec/decoder/decode_data_process.cpp b/services/data_process/src/pipeline_node/multimedia_codec/decoder/decode_data_process.cpp index 50ec3293..6f40f1f3 100644 --- a/services/data_process/src/pipeline_node/multimedia_codec/decoder/decode_data_process.cpp +++ b/services/data_process/src/pipeline_node/multimedia_codec/decoder/decode_data_process.cpp @@ -83,9 +83,10 @@ int32_t DecodeDataProcess::InitNode(const VideoConfigParams& sourceConfig, const bool DecodeDataProcess::IsInDecoderRange(const VideoConfigParams& curConfig) { - return (curConfig.GetWidth() >= MIN_VIDEO_WIDTH || curConfig.GetWidth() <= MAX_VIDEO_WIDTH || - curConfig.GetHeight() >= MIN_VIDEO_HEIGHT || curConfig.GetHeight() <= MAX_VIDEO_HEIGHT || - curConfig.GetFrameRate() >= MIN_FRAME_RATE || curConfig.GetFrameRate() <= MAX_FRAME_RATE); + bool isWidthValid = (curConfig.GetWidth() >= MIN_VIDEO_WIDTH && curConfig.GetWidth() <= MAX_VIDEO_WIDTH); + bool isHeightValid = (curConfig.GetHeight() >= MIN_VIDEO_HEIGHT && curConfig.GetHeight() <= MAX_VIDEO_HEIGHT); + bool isFrameRateValid = (curConfig.GetFrameRate() >= MIN_FRAME_RATE && curConfig.GetFrameRate() <= MAX_FRAME_RATE); + return isWidthValid && isHeightValid && isFrameRateValid; } bool DecodeDataProcess::IsConvertible(const VideoConfigParams& sourceConfig, const VideoConfigParams& targetConfig) diff --git a/services/data_process/src/pipeline_node/multimedia_codec/decoder/decode_data_process_common.cpp b/services/data_process/src/pipeline_node/multimedia_codec/decoder/decode_data_process_common.cpp index 215338ab..6d95b90d 100644 --- a/services/data_process/src/pipeline_node/multimedia_codec/decoder/decode_data_process_common.cpp +++ b/services/data_process/src/pipeline_node/multimedia_codec/decoder/decode_data_process_common.cpp @@ -81,9 +81,10 @@ int32_t DecodeDataProcess::InitNode(const VideoConfigParams& sourceConfig, const bool DecodeDataProcess::IsInDecoderRange(const VideoConfigParams& curConfig) { - return (curConfig.GetWidth() >= MIN_VIDEO_WIDTH || curConfig.GetWidth() <= MAX_VIDEO_WIDTH || - curConfig.GetHeight() >= MIN_VIDEO_HEIGHT || curConfig.GetHeight() <= MAX_VIDEO_HEIGHT || - curConfig.GetFrameRate() >= MIN_FRAME_RATE || curConfig.GetFrameRate() <= MAX_FRAME_RATE); + bool isWidthValid = (curConfig.GetWidth() >= MIN_VIDEO_WIDTH && curConfig.GetWidth() <= MAX_VIDEO_WIDTH); + bool isHeightValid = (curConfig.GetHeight() >= MIN_VIDEO_HEIGHT && curConfig.GetHeight() <= MAX_VIDEO_HEIGHT); + bool isFrameRateValid = (curConfig.GetFrameRate() >= MIN_FRAME_RATE && curConfig.GetFrameRate() <= MAX_FRAME_RATE); + return isWidthValid && isHeightValid && isFrameRateValid; } bool DecodeDataProcess::IsConvertible(const VideoConfigParams& sourceConfig, const VideoConfigParams& targetConfig) @@ -790,7 +791,7 @@ int32_t DecodeDataProcess::GetProperty(const std::string& propertyName, Property void DecodeDataProcess::AlignFirstFrameTime() { - if (frameInfoDeque_.empty()) { + if (frameInfoDeque_.size() < FIRST_FRAME_INPUT_NUM) { return; } DCameraFrameInfo frameInfo = frameInfoDeque_.front(); diff --git a/services/data_process/src/pipeline_node/multimedia_codec/encoder/encode_data_process.cpp b/services/data_process/src/pipeline_node/multimedia_codec/encoder/encode_data_process.cpp index 4c29102a..3df432b6 100644 --- a/services/data_process/src/pipeline_node/multimedia_codec/encoder/encode_data_process.cpp +++ b/services/data_process/src/pipeline_node/multimedia_codec/encoder/encode_data_process.cpp @@ -99,9 +99,10 @@ int32_t EncodeDataProcess::InitNode(const VideoConfigParams& sourceConfig, const bool EncodeDataProcess::IsInEncoderRange(const VideoConfigParams& curConfig) { - return (curConfig.GetWidth() >= MIN_VIDEO_WIDTH || curConfig.GetWidth() <= MAX_VIDEO_WIDTH || - curConfig.GetHeight() >= MIN_VIDEO_HEIGHT || curConfig.GetHeight() <= MAX_VIDEO_HEIGHT || - curConfig.GetFrameRate() >= MIN_FRAME_RATE || curConfig.GetFrameRate() <= MAX_FRAME_RATE); + bool isWidthValid = (curConfig.GetWidth() >= MIN_VIDEO_WIDTH && curConfig.GetWidth() <= MAX_VIDEO_WIDTH); + bool isHeightValid = (curConfig.GetHeight() >= MIN_VIDEO_HEIGHT && curConfig.GetHeight() <= MAX_VIDEO_HEIGHT); + bool isFrameRateValid = (curConfig.GetFrameRate() >= MIN_FRAME_RATE && curConfig.GetFrameRate() <= MAX_FRAME_RATE); + return isWidthValid && isHeightValid && isFrameRateValid; } bool EncodeDataProcess::IsConvertible(const VideoConfigParams& sourceConfig, const VideoConfigParams& targetConfig) diff --git a/services/data_process/test/unittest/common/pipeline/dcamera_pipeline_sink_test.cpp b/services/data_process/test/unittest/common/pipeline/dcamera_pipeline_sink_test.cpp index 84775cde..ff8ca515 100644 --- a/services/data_process/test/unittest/common/pipeline/dcamera_pipeline_sink_test.cpp +++ b/services/data_process/test/unittest/common/pipeline/dcamera_pipeline_sink_test.cpp @@ -38,7 +38,7 @@ public: namespace { const int32_t TEST_WIDTH = 1920; -const int32_t TEST_HEIGTH = 1080; +const int32_t TEST_HEIGHT = 1080; const int32_t SLEEP_TIME = 200000; } @@ -77,12 +77,12 @@ HWTEST_F(DCameraPipelineSinkTest, dcamera_pipeline_sink_test_001, TestSize.Level Videoformat::NV21, DCAMERA_PRODUCER_FPS_DEFAULT, TEST_WIDTH, - TEST_HEIGTH); + TEST_HEIGHT); VideoConfigParams destParams(VideoCodecType::CODEC_H264, Videoformat::NV21, DCAMERA_PRODUCER_FPS_DEFAULT, TEST_WIDTH, - TEST_HEIGTH); + TEST_HEIGHT); int32_t rc = testSinkPipeline_->CreateDataProcessPipeline(PipelineType::VIDEO, srcParams, destParams, listener); EXPECT_EQ(rc, DCAMERA_OK); usleep(SLEEP_TIME); @@ -103,12 +103,12 @@ HWTEST_F(DCameraPipelineSinkTest, dcamera_pipeline_sink_test_002, TestSize.Level Videoformat::NV21, DCAMERA_PRODUCER_FPS_DEFAULT, TEST_WIDTH, - TEST_HEIGTH); + TEST_HEIGHT); VideoConfigParams destParams(VideoCodecType::CODEC_H264, Videoformat::NV21, DCAMERA_PRODUCER_FPS_DEFAULT, TEST_WIDTH, - TEST_HEIGTH); + TEST_HEIGHT); int32_t rc = testSinkPipeline_->CreateDataProcessPipeline(PipelineType::VIDEO, srcParams, destParams, listener); EXPECT_EQ(rc, DCAMERA_OK); @@ -137,12 +137,12 @@ HWTEST_F(DCameraPipelineSinkTest, dcamera_pipeline_sink_test_003, TestSize.Level Videoformat::NV21, DCAMERA_PRODUCER_FPS_DEFAULT, TEST_WIDTH, - TEST_HEIGTH); + TEST_HEIGHT); VideoConfigParams destParams(VideoCodecType::CODEC_H264, Videoformat::NV21, DCAMERA_PRODUCER_FPS_DEFAULT, TEST_WIDTH, - TEST_HEIGTH); + TEST_HEIGHT); int32_t rc = testSinkPipeline_->CreateDataProcessPipeline( PipelineType::PHOTO_JPEG, srcParams, destParams, listener); EXPECT_EQ(rc, DCAMERA_NOT_FOUND); @@ -164,12 +164,12 @@ HWTEST_F(DCameraPipelineSinkTest, dcamera_pipeline_sink_test_004, TestSize.Level Videoformat::NV21, DCAMERA_PRODUCER_FPS_DEFAULT, TEST_WIDTH, - TEST_HEIGTH); + TEST_HEIGHT); VideoConfigParams destParams(VideoCodecType::CODEC_H264, Videoformat::NV21, DCAMERA_PRODUCER_FPS_DEFAULT, TEST_WIDTH, - TEST_HEIGTH); + TEST_HEIGHT); int32_t rc = testSinkPipeline_->CreateDataProcessPipeline(PipelineType::VIDEO, srcParams, destParams, listener); EXPECT_EQ(rc, DCAMERA_OK); @@ -209,39 +209,39 @@ HWTEST_F(DCameraPipelineSinkTest, dcamera_pipeline_sink_test_006, TestSize.Level EXPECT_EQ(false, testPipelineSink_ == nullptr); VideoConfigParams vcParams(VideoCodecType::NO_CODEC, Videoformat::NV21, DCAMERA_PRODUCER_FPS_DEFAULT, - TEST_WIDTH, TEST_HEIGTH); + TEST_WIDTH, TEST_HEIGHT); bool vc = testPipelineSink_->IsInRange(vcParams); EXPECT_EQ(true, vc); VideoConfigParams vcParams1(VideoCodecType::NO_CODEC, Videoformat::NV21, -1, - TEST_WIDTH, TEST_HEIGTH); + TEST_WIDTH, TEST_HEIGHT); bool vc1 = testPipelineSink_->IsInRange(vcParams1); - EXPECT_EQ(true, vc1); + EXPECT_EQ(false, vc1); VideoConfigParams vcParams2(VideoCodecType::NO_CODEC, Videoformat::NV21, 31, - TEST_WIDTH, TEST_HEIGTH); + TEST_WIDTH, TEST_HEIGHT); bool vc2 = testPipelineSink_->IsInRange(vcParams2); - EXPECT_EQ(true, vc2); + EXPECT_EQ(false, vc2); VideoConfigParams vcParams3(VideoCodecType::NO_CODEC, Videoformat::NV21, DCAMERA_PRODUCER_FPS_DEFAULT, - 300, TEST_HEIGTH); + 300, TEST_HEIGHT); bool vc3 = testPipelineSink_->IsInRange(vcParams3); - EXPECT_EQ(true, vc3); + EXPECT_EQ(false, vc3); VideoConfigParams vcParams4(VideoCodecType::NO_CODEC, Videoformat::NV21, DCAMERA_PRODUCER_FPS_DEFAULT, - 2000, TEST_HEIGTH); + 2000, TEST_HEIGHT); bool vc4 = testPipelineSink_->IsInRange(vcParams4); - EXPECT_EQ(true, vc4); + EXPECT_EQ(false, vc4); VideoConfigParams vcParams5(VideoCodecType::NO_CODEC, Videoformat::NV21, DCAMERA_PRODUCER_FPS_DEFAULT, TEST_WIDTH, 200); bool vc5 = testPipelineSink_->IsInRange(vcParams5); - EXPECT_EQ(true, vc5); + EXPECT_EQ(false, vc5); VideoConfigParams vcParams6(VideoCodecType::NO_CODEC, Videoformat::NV21, DCAMERA_PRODUCER_FPS_DEFAULT, TEST_WIDTH, 1100); bool vc6 = testPipelineSink_->IsInRange(vcParams6); - EXPECT_EQ(true, vc6); + EXPECT_EQ(false, vc6); } /** diff --git a/services/data_process/test/unittest/common/pipeline_node/decode_data_process_test.cpp b/services/data_process/test/unittest/common/pipeline_node/decode_data_process_test.cpp index 8e8f8a02..457f9662 100644 --- a/services/data_process/test/unittest/common/pipeline_node/decode_data_process_test.cpp +++ b/services/data_process/test/unittest/common/pipeline_node/decode_data_process_test.cpp @@ -96,7 +96,7 @@ HWTEST_F(DecodeDataProcessTest, decode_data_process_test_001, TestSize.Level1) TEST_HEIGTH); VideoConfigParams procConfig; int32_t rc = testDecodeDataProcess_->InitNode(srcParams, destParams, procConfig); - EXPECT_EQ(rc, DCAMERA_OK); + EXPECT_EQ(rc, DCAMERA_BAD_VALUE); } /** @@ -599,7 +599,7 @@ HWTEST_F(DecodeDataProcessTest, decode_data_process_test_017, TestSize.Level1) int32_t rc = testDecodeDataProcess_->InitNode(srcParams2, destParams2, procConfig2); testDecodeDataProcess_->OnError(); testDecodeDataProcess_->isDecoderProcess_.store(true); - EXPECT_EQ(rc, DCAMERA_OK); + EXPECT_EQ(rc, DCAMERA_BAD_VALUE); } /** diff --git a/services/data_process/test/unittest/common/pipeline_node/encode_data_process_test.cpp b/services/data_process/test/unittest/common/pipeline_node/encode_data_process_test.cpp index 161a4534..98101591 100644 --- a/services/data_process/test/unittest/common/pipeline_node/encode_data_process_test.cpp +++ b/services/data_process/test/unittest/common/pipeline_node/encode_data_process_test.cpp @@ -37,9 +37,9 @@ public: namespace { const int32_t TEST_WIDTH = 1920; -const int32_t TEST_HEIGTH = 1080; +const int32_t TEST_HEIGHT = 1080; const int32_t TEST_WIDTH2 = 640; -const int32_t TEST_HEIGTH2 = 480; +const int32_t TEST_HEIGHT2 = 480; } void EncodeDataProcessTest::SetUpTestCase(void) @@ -76,15 +76,15 @@ HWTEST_F(EncodeDataProcessTest, encode_data_process_test_001, TestSize.Level1) Videoformat::YUVI420, frameRate, TEST_WIDTH, - TEST_HEIGTH); + TEST_HEIGHT); VideoConfigParams destParams(VideoCodecType::CODEC_H264, Videoformat::NV21, frameRate, TEST_WIDTH, - TEST_HEIGTH); + TEST_HEIGHT); VideoConfigParams procConfig; int32_t rc = testEncodeDataProcess_->InitNode(srcParams, destParams, procConfig); - EXPECT_EQ(rc, DCAMERA_OK); + EXPECT_EQ(rc, DCAMERA_BAD_VALUE); } /** @@ -101,12 +101,12 @@ HWTEST_F(EncodeDataProcessTest, encode_data_process_test_002, TestSize.Level1) Videoformat::NV12, DCAMERA_PRODUCER_FPS_DEFAULT, TEST_WIDTH, - TEST_HEIGTH); + TEST_HEIGHT); VideoConfigParams destParams(VideoCodecType::CODEC_H265, Videoformat::NV21, DCAMERA_PRODUCER_FPS_DEFAULT, TEST_WIDTH2, - TEST_HEIGTH2); + TEST_HEIGHT2); VideoConfigParams procConfig; int32_t rc = testEncodeDataProcess_->InitNode(srcParams, destParams, procConfig); EXPECT_EQ(rc, DCAMERA_BAD_TYPE); @@ -126,12 +126,12 @@ HWTEST_F(EncodeDataProcessTest, encode_data_process_test_003, TestSize.Level1) Videoformat::NV12, DCAMERA_PRODUCER_FPS_DEFAULT, TEST_WIDTH, - TEST_HEIGTH); + TEST_HEIGHT); VideoConfigParams destParams(VideoCodecType::CODEC_H264, Videoformat::NV21, DCAMERA_PRODUCER_FPS_DEFAULT, TEST_WIDTH2, - TEST_HEIGTH2); + TEST_HEIGHT2); VideoConfigParams procConfig; int32_t rc = testEncodeDataProcess_->InitNode(srcParams, destParams, procConfig); EXPECT_EQ(rc, DCAMERA_OK); @@ -151,12 +151,12 @@ HWTEST_F(EncodeDataProcessTest, encode_data_process_test_004, TestSize.Level1) Videoformat::NV12, DCAMERA_PRODUCER_FPS_DEFAULT, TEST_WIDTH, - TEST_HEIGTH); + TEST_HEIGHT); VideoConfigParams destParams(VideoCodecType::CODEC_MPEG4_ES, Videoformat::NV21, DCAMERA_PRODUCER_FPS_DEFAULT, TEST_WIDTH2, - TEST_HEIGTH2); + TEST_HEIGHT2); VideoConfigParams procConfig; int32_t rc = testEncodeDataProcess_->InitNode(srcParams, destParams, procConfig); EXPECT_EQ(rc, DCAMERA_INIT_ERR); @@ -208,12 +208,12 @@ HWTEST_F(EncodeDataProcessTest, encode_data_process_test_006, TestSize.Level1) Videoformat::NV12, DCAMERA_PRODUCER_FPS_DEFAULT, TEST_WIDTH, - TEST_HEIGTH); + TEST_HEIGHT); VideoConfigParams destParams(VideoCodecType::CODEC_H264, Videoformat::NV21, DCAMERA_PRODUCER_FPS_DEFAULT, TEST_WIDTH, - TEST_HEIGTH); + TEST_HEIGHT); VideoConfigParams procConfig; int32_t rc = testEncodeDataProcess_->InitNode(srcParams, destParams, procConfig); EXPECT_EQ(rc, DCAMERA_OK); @@ -240,12 +240,12 @@ HWTEST_F(EncodeDataProcessTest, encode_data_process_test_007, TestSize.Level1) Videoformat::NV12, DCAMERA_PRODUCER_FPS_DEFAULT, TEST_WIDTH, - TEST_HEIGTH); + TEST_HEIGHT); VideoConfigParams destParams(VideoCodecType::CODEC_H265, Videoformat::NV21, DCAMERA_PRODUCER_FPS_DEFAULT, TEST_WIDTH, - TEST_HEIGTH); + TEST_HEIGHT); VideoConfigParams procConfig; int32_t rc = testEncodeDataProcess_->InitNode(srcParams, destParams, procConfig); EXPECT_EQ(rc, DCAMERA_OK); @@ -268,12 +268,12 @@ HWTEST_F(EncodeDataProcessTest, encode_data_process_test_008, TestSize.Level1) Videoformat::RGBA_8888, DCAMERA_PRODUCER_FPS_DEFAULT, TEST_WIDTH, - TEST_HEIGTH); + TEST_HEIGHT); VideoConfigParams destParams(VideoCodecType::CODEC_H264, Videoformat::NV21, DCAMERA_PRODUCER_FPS_DEFAULT, TEST_WIDTH2, - TEST_HEIGTH2); + TEST_HEIGHT2); VideoConfigParams procConfig; int32_t rc = testEncodeDataProcess_->InitNode(srcParams, destParams, procConfig); EXPECT_EQ(rc, DCAMERA_OK); @@ -296,12 +296,12 @@ HWTEST_F(EncodeDataProcessTest, encode_data_process_test_009, TestSize.Level1) Videoformat::NV12, DCAMERA_PRODUCER_FPS_DEFAULT, TEST_WIDTH, - TEST_HEIGTH); + TEST_HEIGHT); VideoConfigParams destParams(VideoCodecType::CODEC_H264, Videoformat::NV21, DCAMERA_PRODUCER_FPS_DEFAULT, TEST_WIDTH, - TEST_HEIGTH); + TEST_HEIGHT); VideoConfigParams procConfig; int32_t rc = testEncodeDataProcess_->InitNode(srcParams, destParams, procConfig); EXPECT_EQ(rc, DCAMERA_OK); @@ -340,12 +340,12 @@ HWTEST_F(EncodeDataProcessTest, encode_data_process_test_010, TestSize.Level1) Videoformat::YUVI420, DCAMERA_PRODUCER_FPS_DEFAULT, TEST_WIDTH, - TEST_HEIGTH); + TEST_HEIGHT); VideoConfigParams destParams(VideoCodecType::CODEC_H264, Videoformat::NV21, DCAMERA_PRODUCER_FPS_DEFAULT, TEST_WIDTH, - TEST_HEIGTH); + TEST_HEIGHT); VideoConfigParams procConfig; int32_t rc = testEncodeDataProcess_->InitNode(srcParams, destParams, procConfig); EXPECT_EQ(rc, DCAMERA_OK); @@ -368,12 +368,12 @@ HWTEST_F(EncodeDataProcessTest, encode_data_process_test_011, TestSize.Level1) Videoformat::YUVI420, DCAMERA_PRODUCER_FPS_DEFAULT, TEST_WIDTH, - TEST_HEIGTH); + TEST_HEIGHT); VideoConfigParams destParams(VideoCodecType::CODEC_H264, Videoformat::NV21, DCAMERA_PRODUCER_FPS_DEFAULT, TEST_WIDTH, - TEST_HEIGTH); + TEST_HEIGHT); VideoConfigParams procConfig; int32_t rc = testEncodeDataProcess_->InitNode(srcParams, destParams, procConfig); EXPECT_EQ(rc, DCAMERA_OK); @@ -441,12 +441,12 @@ HWTEST_F(EncodeDataProcessTest, encode_data_process_test_014, TestSize.Level1) Videoformat::NV12, DCAMERA_PRODUCER_FPS_DEFAULT, TEST_WIDTH, - TEST_HEIGTH); + TEST_HEIGHT); VideoConfigParams destParams(VideoCodecType::CODEC_H264, Videoformat::NV21, DCAMERA_PRODUCER_FPS_DEFAULT, TEST_WIDTH, - TEST_HEIGTH); + TEST_HEIGHT); VideoConfigParams procConfig; int32_t rc = testEncodeDataProcess_->InitNode(srcParams, destParams, procConfig); EXPECT_EQ(rc, DCAMERA_OK); @@ -503,12 +503,12 @@ HWTEST_F(EncodeDataProcessTest, encode_data_process_test_016, TestSize.Level1) Videoformat::NV12, DCAMERA_PRODUCER_FPS_DEFAULT, TEST_WIDTH, - TEST_HEIGTH); + TEST_HEIGHT); VideoConfigParams destParams(VideoCodecType::CODEC_H264, Videoformat::NV21, DCAMERA_PRODUCER_FPS_DEFAULT, TEST_WIDTH, - TEST_HEIGTH); + TEST_HEIGHT); VideoConfigParams procConfig; int32_t rc = testEncodeDataProcess_->InitNode(srcParams, destParams, procConfig); EXPECT_EQ(rc, DCAMERA_OK); -- Gitee