diff --git a/camera_hdf/hdi_impl/BUILD.gn b/camera_hdf/hdi_impl/BUILD.gn index 0be318069e8e0bb95d4909fe67b6b82026e35a0f..2307ca1c7f873f84c7419edbab4f5a95e5e3d201 100644 --- a/camera_hdf/hdi_impl/BUILD.gn +++ b/camera_hdf/hdi_impl/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (C) 2021 Huawei Device Co., Ltd. +# Copyright (c) 2021 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/camera_hdf/hdi_impl/include/dcamera_host/dcamera_host.h b/camera_hdf/hdi_impl/include/dcamera_host/dcamera_host.h index b8429fc4140d5d44e1e0438143457f3ac5c24709..517373e2455db9046838963d47bc0225cf11d974 100644 --- a/camera_hdf/hdi_impl/include/dcamera_host/dcamera_host.h +++ b/camera_hdf/hdi_impl/include/dcamera_host/dcamera_host.h @@ -62,13 +62,13 @@ private: private: class AutoRelease { public: - AutoRelease() {}; + AutoRelease() {} ~AutoRelease() { if (DCameraHost::instance_ != nullptr) { DCameraHost::instance_ = nullptr; } - }; + } }; static AutoRelease autoRelease_; static std::shared_ptr instance_; diff --git a/camera_hdf/hdi_impl/include/dcamera_provider/dcamera_provider.h b/camera_hdf/hdi_impl/include/dcamera_provider/dcamera_provider.h index 7a25f388af992343c5c7d29fe4fa41dac52010cc..166d81497391fec8905d10a6f78f7161c5b51741 100644 --- a/camera_hdf/hdi_impl/include/dcamera_provider/dcamera_provider.h +++ b/camera_hdf/hdi_impl/include/dcamera_provider/dcamera_provider.h @@ -63,13 +63,13 @@ private: private: class AutoRelease { public: - AutoRelease() {}; + AutoRelease() {} ~AutoRelease() { if (DCameraProvider::instance_ != nullptr) { DCameraProvider::instance_ = nullptr; } - }; + } }; static AutoRelease autoRelease_; static std::shared_ptr instance_; diff --git a/camera_hdf/hdi_impl/src/dcamera_device/dmetadata_processor.cpp b/camera_hdf/hdi_impl/src/dcamera_device/dmetadata_processor.cpp index 75838fa579dac8f7418ed494a56710557235d320..154d47fdb6b2241ff116716e0e1559aa0a1ea435 100644 --- a/camera_hdf/hdi_impl/src/dcamera_device/dmetadata_processor.cpp +++ b/camera_hdf/hdi_impl/src/dcamera_device/dmetadata_processor.cpp @@ -246,7 +246,7 @@ DCamRetCode DMetadataProcessor::AddAbilityEntry(uint32_t tag, const void *data, int ret = CameraStandard::FindCameraMetadataItem(dCameraAbility_->get(), tag, &item); if (ret) { if (!dCameraAbility_->addEntry(tag, data, size)) { - DHLOGE("Add tag %d failed.", tag); + DHLOGE("Add tag %u failed.", tag); return FAILED; } } @@ -264,12 +264,12 @@ DCamRetCode DMetadataProcessor::UpdateAbilityEntry(uint32_t tag, const void *dat int ret = CameraStandard::FindCameraMetadataItem(dCameraAbility_->get(), tag, &item); if (ret) { if (!dCameraAbility_->addEntry(tag, data, size)) { - DHLOGE("Add tag %d failed.", tag); + DHLOGE("Add tag %u failed.", tag); return FAILED; } } else { if (!dCameraAbility_->updateEntry(tag, data, size)) { - DHLOGE("Update tag %d failed.", tag); + DHLOGE("Update tag %u failed.", tag); return FAILED; } } diff --git a/camera_hdf/hdi_impl/src/dcamera_provider/dcamera_provider.cpp b/camera_hdf/hdi_impl/src/dcamera_provider/dcamera_provider.cpp index 6f21e2bcb6d7db39df8dec2218a066b50e0ad05c..7476c8541b61096145bb2ab50ff2c98ca89daecd 100644 --- a/camera_hdf/hdi_impl/src/dcamera_provider/dcamera_provider.cpp +++ b/camera_hdf/hdi_impl/src/dcamera_provider/dcamera_provider.cpp @@ -40,6 +40,10 @@ std::shared_ptr DCameraProvider::GetInstance() DCamRetCode DCameraProvider::EnableDCameraDevice(const std::shared_ptr &dhBase, const std::string &abilityInfo, const sptr &callback) { + if (dhBase == nullptr) { + DHLOGE("DCameraProvider::EnableDCameraDevice, dhBase is null."); + return DCamRetCode::INVALID_ARGUMENT; + } DHLOGI("DCameraProvider::EnableDCameraDevice for {devId: %s, dhId: %s, abilityInfo length: %d}.", GetAnonyString(dhBase->deviceId_).c_str(), dhBase->dhId_.c_str(), abilityInfo.length()); @@ -71,6 +75,10 @@ DCamRetCode DCameraProvider::EnableDCameraDevice(const std::shared_ptr & DCamRetCode DCameraProvider::DisableDCameraDevice(const std::shared_ptr &dhBase) { + if (dhBase == nullptr) { + DHLOGE("DCameraProvider::DisableDCameraDevice, dhBase is null."); + return DCamRetCode::INVALID_ARGUMENT; + } DHLOGI("DCameraProvider::DisableDCameraDevice for {devId: %s, dhId: %s}.", GetAnonyString(dhBase->deviceId_).c_str(), dhBase->dhId_.c_str()); @@ -96,6 +104,10 @@ DCamRetCode DCameraProvider::DisableDCameraDevice(const std::shared_ptr DCamRetCode DCameraProvider::AcquireBuffer(const std::shared_ptr &dhBase, int streamId, std::shared_ptr &buffer) { + if (dhBase == nullptr) { + DHLOGE("DCameraProvider::AcquireBuffer, dhBase is null."); + return DCamRetCode::INVALID_ARGUMENT; + } DHLOGI("DCameraProvider::AcquireBuffer for {devId: %s, dhId: %s}, streamId: %d.", GetAnonyString(dhBase->deviceId_).c_str(), dhBase->dhId_.c_str(), streamId); @@ -111,6 +123,10 @@ DCamRetCode DCameraProvider::AcquireBuffer(const std::shared_ptr &dhBase DCamRetCode DCameraProvider::ShutterBuffer(const std::shared_ptr &dhBase, int streamId, const std::shared_ptr &buffer) { + if (dhBase == nullptr) { + DHLOGE("DCameraProvider::ShutterBuffer, dhBase is null."); + return DCamRetCode::INVALID_ARGUMENT; + } if (buffer == nullptr) { DHLOGE("DCameraProvider::ShutterBuffer, input distributed camera buffer is null."); return DCamRetCode::INVALID_ARGUMENT; @@ -130,6 +146,10 @@ DCamRetCode DCameraProvider::ShutterBuffer(const std::shared_ptr &dhBase DCamRetCode DCameraProvider::OnSettingsResult(const std::shared_ptr &dhBase, const std::shared_ptr &result) { + if (dhBase == nullptr) { + DHLOGE("DCameraProvider::OnSettingsResult, dhBase is null."); + return DCamRetCode::INVALID_ARGUMENT; + } DHLOGI("DCameraProvider::OnSettingsResult for {devId: %s, dhId: %s}.", GetAnonyString(dhBase->deviceId_).c_str(), dhBase->dhId_.c_str()); @@ -145,6 +165,10 @@ DCamRetCode DCameraProvider::OnSettingsResult(const std::shared_ptr &dhB DCamRetCode DCameraProvider::Notify(const std::shared_ptr &dhBase, const std::shared_ptr &event) { + if (dhBase == nullptr) { + DHLOGE("DCameraProvider::Notify, dhBase is null."); + return DCamRetCode::INVALID_ARGUMENT; + } DHLOGI("DCameraProvider::Notify for {devId: %s, dhId: %s}.", GetAnonyString(dhBase->deviceId_).c_str(), dhBase->dhId_.c_str()); @@ -159,6 +183,10 @@ DCamRetCode DCameraProvider::Notify(const std::shared_ptr &dhBase, DCamRetCode DCameraProvider::OpenSession(const std::shared_ptr &dhBase) { + if (dhBase == nullptr) { + DHLOGE("DCameraProvider::OpenSession, dhBase is null."); + return DCamRetCode::INVALID_ARGUMENT; + } DHLOGI("DCameraProvider::OpenSession for {devId: %s, dhId: %s}.", GetAnonyString(dhBase->deviceId_).c_str(), dhBase->dhId_.c_str()); @@ -173,6 +201,10 @@ DCamRetCode DCameraProvider::OpenSession(const std::shared_ptr &dhBase) DCamRetCode DCameraProvider::CloseSession(const std::shared_ptr &dhBase) { + if (dhBase == nullptr) { + DHLOGE("DCameraProvider::CloseSession, dhBase is null."); + return DCamRetCode::INVALID_ARGUMENT; + } DHLOGI("DCameraProvider::CloseSession for {devId: %s, dhId: %s}.", GetAnonyString(dhBase->deviceId_).c_str(), dhBase->dhId_.c_str()); @@ -188,6 +220,10 @@ DCamRetCode DCameraProvider::CloseSession(const std::shared_ptr &dhBase) DCamRetCode DCameraProvider::ConfigureStreams(const std::shared_ptr &dhBase, const std::vector> &streamInfos) { + if (dhBase == nullptr) { + DHLOGE("DCameraProvider::ConfigureStreams, dhBase is null."); + return DCamRetCode::INVALID_ARGUMENT; + } DHLOGI("DCameraProvider::ConfigureStreams for {devId: %s, dhId: %s}.", GetAnonyString(dhBase->deviceId_).c_str(), dhBase->dhId_.c_str()); @@ -207,6 +243,10 @@ DCamRetCode DCameraProvider::ConfigureStreams(const std::shared_ptr &dhB DCamRetCode DCameraProvider::ReleaseStreams(const std::shared_ptr &dhBase, const std::vector &streamIds) { + if (dhBase == nullptr) { + DHLOGE("DCameraProvider::ReleaseStreams, dhBase is null."); + return DCamRetCode::INVALID_ARGUMENT; + } DHLOGI("DCameraProvider::ReleaseStreams for {devId: %s, dhId: %s}.", GetAnonyString(dhBase->deviceId_).c_str(), dhBase->dhId_.c_str()); @@ -227,6 +267,10 @@ DCamRetCode DCameraProvider::ReleaseStreams(const std::shared_ptr &dhBas DCamRetCode DCameraProvider::StartCapture(const std::shared_ptr &dhBase, const std::vector> &captureInfos) { + if (dhBase == nullptr) { + DHLOGE("DCameraProvider::StartCapture, dhBase is null."); + return DCamRetCode::INVALID_ARGUMENT; + } DHLOGI("DCameraProvider::StartCapture for {devId: %s, dhId: %s}.", GetAnonyString(dhBase->deviceId_).c_str(), dhBase->dhId_.c_str()); @@ -250,6 +294,10 @@ DCamRetCode DCameraProvider::StartCapture(const std::shared_ptr &dhBase, DCamRetCode DCameraProvider::StopCapture(const std::shared_ptr &dhBase) { + if (dhBase == nullptr) { + DHLOGE("DCameraProvider::StopCapture, dhBase is null."); + return DCamRetCode::INVALID_ARGUMENT; + } DHLOGI("DCameraProvider::StopCapture for {devId: %s, dhId: %s}.", GetAnonyString(dhBase->deviceId_).c_str(), dhBase->dhId_.c_str()); @@ -265,6 +313,10 @@ DCamRetCode DCameraProvider::StopCapture(const std::shared_ptr &dhBase) DCamRetCode DCameraProvider::UpdateSettings(const std::shared_ptr &dhBase, const std::vector> &settings) { + if (dhBase == nullptr) { + DHLOGE("DCameraProvider::UpdateSettings, dhBase is null."); + return DCamRetCode::INVALID_ARGUMENT; + } DHLOGI("DCameraProvider::UpdateSettings for {devId: %s, dhId: %s}.", GetAnonyString(dhBase->deviceId_).c_str(), dhBase->dhId_.c_str()); @@ -279,12 +331,16 @@ DCamRetCode DCameraProvider::UpdateSettings(const std::shared_ptr &dhBas bool DCameraProvider::IsDhBaseInfoInvalid(const std::shared_ptr &dhBase) { - return dhBase->deviceId_.empty() || (dhBase->deviceId_.size() > DEVID_MAX_LENGTH) || + return dhBase == nullptr || dhBase->deviceId_.empty() || (dhBase->deviceId_.size() > DEVID_MAX_LENGTH) || dhBase->dhId_.empty() || (dhBase->dhId_.size() > DHID_MAX_LENGTH); } sptr DCameraProvider::GetCallbackBydhBase(const std::shared_ptr &dhBase) { + if (dhBase == nullptr) { + DHLOGE("DCameraProvider::GetCallbackBydhBase, dhBase is null."); + return nullptr; + } OHOS::sptr device = GetDCameraDevice(dhBase); if (device == nullptr) { DHLOGE("DCameraProvider::GetCallbackBydhBase failed, dcamera device not found."); @@ -295,6 +351,10 @@ sptr DCameraProvider::GetCallbackBydhBase(const std::s OHOS::sptr DCameraProvider::GetDCameraDevice(const std::shared_ptr &dhBase) { + if (dhBase == nullptr) { + DHLOGE("DCameraProvider::GetDCameraDevice, dhBase is null."); + return nullptr; + } std::shared_ptr dCameraHost = DCameraHost::GetInstance(); if (dCameraHost == nullptr) { DHLOGE("DCameraProvider::GetDCameraDevice, dcamera host is null."); diff --git a/camera_hdf/hdi_impl/src/dstream_operator/dcamera_steam.cpp b/camera_hdf/hdi_impl/src/dstream_operator/dcamera_steam.cpp index 8fed5e92ac2378081adae6a9ea207e9ce11c234b..112e85359c5446f961936686c0d85021b15cc00b 100644 --- a/camera_hdf/hdi_impl/src/dstream_operator/dcamera_steam.cpp +++ b/camera_hdf/hdi_impl/src/dstream_operator/dcamera_steam.cpp @@ -187,7 +187,7 @@ DCamRetCode DCameraStream::GetNextRequest() OHOS::SurfaceError surfaceError = dcStreamProducer_->RequestBuffer(surfaceBuffer, fence, config); if (surfaceError == OHOS::SURFACE_ERROR_NO_BUFFER) { - DHLOGE("No availiable buffer to request in surface."); + DHLOGE("No available buffer to request in surface."); return DCamRetCode::EXCEED_MAX_NUMBER; } diff --git a/camera_hdf/hdi_impl/src/dstream_operator/dstream_operator.cpp b/camera_hdf/hdi_impl/src/dstream_operator/dstream_operator.cpp index 5252b84e0a3f6c39c1e49ea5f8200ef164d431f2..4655598b108f0882d619cc0ba17ef5a000bafb52 100644 --- a/camera_hdf/hdi_impl/src/dstream_operator/dstream_operator.cpp +++ b/camera_hdf/hdi_impl/src/dstream_operator/dstream_operator.cpp @@ -480,7 +480,7 @@ DCamRetCode DStreamOperator::ShutterBuffer(int streamId, const std::shared_ptr> &streamInfo, std::shared_ptr &captureInfo) { + if (captureInfo == nullptr) { + DHLOGE("DStreamOperator::ChooseSuitableResolution, captureInfo is null."); + return; + } std::vector supportedResolutionList = dcSupportedResolutionMap_[captureInfo->format_]; DCResolution tempResolution = { 0, 0 }; @@ -727,7 +731,7 @@ void DStreamOperator::ChooseSuitableResolution(std::vectorstreamIds_.push_back(stream->streamId_); - }; + } if ((tempResolution.width_ == 0) || (tempResolution.height_ == 0)) { captureInfo->width_ = MAX_SUPPORT_PREVIEW_WIDTH; diff --git a/camera_hdf/hdi_impl/test/BUILD.gn b/camera_hdf/hdi_impl/test/BUILD.gn index 0a0bf5eeae38f894bedde263da01d0a280d1f6ce..ceaf635e8ab31756347cbfa90c0e6267562324ac 100644 --- a/camera_hdf/hdi_impl/test/BUILD.gn +++ b/camera_hdf/hdi_impl/test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (C) 2021 Huawei Device Co., Ltd. +# Copyright (c) 2021 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/camera_hdf/hdi_impl/test/common.cpp b/camera_hdf/hdi_impl/test/common.cpp index 7d6042076626a29da570ed9cbbdb7e1172a13a80..a0b805e74f507f299ae2c65b5e4e8fdc444fae4b 100644 --- a/camera_hdf/hdi_impl/test/common.cpp +++ b/camera_hdf/hdi_impl/test/common.cpp @@ -38,12 +38,18 @@ int32_t Test::SaveYUV(const char* type, const void* buffer, int32_t size) char path[PATH_MAX] = {0}; if (strncmp(type, "preview", strlen(type)) == 0) { system("mkdir -p /data/dcamera/preview"); - sprintf_s(path, sizeof(path) / sizeof(path[0]), "/data/dcamera/preview/%s_%lld.yuv", - type, GetCurrentLocalTimeStamp()); + if (sprintf_s(path, sizeof(path) / sizeof(path[0]), "/data/dcamera/preview/%s_%lld.yuv", + type, GetCurrentLocalTimeStamp()) < 0) { + std::cout << "SaveYUV : preview sprintf_s fail." << std::endl; + return -1; + } } else { system("mkdir -p /data/dcamera/capture"); - sprintf_s(path, sizeof(path) / sizeof(path[0]), "/data/dcamera/capture/%s_%lld.jpg", - type, GetCurrentLocalTimeStamp()); + if (sprintf_s(path, sizeof(path) / sizeof(path[0]), "/data/dcamera/capture/%s_%lld.jpg", + type, GetCurrentLocalTimeStamp()) < 0) { + std::cout << "SaveYUV : capture sprintf_s fail." << std::endl; + return -1; + } } std::cout << "save yuv to file:" << path << std::endl; @@ -69,8 +75,11 @@ int32_t Test::SaveVideoFile(const char* type, const void* buffer, int32_t size, if (operationMode == 0) { char path[PATH_MAX] = {0}; system("mkdir -p /data/dcamera/video"); - sprintf_s(path, sizeof(path) / sizeof(path[0]), "/data/dcamera/video/%s_%lld.h265", - type, GetCurrentLocalTimeStamp()); + if (sprintf_s(path, sizeof(path) / sizeof(path[0]), "/data/dcamera/video/%s_%lld.h265", + type, GetCurrentLocalTimeStamp()) < 0) { + std::cout << "SaveVideoFile : video sprintf_s fail." << std::endl; + return -1; + } std::cout << "save yuv to file " << std::string(path) << std::endl; int mode = 00766; videoFd = open(path, O_RDWR | O_CREAT, mode); diff --git a/camera_hdf/interfaces/hdi_ipc/client/BUILD.gn b/camera_hdf/interfaces/hdi_ipc/client/BUILD.gn index 71944d5d759091260bf3c2294d98db813e869f52..b4db7f136da633ed10046a84a44844585690eb65 100644 --- a/camera_hdf/interfaces/hdi_ipc/client/BUILD.gn +++ b/camera_hdf/interfaces/hdi_ipc/client/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (C) 2021 Huawei Device Co., Ltd. +# Copyright (c) 2021 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/camera_hdf/interfaces/hdi_ipc/client/operator/dstream_operator_proxy.cpp b/camera_hdf/interfaces/hdi_ipc/client/operator/dstream_operator_proxy.cpp index 00bcaff6dbbd2d69304d5a3524f77747aa92e13c..3374647279440fb5606712582a174c0a3ac18433 100644 --- a/camera_hdf/interfaces/hdi_ipc/client/operator/dstream_operator_proxy.cpp +++ b/camera_hdf/interfaces/hdi_ipc/client/operator/dstream_operator_proxy.cpp @@ -112,7 +112,7 @@ CamRetCode DStreamOperatorProxy::CreateStreams(const std::vector streamInfo = streamInfos.at(i); bool bRet = IpcDataUtils::EncodeStreamInfo(streamInfo, data); if (!bRet) { - DHLOGE("Write streamInfo failed. index = %d", i); + DHLOGE("Write streamInfo failed. index = %zu", i); return CamRetCode::INVALID_ARGUMENT; } } diff --git a/camera_hdf/interfaces/hdi_ipc/client/provider/dcamera_provider_proxy.cpp b/camera_hdf/interfaces/hdi_ipc/client/provider/dcamera_provider_proxy.cpp index 4fa418cc3063341bff6c99b9e7a0c2f3ed82f277..e452f613ecd113128b954138c2d9c74da19a9971 100644 --- a/camera_hdf/interfaces/hdi_ipc/client/provider/dcamera_provider_proxy.cpp +++ b/camera_hdf/interfaces/hdi_ipc/client/provider/dcamera_provider_proxy.cpp @@ -133,7 +133,7 @@ DCamRetCode DCameraProviderProxy::AcquireBuffer(const std::shared_ptr &d } int32_t retCode = reply.ReadInt32(); if (retCode != DCamRetCode::SUCCESS) { - DHLOGE("Acquire avaliable buffer from stub failed."); + DHLOGE("Acquire available buffer from stub failed."); return static_cast(retCode); } @@ -143,7 +143,7 @@ DCamRetCode DCameraProviderProxy::AcquireBuffer(const std::shared_ptr &d BufferHandle* retHandle = ReadBufferHandle(reply); if (retHandle == nullptr) { - DHLOGE("Read retrun buffer handle failed."); + DHLOGE("Read return buffer handle failed."); FreeBufferHandle(buffer->bufferHandle_); return DCamRetCode::INVALID_ARGUMENT; } diff --git a/camera_hdf/interfaces/hdi_ipc/config/host/BUILD.gn b/camera_hdf/interfaces/hdi_ipc/config/host/BUILD.gn index d3ec5b0d6783509ae862e4392953df9385a0234a..7b744eb809028d1c6f14524de2af136a94f87a1f 100644 --- a/camera_hdf/interfaces/hdi_ipc/config/host/BUILD.gn +++ b/camera_hdf/interfaces/hdi_ipc/config/host/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (C) 2021 Huawei Device Co., Ltd. +# Copyright (c) 2021 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/camera_hdf/interfaces/hdi_ipc/config/host/dcamera_host_config.cpp b/camera_hdf/interfaces/hdi_ipc/config/host/dcamera_host_config.cpp index bd97bfb7a93045a5bb59369c0852de41e054cadd..61c53aae97f0ac3e42f850cb314d99dec5363de0 100644 --- a/camera_hdf/interfaces/hdi_ipc/config/host/dcamera_host_config.cpp +++ b/camera_hdf/interfaces/hdi_ipc/config/host/dcamera_host_config.cpp @@ -28,6 +28,10 @@ static int32_t DCameraServiceDispatch(struct HdfDeviceIoClient *client, int cmdI struct HdfSBuf *data, struct HdfSBuf *reply) { HdfDCameraService *service = CONTAINER_OF(client->device->service, HdfDCameraService, ioservice); + if (service == nullptr) { + HDF_LOGE("HdfDCameraService CONTAINER_OF failed!"); + return HDF_FAILURE; + } return DCHostServiceOnRemoteRequest(service->instance, cmdId, data, reply); } diff --git a/camera_hdf/interfaces/hdi_ipc/config/provider/BUILD.gn b/camera_hdf/interfaces/hdi_ipc/config/provider/BUILD.gn index 053ddc2b1ffe48eaf26cc63429827d5584bfb409..1d80115f5ce77a54eaf73fa70d11d4f294df378f 100644 --- a/camera_hdf/interfaces/hdi_ipc/config/provider/BUILD.gn +++ b/camera_hdf/interfaces/hdi_ipc/config/provider/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (C) 2021 Huawei Device Co., Ltd. +# Copyright (c) 2021 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/camera_hdf/interfaces/hdi_ipc/ipc_data_utils.h b/camera_hdf/interfaces/hdi_ipc/ipc_data_utils.h index e2a994ad4bf6d42b2b6da7ad5d5cd00d34285a47..0dd20fa476cb37ff71d6d99ffc377e2e4bc1dafa 100644 --- a/camera_hdf/interfaces/hdi_ipc/ipc_data_utils.h +++ b/camera_hdf/interfaces/hdi_ipc/ipc_data_utils.h @@ -43,7 +43,7 @@ public: bRet = (bRet && parcel.WriteInt32(static_cast(pInfo->width_))); bRet = (bRet && parcel.WriteInt32(static_cast(pInfo->height_))); bRet = (bRet && parcel.WriteInt32(static_cast(pInfo->format_))); - bRet = (bRet = (bRet && parcel.WriteInt32(pInfo->intent_))); + bRet = (bRet && parcel.WriteInt32(pInfo->intent_)); bRet = (bRet && parcel.WriteBool(pInfo->tunneledMode_)); bool bufferQueueFlag = (pInfo->bufferQueue_ != nullptr) ? true : false; bRet = (bRet && parcel.WriteBool(bufferQueueFlag)); diff --git a/camera_hdf/interfaces/hdi_ipc/server/operator/dstream_operator_callback_proxy.cpp b/camera_hdf/interfaces/hdi_ipc/server/operator/dstream_operator_callback_proxy.cpp index f8e68f7b2daaf35a36fbd6219943a9ca9c224103..979dffdcfdb71cda3cc410a933b6a14ef75e6f47 100644 --- a/camera_hdf/interfaces/hdi_ipc/server/operator/dstream_operator_callback_proxy.cpp +++ b/camera_hdf/interfaces/hdi_ipc/server/operator/dstream_operator_callback_proxy.cpp @@ -77,7 +77,7 @@ void DStreamOperatorCallbackProxy::OnCaptureEnded(int32_t captureId, auto captureEndInfo = info.at(i); bool bRet = data.WriteBuffer((void *)captureEndInfo.get(), sizeof(CaptureEndedInfo)); if (!bRet) { - DHLOGE("Write info index = %d failed.", i); + DHLOGE("Write info index = %zu failed.", i); return; } } @@ -115,7 +115,7 @@ void DStreamOperatorCallbackProxy::OnCaptureError(int32_t captureId, auto captureErrorInfo = info.at(i); bool bRet = data.WriteBuffer((void *)captureErrorInfo.get(), sizeof(CaptureErrorInfo)); if (!bRet) { - DHLOGE("Write info index = %d failed.", i); + DHLOGE("Write info index = %zu failed.", i); return; } } diff --git a/camera_hdf/interfaces/hdi_ipc/server/provider/dcamera_provider_callback_proxy.cpp b/camera_hdf/interfaces/hdi_ipc/server/provider/dcamera_provider_callback_proxy.cpp index a97e665ca07e1351d97e6c4db23f23d16ee17054..7a2208b71e077ae04c56edd90d73483c045b1a70 100644 --- a/camera_hdf/interfaces/hdi_ipc/server/provider/dcamera_provider_callback_proxy.cpp +++ b/camera_hdf/interfaces/hdi_ipc/server/provider/dcamera_provider_callback_proxy.cpp @@ -250,7 +250,7 @@ DCamRetCode DCameraProviderCallbackProxy::UpdateSettings(const std::shared_ptrindex_) || !reply.WriteInt32(dCamerabuffer->size_)) { @@ -169,11 +169,11 @@ int32_t DCameraProviderStub::DCProviderStubOnSettingsResult(MessageParcel& data, std::shared_ptr dCameraSettings = std::make_shared(); bool flag = data.ReadBool(); if (flag) { - IpcDataUtils::DecodeDCameraSettings(data, dCameraSettings); if (dCameraSettings == nullptr) { - DHLOGE("Read distributed camera settings failed."); + DHLOGE("Read distributed camera settings failed, dCameraSettings is null."); return HDF_FAILURE; } + IpcDataUtils::DecodeDCameraSettings(data, dCameraSettings); } DCamRetCode ret = dcameraProvider_->OnSettingsResult(dhBase, dCameraSettings); if (!reply.WriteInt32(static_cast(ret))) { @@ -195,11 +195,11 @@ int32_t DCameraProviderStub::DCProviderStubNotify(MessageParcel& data, MessagePa std::shared_ptr dCameraEvent = std::make_shared(); bool flag = data.ReadBool(); if (flag) { - IpcDataUtils::DecodeDCameraHDFEvent(data, dCameraEvent); if (dCameraEvent == nullptr) { - DHLOGE("Read distributed camera hdf event failed."); + DHLOGE("Read distributed camera hdf event failed, dCameraEvent is null."); return HDF_FAILURE; } + IpcDataUtils::DecodeDCameraHDFEvent(data, dCameraEvent); } DCamRetCode ret = dcameraProvider_->Notify(dhBase, dCameraEvent); if (!reply.WriteInt32(static_cast(ret))) { diff --git a/camera_hdf/interfaces/include/types.h b/camera_hdf/interfaces/include/types.h index ae00c5c1c00c87d941cdaab3c7d20bca9d8b1d61..3bb2d6bc5a86576e19f124cb3896798929298df1 100644 --- a/camera_hdf/interfaces/include/types.h +++ b/camera_hdf/interfaces/include/types.h @@ -267,7 +267,7 @@ using DCCaptureInfo = struct _DCCaptureInfo { /** * @brief Defines the inner buffer of the distributed camera, - * which is used to acquire buffer during procesing capture requests. + * which is used to acquire buffer during processing capture requests. */ using DCameraBuffer = struct _DCameraBuffer { /** diff --git a/common/BUILD.gn b/common/BUILD.gn index b8bb86a670cdbbe435f04c0cf9fdb659cb109d61..e3ec2a222bd2fa0e271a3a808e79ecdfb81c1ba2 100644 --- a/common/BUILD.gn +++ b/common/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (C) 2021 Huawei Device Co., Ltd. +# Copyright (c) 2021 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -12,7 +12,8 @@ # limitations under the License. import("//build/ohos.gni") -import("//foundation/distributedhardware/distributedcamera/distributedcamera.gni") +import( + "//foundation/distributedhardware/distributedcamera/distributedcamera.gni") ohos_shared_library("distributed_camera_utils") { include_dirs = [ @@ -35,8 +36,8 @@ ohos_shared_library("distributed_camera_utils") { ] deps = [ - "//utils/native/base:utils", "${fwk_utils_path}:distributedhardwareutils", + "//utils/native/base:utils", ] defines = [ diff --git a/interfaces/inner_kits/native_cpp/camera_sink/BUILD.gn b/interfaces/inner_kits/native_cpp/camera_sink/BUILD.gn index f6f5744a8690ecd140ee43d1d2685ed0517e8414..ea379967f915f47b37878d3cb19bb8642894a6a9 100644 --- a/interfaces/inner_kits/native_cpp/camera_sink/BUILD.gn +++ b/interfaces/inner_kits/native_cpp/camera_sink/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (C) 2021 Huawei Device Co., Ltd. +# Copyright (c) 2021 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/interfaces/inner_kits/native_cpp/camera_sink/src/dcamera_sink_handler_ipc.cpp b/interfaces/inner_kits/native_cpp/camera_sink/src/dcamera_sink_handler_ipc.cpp index e2ea209878ca6e4fb10721ba029b3464fa1f5559..cc8992eaa768d11c953e25c46233fd03f86cabdf 100644 --- a/interfaces/inner_kits/native_cpp/camera_sink/src/dcamera_sink_handler_ipc.cpp +++ b/interfaces/inner_kits/native_cpp/camera_sink/src/dcamera_sink_handler_ipc.cpp @@ -144,15 +144,17 @@ void DCameraSinkHandlerIpc::OnSinkLocalDmsDied(const wptr& remote void DCameraSinkHandlerIpc::OnSinkLocalDmsDied(const sptr& remote) { std::lock_guard autoLock(sinkLocalDmsLock_); + if (localSink_ == nullptr) { + DHLOGE("DCameraSinkHandlerIpc::OnSinkLocalDmsDied, localSink is null."); + return; + } if (localSink_->AsObject() != remote) { - DHLOGI("OnSinkLocalDmsDied not found remote object"); + DHLOGI("OnSinkLocalDmsDied not found remote object."); return; } DHLOGI("OnSinkLocalDmsDied Clear"); - if (localSink_ != nullptr) { - localSink_->AsObject()->RemoveDeathRecipient(sinkLocalRecipient_); - } + localSink_->AsObject()->RemoveDeathRecipient(sinkLocalRecipient_); localSink_ = nullptr; } } // namespace DistributedHardware diff --git a/interfaces/inner_kits/native_cpp/camera_source/BUILD.gn b/interfaces/inner_kits/native_cpp/camera_source/BUILD.gn index f0d2ff91fccb4d7f34f9e93472313aeae761e520..50cc17a13efdf4e753f4b26c69a974b7283b415f 100644 --- a/interfaces/inner_kits/native_cpp/camera_source/BUILD.gn +++ b/interfaces/inner_kits/native_cpp/camera_source/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (C) 2021 Huawei Device Co., Ltd. +# Copyright (c) 2021 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/interfaces/inner_kits/native_cpp/camera_source/src/dcamera_source_handler_ipc.cpp b/interfaces/inner_kits/native_cpp/camera_source/src/dcamera_source_handler_ipc.cpp index d8eae04f237b8092828e772e6945d61d6777ba5f..0964d6663e6461cf32cbab099e2d2ce0304882af 100644 --- a/interfaces/inner_kits/native_cpp/camera_source/src/dcamera_source_handler_ipc.cpp +++ b/interfaces/inner_kits/native_cpp/camera_source/src/dcamera_source_handler_ipc.cpp @@ -144,15 +144,17 @@ void DCameraSourceHandlerIpc::OnSourceLocalDmsDied(const wptr& re void DCameraSourceHandlerIpc::OnSourceLocalDmsDied(const sptr& remote) { std::lock_guard autoLock(sourceLocalDmsLock_); + if (localSource_ == nullptr) { + DHLOGE("DCameraSourceHandlerIpc::OnSourceLocalDmsDied, localSource is null."); + return; + } if (localSource_->AsObject() != remote) { - DHLOGI("OnSourceLocalDmsDied not found remote object"); + DHLOGI("OnSourceLocalDmsDied not found remote object."); return; } DHLOGI("OnSourceLocalDmsDied Clear"); - if (localSource_ != nullptr) { - localSource_->AsObject()->RemoveDeathRecipient(sourceLocalRecipient_); - } + localSource_->AsObject()->RemoveDeathRecipient(sourceLocalRecipient_); localSource_ = nullptr; } } // namespace DistributedHardware diff --git a/sa_profile/4803.xml b/sa_profile/4803.xml index 32f4655ed666db10b17626b22c9ed9194a30d5f4..d5e5bfaa79df8b30d30d9469d155311bc7fb6f81 100644 --- a/sa_profile/4803.xml +++ b/sa_profile/4803.xml @@ -1,6 +1,6 @@ dhardware - + 4803 libdistributed_camera_source.z.so diff --git a/sa_profile/4804.xml b/sa_profile/4804.xml index d01ba6594c8a1c63cf331fad2d651fba93d91023..f0e705748d635b5c4a7b93e0fa6ed41666f746d1 100644 --- a/sa_profile/4804.xml +++ b/sa_profile/4804.xml @@ -1,6 +1,6 @@ dhardware - + 4804 libdistributed_camera_sink.z.so diff --git a/services/cameraservice/cameraoperator/client/BUILD.gn b/services/cameraservice/cameraoperator/client/BUILD.gn index 3bd8ed81973cc29e696c1ebe4d8bb0d2dc6805fb..ca1797d8347232575536dfd3e854d79af70fcba9 100644 --- a/services/cameraservice/cameraoperator/client/BUILD.gn +++ b/services/cameraservice/cameraoperator/client/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (C) 2021 Huawei Device Co., Ltd. +# Copyright (c) 2021 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/services/cameraservice/cameraoperator/client/include/callback/dcamera_input_callback.h b/services/cameraservice/cameraoperator/client/include/callback/dcamera_input_callback.h index e29fcc708aeed4f2f490c3e267ce1ed358eb78cd..52c11d3d4e979abea324641e86202896085d3c21 100644 --- a/services/cameraservice/cameraoperator/client/include/callback/dcamera_input_callback.h +++ b/services/cameraservice/cameraoperator/client/include/callback/dcamera_input_callback.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/services/cameraservice/cameraoperator/client/include/callback/dcamera_manager_callback.h b/services/cameraservice/cameraoperator/client/include/callback/dcamera_manager_callback.h index b6f35f3f9032c5f2916aeb5281d70c6267580e72..6d2aa46d15394ff0720c292ddab58f95f5740b54 100644 --- a/services/cameraservice/cameraoperator/client/include/callback/dcamera_manager_callback.h +++ b/services/cameraservice/cameraoperator/client/include/callback/dcamera_manager_callback.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/services/cameraservice/cameraoperator/client/include/callback/dcamera_photo_callback.h b/services/cameraservice/cameraoperator/client/include/callback/dcamera_photo_callback.h index 5cc4804db18f43a51e6d74899bb9014d6078ff08..9e8bd2118d58bb71f40a4879a444962b8caf544f 100644 --- a/services/cameraservice/cameraoperator/client/include/callback/dcamera_photo_callback.h +++ b/services/cameraservice/cameraoperator/client/include/callback/dcamera_photo_callback.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/services/cameraservice/cameraoperator/client/include/callback/dcamera_preview_callback.h b/services/cameraservice/cameraoperator/client/include/callback/dcamera_preview_callback.h index c38caccf01ca7675d1483872b2944c4507692946..a215c184d6c9df05212ed8a0a5d7024093af518c 100644 --- a/services/cameraservice/cameraoperator/client/include/callback/dcamera_preview_callback.h +++ b/services/cameraservice/cameraoperator/client/include/callback/dcamera_preview_callback.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/services/cameraservice/cameraoperator/client/include/callback/dcamera_session_callback.h b/services/cameraservice/cameraoperator/client/include/callback/dcamera_session_callback.h index 343d1c2ad5d6ceb6e1f88be3e7ac64c284d11c77..841a0424a30a76510a44269d756aadda177151f8 100644 --- a/services/cameraservice/cameraoperator/client/include/callback/dcamera_session_callback.h +++ b/services/cameraservice/cameraoperator/client/include/callback/dcamera_session_callback.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/services/cameraservice/cameraoperator/client/include/callback/dcamera_video_callback.h b/services/cameraservice/cameraoperator/client/include/callback/dcamera_video_callback.h index 6f82f1599b8947877e39b0b2f7d59fa68680ddb3..ff7cdec1d96bafe010c4470c6339bf63ebca9a59 100644 --- a/services/cameraservice/cameraoperator/client/include/callback/dcamera_video_callback.h +++ b/services/cameraservice/cameraoperator/client/include/callback/dcamera_video_callback.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/services/cameraservice/cameraoperator/client/include/dcamera_client.h b/services/cameraservice/cameraoperator/client/include/dcamera_client.h index 73591141e0da342f324f07299fe3d723f79fa925..f355d2f3e083050e5ac9dba12915a3efc909ed2a 100644 --- a/services/cameraservice/cameraoperator/client/include/dcamera_client.h +++ b/services/cameraservice/cameraoperator/client/include/dcamera_client.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/services/cameraservice/cameraoperator/client/include/icamera_operator.h b/services/cameraservice/cameraoperator/client/include/icamera_operator.h index 6f787d36bcba80d93580a8c0ed10ec71a737997b..e349339d96d5626039b2adc6d97fd118353fad2e 100644 --- a/services/cameraservice/cameraoperator/client/include/icamera_operator.h +++ b/services/cameraservice/cameraoperator/client/include/icamera_operator.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/services/cameraservice/cameraoperator/client/include/listener/dcamera_photo_surface_listener.h b/services/cameraservice/cameraoperator/client/include/listener/dcamera_photo_surface_listener.h index 54a9e50cb690340cb1d279a4919df5a4baf3a480..72f77a68d52603f59b0d0bd759d10f06556ac746 100644 --- a/services/cameraservice/cameraoperator/client/include/listener/dcamera_photo_surface_listener.h +++ b/services/cameraservice/cameraoperator/client/include/listener/dcamera_photo_surface_listener.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/services/cameraservice/cameraoperator/client/include/listener/dcamera_video_surface_listener.h b/services/cameraservice/cameraoperator/client/include/listener/dcamera_video_surface_listener.h index c1bae897605c0f43e6594d4359f56b06cfec8e43..6e06a7e1c39d7f759ebb3e7657086e9471f490b0 100644 --- a/services/cameraservice/cameraoperator/client/include/listener/dcamera_video_surface_listener.h +++ b/services/cameraservice/cameraoperator/client/include/listener/dcamera_video_surface_listener.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/services/cameraservice/cameraoperator/client/src/callback/dcamera_input_callback.cpp b/services/cameraservice/cameraoperator/client/src/callback/dcamera_input_callback.cpp index e915aac55ee7b61f32aa0a088c3730570b8bece4..8d980fd504c640e5ff5e2884148fbba2ee410fa7 100644 --- a/services/cameraservice/cameraoperator/client/src/callback/dcamera_input_callback.cpp +++ b/services/cameraservice/cameraoperator/client/src/callback/dcamera_input_callback.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/services/cameraservice/cameraoperator/client/src/callback/dcamera_manager_callback.cpp b/services/cameraservice/cameraoperator/client/src/callback/dcamera_manager_callback.cpp index 0f3865d72d16cbec413c609890bd2eae5341987c..f65adf08f51fca3840e0b403266a38d565a5a91d 100644 --- a/services/cameraservice/cameraoperator/client/src/callback/dcamera_manager_callback.cpp +++ b/services/cameraservice/cameraoperator/client/src/callback/dcamera_manager_callback.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/services/cameraservice/cameraoperator/client/src/callback/dcamera_photo_callback.cpp b/services/cameraservice/cameraoperator/client/src/callback/dcamera_photo_callback.cpp index 62f283ef5082f459a6cd5ae741f1ffef0a13d853..1ad5ca507ca09325956e0dcdb6c82f358f9bad5a 100644 --- a/services/cameraservice/cameraoperator/client/src/callback/dcamera_photo_callback.cpp +++ b/services/cameraservice/cameraoperator/client/src/callback/dcamera_photo_callback.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/services/cameraservice/cameraoperator/client/src/callback/dcamera_preview_callback.cpp b/services/cameraservice/cameraoperator/client/src/callback/dcamera_preview_callback.cpp index 1eb36092b0fb089038972ffb14b6b7b65eb5fd08..06aeef6577772c32f961233609c22457793c485b 100644 --- a/services/cameraservice/cameraoperator/client/src/callback/dcamera_preview_callback.cpp +++ b/services/cameraservice/cameraoperator/client/src/callback/dcamera_preview_callback.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/services/cameraservice/cameraoperator/client/src/callback/dcamera_session_callback.cpp b/services/cameraservice/cameraoperator/client/src/callback/dcamera_session_callback.cpp index d26fb922f89084c6464041c83f9a87429c705e6d..a1b1aee616a65712b95ce28b376f0066cf25a8d8 100644 --- a/services/cameraservice/cameraoperator/client/src/callback/dcamera_session_callback.cpp +++ b/services/cameraservice/cameraoperator/client/src/callback/dcamera_session_callback.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/services/cameraservice/cameraoperator/client/src/callback/dcamera_video_callback.cpp b/services/cameraservice/cameraoperator/client/src/callback/dcamera_video_callback.cpp index 8adb9731a28fd2a4103e85a3d612dc05c60ebd79..2e938fa91c390d8a8c37b826cc01e463a09c0a07 100644 --- a/services/cameraservice/cameraoperator/client/src/callback/dcamera_video_callback.cpp +++ b/services/cameraservice/cameraoperator/client/src/callback/dcamera_video_callback.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/services/cameraservice/cameraoperator/client/src/dcamera_client.cpp b/services/cameraservice/cameraoperator/client/src/dcamera_client.cpp index e52b396661f3f4f80819086408c7166fe3accf3e..462b99a7391a24542b7d7edac517328ef3ad8f6a 100644 --- a/services/cameraservice/cameraoperator/client/src/dcamera_client.cpp +++ b/services/cameraservice/cameraoperator/client/src/dcamera_client.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/services/cameraservice/cameraoperator/client/src/dcamera_client_common.cpp b/services/cameraservice/cameraoperator/client/src/dcamera_client_common.cpp index b87edf7dfe2a549d00b71dd830c0dbbc2ee712fe..2a026d4f32b5e31e54a45f662cd4a427eafe726e 100644 --- a/services/cameraservice/cameraoperator/client/src/dcamera_client_common.cpp +++ b/services/cameraservice/cameraoperator/client/src/dcamera_client_common.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/services/cameraservice/cameraoperator/client/src/listener/dcamera_photo_surface_listener.cpp b/services/cameraservice/cameraoperator/client/src/listener/dcamera_photo_surface_listener.cpp index 7a2ea6c400de0e27180efca9ad6c2c9fb71bdfb2..29cbed9dabf567a51cbbb6f3267e3bf7f974bac7 100644 --- a/services/cameraservice/cameraoperator/client/src/listener/dcamera_photo_surface_listener.cpp +++ b/services/cameraservice/cameraoperator/client/src/listener/dcamera_photo_surface_listener.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/services/cameraservice/cameraoperator/client/src/listener/dcamera_photo_surface_listener_common.cpp b/services/cameraservice/cameraoperator/client/src/listener/dcamera_photo_surface_listener_common.cpp index 3c60a198d82906ddbbefb1801f32e12580ccaac7..0fbb10aede44447066f852027635419127c5bb57 100644 --- a/services/cameraservice/cameraoperator/client/src/listener/dcamera_photo_surface_listener_common.cpp +++ b/services/cameraservice/cameraoperator/client/src/listener/dcamera_photo_surface_listener_common.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/services/cameraservice/cameraoperator/client/src/listener/dcamera_video_surface_listener.cpp b/services/cameraservice/cameraoperator/client/src/listener/dcamera_video_surface_listener.cpp index 8d7865e396fd48a6c4983d55bde45d8b69127364..b2c2f8113ad6103d7abf5c008a476a73d7ffbb6c 100644 --- a/services/cameraservice/cameraoperator/client/src/listener/dcamera_video_surface_listener.cpp +++ b/services/cameraservice/cameraoperator/client/src/listener/dcamera_video_surface_listener.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/services/cameraservice/cameraoperator/client/src/listener/dcamera_video_surface_listener_common.cpp b/services/cameraservice/cameraoperator/client/src/listener/dcamera_video_surface_listener_common.cpp index 19dc37b86ec5f5bc87ab2c1b18be5c9f0250a813..b372140ffff91cad8947a8370e7a03cbcb44e766 100644 --- a/services/cameraservice/cameraoperator/client/src/listener/dcamera_video_surface_listener_common.cpp +++ b/services/cameraservice/cameraoperator/client/src/listener/dcamera_video_surface_listener_common.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/services/cameraservice/cameraoperator/handler/BUILD.gn b/services/cameraservice/cameraoperator/handler/BUILD.gn index f3f6d8137cee3a85a7f1fbf959259d251fc305e1..db4f68da0467a27a4b9a04be23a6b32589813795 100644 --- a/services/cameraservice/cameraoperator/handler/BUILD.gn +++ b/services/cameraservice/cameraoperator/handler/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (C) 2021 Huawei Device Co., Ltd. +# Copyright (c) 2021 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/services/cameraservice/cameraoperator/handler/include/dcamera_handler.h b/services/cameraservice/cameraoperator/handler/include/dcamera_handler.h index 45f51089c48b40127f923c89142924048f16bbe8..9b6d5923e284902c1b801e64fbe2d16675ea1282 100644 --- a/services/cameraservice/cameraoperator/handler/include/dcamera_handler.h +++ b/services/cameraservice/cameraoperator/handler/include/dcamera_handler.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/services/cameraservice/cameraoperator/handler/src/dcamera_handler.cpp b/services/cameraservice/cameraoperator/handler/src/dcamera_handler.cpp index 116029dbb10a7c4a55ae80f3660d389aa4788232..c9c29b774a79f2f3fb0c233231d0279c888fa208 100644 --- a/services/cameraservice/cameraoperator/handler/src/dcamera_handler.cpp +++ b/services/cameraservice/cameraoperator/handler/src/dcamera_handler.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/services/cameraservice/cameraoperator/handler/src/dcamera_handler_common.cpp b/services/cameraservice/cameraoperator/handler/src/dcamera_handler_common.cpp index 837e62aa2814530b0d5bbddd801e72d3d4e5ab73..6836404a8fb5e719f4ddba8bf94fa3fd9ab15d7c 100644 --- a/services/cameraservice/cameraoperator/handler/src/dcamera_handler_common.cpp +++ b/services/cameraservice/cameraoperator/handler/src/dcamera_handler_common.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/services/cameraservice/sinkservice/BUILD.gn b/services/cameraservice/sinkservice/BUILD.gn index 5cd3337aa0aa8cea12cb42cfeb965e2988df0149..2ce72ccf8479a53fe88c5f709b3256f5fefa3077 100644 --- a/services/cameraservice/sinkservice/BUILD.gn +++ b/services/cameraservice/sinkservice/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (C) 2021 Huawei Device Co., Ltd. +# Copyright (c) 2021 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/services/cameraservice/sinkservice/test/unittest/common/distributedcameramgr/mock_camera_channel.h b/services/cameraservice/sinkservice/test/unittest/common/distributedcameramgr/mock_camera_channel.h index 31154308ecd767a80a984990b48a9453e0adeff4..412eabffa83bc96a066d54c72de3e32ee7afe568 100644 --- a/services/cameraservice/sinkservice/test/unittest/common/distributedcameramgr/mock_camera_channel.h +++ b/services/cameraservice/sinkservice/test/unittest/common/distributedcameramgr/mock_camera_channel.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/services/cameraservice/sinkservice/test/unittest/common/distributedcameramgr/mock_camera_operator.h b/services/cameraservice/sinkservice/test/unittest/common/distributedcameramgr/mock_camera_operator.h index 0a931b3c1abfc3944318953ee70b89f310425e18..340a683f56e6532a68fcbb0c36f751b9bede7e05 100644 --- a/services/cameraservice/sinkservice/test/unittest/common/distributedcameramgr/mock_camera_operator.h +++ b/services/cameraservice/sinkservice/test/unittest/common/distributedcameramgr/mock_camera_operator.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/services/cameraservice/sinkservice/test/unittest/common/distributedcameramgr/mock_data_process_pipeline.h b/services/cameraservice/sinkservice/test/unittest/common/distributedcameramgr/mock_data_process_pipeline.h index 767f941a392910a898cc85ff90150133bdd2aa01..b5ba33741e1170ed4b094b5500fd9472f18714df 100644 --- a/services/cameraservice/sinkservice/test/unittest/common/distributedcameramgr/mock_data_process_pipeline.h +++ b/services/cameraservice/sinkservice/test/unittest/common/distributedcameramgr/mock_data_process_pipeline.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/services/cameraservice/sinkservice/test/unittest/common/distributedcameramgr/mock_dcamera_sink_controller.h b/services/cameraservice/sinkservice/test/unittest/common/distributedcameramgr/mock_dcamera_sink_controller.h index 39a67d4e66ea196a6ec3e2d0dab26414e5b3c129..c4c540006e6c2414aecaec3d8e0185ed25507b24 100644 --- a/services/cameraservice/sinkservice/test/unittest/common/distributedcameramgr/mock_dcamera_sink_controller.h +++ b/services/cameraservice/sinkservice/test/unittest/common/distributedcameramgr/mock_dcamera_sink_controller.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/services/cameraservice/sinkservice/test/unittest/common/distributedcameramgr/mock_dcamera_sink_data_process.h b/services/cameraservice/sinkservice/test/unittest/common/distributedcameramgr/mock_dcamera_sink_data_process.h index f8e7217cfc6c6430ee19318fa8a879564f47d43a..5380937532e33c946ff9efb79eff756248106b5a 100644 --- a/services/cameraservice/sinkservice/test/unittest/common/distributedcameramgr/mock_dcamera_sink_data_process.h +++ b/services/cameraservice/sinkservice/test/unittest/common/distributedcameramgr/mock_dcamera_sink_data_process.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/services/cameraservice/sinkservice/test/unittest/common/distributedcameramgr/mock_dcamera_sink_output.h b/services/cameraservice/sinkservice/test/unittest/common/distributedcameramgr/mock_dcamera_sink_output.h index f2b9a6398910c821c40a96b9377bc0ff8be7c1e6..ff03666452bd4663594635d88d527021db052df2 100644 --- a/services/cameraservice/sinkservice/test/unittest/common/distributedcameramgr/mock_dcamera_sink_output.h +++ b/services/cameraservice/sinkservice/test/unittest/common/distributedcameramgr/mock_dcamera_sink_output.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/services/cameraservice/sourceservice/BUILD.gn b/services/cameraservice/sourceservice/BUILD.gn index 54b3d77204bd3843e87d2f238f072b9a4df3c960..8f53c80dc8be0b59c64408fbb07e004dac756646 100644 --- a/services/cameraservice/sourceservice/BUILD.gn +++ b/services/cameraservice/sourceservice/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (C) 2021 Huawei Device Co., Ltd. +# Copyright (c) 2021 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -13,7 +13,8 @@ import("//build/ohos.gni") import("//build/ohos_var.gni") -import("//foundation/distributedhardware/distributedcamera/distributedcamera.gni") +import( + "//foundation/distributedhardware/distributedcamera/distributedcamera.gni") ohos_shared_library("distributed_camera_source") { include_dirs = [ @@ -52,47 +53,46 @@ ohos_shared_library("distributed_camera_source") { ] sources = [ - "src/distributedcamera/dcamera_service_state_listener.cpp", - "src/distributedcamera/distributed_camera_source_service.cpp", - "${innerkits_path}/native_cpp/camera_sink/src/distributed_camera_sink_proxy.cpp", - "src/distributedcamera/distributed_camera_source_stub.cpp", - "src/distributedcamera/dcamera_source_callback_proxy.cpp", - "src/distributedcameramgr/dcamera_source_dev.cpp", - "src/distributedcameramgr/dcamera_source_event.cpp", - "src/distributedcameramgr/dcamera_source_service_ipc.cpp", - "src/distributedcameramgr/dcamerastate/dcamera_source_state_factory.cpp", - "src/distributedcameramgr/dcamerastate/dcamera_source_state_machine.cpp", - "src/distributedcameramgr/dcamerastate/dcamera_source_init_state.cpp", - "src/distributedcameramgr/dcamerastate/dcamera_source_regist_state.cpp", - "src/distributedcameramgr/dcamerastate/dcamera_source_opened_state.cpp", - "src/distributedcameramgr/dcamerastate/dcamera_source_config_stream_state.cpp", - "src/distributedcameramgr/dcamerastate/dcamera_source_capture_state.cpp", - "src/distributedcameramgr/dcameracontrol/dcamera_source_controller.cpp", - "src/distributedcameramgr/dcameracontrol/dcamera_source_controller_channel_listener.cpp", - "${services_path}/cameraservice/base/src/dcamera_capture_info_cmd.cpp", - "${services_path}/cameraservice/base/src/dcamera_channel_info_cmd.cpp", - "${services_path}/cameraservice/base/src/dcamera_event_cmd.cpp", - "${services_path}/cameraservice/base/src/dcamera_info_cmd.cpp", - "${services_path}/cameraservice/base/src/dcamera_metadata_setting_cmd.cpp", - "${services_path}/cameraservice/base/src/dcamera_open_info_cmd.cpp", - - "src/distributedcameramgr/dcameradata/dcamera_source_data_process.cpp", - "src/distributedcameramgr/dcameradata/dcamera_source_input_channel_listener.cpp", - "src/distributedcameramgr/dcameradata/dcamera_source_input.cpp", - "src/distributedcameramgr/dcameradata/dcamera_stream_data_process_pipeline_listener.cpp", - "src/distributedcameramgr/dcameradata/dcamera_stream_data_process_producer.cpp", - "src/distributedcameramgr/dcameradata/dcamera_stream_data_process.cpp", - "src/distributedcameramgr/dcamerahdf/dcamera_provider_callback_impl.cpp", + "${innerkits_path}/native_cpp/camera_sink/src/distributed_camera_sink_proxy.cpp", + "${services_path}/cameraservice/base/src/dcamera_capture_info_cmd.cpp", + "${services_path}/cameraservice/base/src/dcamera_channel_info_cmd.cpp", + "${services_path}/cameraservice/base/src/dcamera_event_cmd.cpp", + "${services_path}/cameraservice/base/src/dcamera_info_cmd.cpp", + "${services_path}/cameraservice/base/src/dcamera_metadata_setting_cmd.cpp", + "${services_path}/cameraservice/base/src/dcamera_open_info_cmd.cpp", + "src/distributedcamera/dcamera_service_state_listener.cpp", + "src/distributedcamera/dcamera_source_callback_proxy.cpp", + "src/distributedcamera/distributed_camera_source_service.cpp", + "src/distributedcamera/distributed_camera_source_stub.cpp", + "src/distributedcameramgr/dcamera_source_dev.cpp", + "src/distributedcameramgr/dcamera_source_event.cpp", + "src/distributedcameramgr/dcamera_source_service_ipc.cpp", + "src/distributedcameramgr/dcameracontrol/dcamera_source_controller.cpp", + "src/distributedcameramgr/dcameracontrol/dcamera_source_controller_channel_listener.cpp", + "src/distributedcameramgr/dcameradata/dcamera_source_data_process.cpp", + "src/distributedcameramgr/dcameradata/dcamera_source_input.cpp", + "src/distributedcameramgr/dcameradata/dcamera_source_input_channel_listener.cpp", + "src/distributedcameramgr/dcameradata/dcamera_stream_data_process.cpp", + "src/distributedcameramgr/dcameradata/dcamera_stream_data_process_pipeline_listener.cpp", + "src/distributedcameramgr/dcameradata/dcamera_stream_data_process_producer.cpp", + "src/distributedcameramgr/dcamerahdf/dcamera_provider_callback_impl.cpp", + "src/distributedcameramgr/dcamerastate/dcamera_source_capture_state.cpp", + "src/distributedcameramgr/dcamerastate/dcamera_source_config_stream_state.cpp", + "src/distributedcameramgr/dcamerastate/dcamera_source_init_state.cpp", + "src/distributedcameramgr/dcamerastate/dcamera_source_opened_state.cpp", + "src/distributedcameramgr/dcamerastate/dcamera_source_regist_state.cpp", + "src/distributedcameramgr/dcamerastate/dcamera_source_state_factory.cpp", + "src/distributedcameramgr/dcamerastate/dcamera_source_state_machine.cpp", ] deps = [ - "${fwk_utils_path}:distributedhardwareutils", "${common_path}:distributed_camera_utils", + "${distributedcamera_hdf_path}/interfaces/hdi_ipc/client:distributed_camera_hdf_client", + "${fwk_utils_path}:distributedhardwareutils", "${services_path}/channel:distributed_camera_channel", "${services_path}/data_process:distributed_camera_data_process", - "${distributedcamera_hdf_path}/interfaces/hdi_ipc/client:distributed_camera_hdf_client", - "//utils/native/base:utils", "//third_party/jsoncpp:jsoncpp", + "//utils/native/base:utils", ] defines = [ @@ -112,4 +112,4 @@ ohos_shared_library("distributed_camera_source") { subsystem_name = "distributedhardware" part_name = "distributed_camera" -} \ No newline at end of file +} diff --git a/services/cameraservice/sourceservice/src/distributedcamera/distributed_camera_source_stub.cpp b/services/cameraservice/sourceservice/src/distributedcamera/distributed_camera_source_stub.cpp index 66ca5efdfcb91185288380b2c30e7fc46ff6489e..313a5a744a4083daba68dab5fddec6512b56bc01 100644 --- a/services/cameraservice/sourceservice/src/distributedcamera/distributed_camera_source_stub.cpp +++ b/services/cameraservice/sourceservice/src/distributedcamera/distributed_camera_source_stub.cpp @@ -36,7 +36,7 @@ DistributedCameraSourceStub::~DistributedCameraSourceStub() int32_t DistributedCameraSourceStub::OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) { - DHLOGI("DistributedCameraSourceStub OnRemoteRequest code: %d", code); + DHLOGI("DistributedCameraSourceStub OnRemoteRequest code: %u", code); std::u16string desc = DistributedCameraSourceStub::GetDescriptor(); std::u16string remoteDesc = data.ReadInterfaceToken(); if (desc != remoteDesc) { diff --git a/services/cameraservice/sourceservice/src/distributedcameramgr/dcameracontrol/dcamera_source_controller.cpp b/services/cameraservice/sourceservice/src/distributedcameramgr/dcameracontrol/dcamera_source_controller.cpp index 6902c43f4eefae0ebe6cc23ddb89e3327b312c95..489b17d5bad7a2404bf559339817bd1d984b5d96 100644 --- a/services/cameraservice/sourceservice/src/distributedcameramgr/dcameracontrol/dcamera_source_controller.cpp +++ b/services/cameraservice/sourceservice/src/distributedcameramgr/dcameracontrol/dcamera_source_controller.cpp @@ -71,7 +71,7 @@ int32_t DCameraSourceController::StartCapture(std::vectorbufLen; - if (dataLen <= 0 || dataLen > (int32_t)DCAMERA_MAX_RECV_DATA_LEN || data == nullptr) { + if (dataLen <= 0 || dataLen > (int32_t)DCAMERA_MAX_RECV_DATA_LEN) { DHLOGE("DCameraSoftbusAdapter OnSourceStreamReceived dataLen: %d, sessionId: %d", dataLen, sessionId); return; } @@ -450,8 +454,12 @@ void DCameraSoftbusAdapter::OnSinkMessageReceived(int32_t sessionId, const void void DCameraSoftbusAdapter::OnSinkStreamReceived(int32_t sessionId, const StreamData *data, const StreamData *ext, const StreamFrameInfo *param) { + if (data == nullptr) { + DHLOGE("DCameraSoftbusAdapter::OnSinkStreamReceived, data is null, sessionId: %d.", sessionId); + return; + } int32_t dataLen = data->bufLen; - if (dataLen <= 0 || dataLen > (int32_t)DCAMERA_MAX_RECV_DATA_LEN || data == nullptr) { + if (dataLen <= 0 || dataLen > (int32_t)DCAMERA_MAX_RECV_DATA_LEN) { DHLOGE("DCameraSoftbusAdapter OnSinkStreamReceived dataLen: %d sessionId: %d", dataLen, sessionId); return; } diff --git a/services/data_process/BUILD.gn b/services/data_process/BUILD.gn index bd5419a5d79495cf3ca9bada17e6c90d4f6f5fe1..62990b3e193af96de77e22408d10d548eacce87c 100644 --- a/services/data_process/BUILD.gn +++ b/services/data_process/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (C) 2021 Huawei Device Co., Ltd. +# Copyright (c) 2021 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/services/data_process/src/pipeline_node/fpscontroller/fps_controller_process.cpp b/services/data_process/src/pipeline_node/fpscontroller/fps_controller_process.cpp index e86d338a351c0c379dd94f597b330a7d3e9acd8d..daadcf5f7f1b1522f635459be07eecee3fd58575 100644 --- a/services/data_process/src/pipeline_node/fpscontroller/fps_controller_process.cpp +++ b/services/data_process/src/pipeline_node/fpscontroller/fps_controller_process.cpp @@ -75,7 +75,7 @@ int32_t FpsControllerProcess::ProcessData(std::vectorFindInt64("timeUs", timeStampUs)) { - DHLOGE("Find decoder output timestamp fail."); + DHLOGE("Find decoder output timestamp failed."); return DCAMERA_BAD_TYPE; } @@ -270,7 +270,7 @@ bool FpsControllerProcess::ReduceFrameRateByUniformStrategy(int32_t incomingFrmR if (overshoot && DOUBLE_MULTIPLE * overshoot < incomingFrmRate) { /* * When the actual input frame rate is less than or equal to twice the target frame rate, - * one frame is droped every (incomingFrmRate / overshoot) frames. + * one frame is dropped every (incomingFrmRate / overshoot) frames. */ if (keepMoreThanDoubleCount_) { keepMoreThanDoubleCount_ = 0; @@ -314,7 +314,7 @@ int32_t FpsControllerProcess::FpsControllerDone(std::vectorProcessData(outputBuffers); if (err != DCAMERA_OK) { - DHLOGE("Someone node after the FpsController processes fail."); + DHLOGE("Someone node after the FpsController processes failed."); } return err; } diff --git a/services/data_process/src/pipeline_node/multimedia_codec/decode_data_process.cpp b/services/data_process/src/pipeline_node/multimedia_codec/decode_data_process.cpp index 3491d99316bb1fbecb98ec249cef17a0aa0ec65d..da8a0af7326666615ef8a981c76977b0d08a65de 100644 --- a/services/data_process/src/pipeline_node/multimedia_codec/decode_data_process.cpp +++ b/services/data_process/src/pipeline_node/multimedia_codec/decode_data_process.cpp @@ -53,7 +53,7 @@ int32_t DecodeDataProcess::InitNode() InitCodecEvent(); int32_t err = InitDecoder(); if (err != DCAMERA_OK) { - DHLOGE("Init video decoder fail."); + DHLOGE("Init video decoder failed."); ReleaseProcessNode(); return err; } @@ -101,7 +101,7 @@ int32_t DecodeDataProcess::InitDecoder() DHLOGD("Init video decoder."); int32_t err = InitDecoderMetadataFormat(); if (err != DCAMERA_OK) { - DHLOGE("Init video decoder metadata format fail."); + DHLOGE("Init video decoder metadata format failed."); return err; } @@ -123,7 +123,7 @@ int32_t DecodeDataProcess::InitDecoder() } retVal = SetDecoderOutputSurface(); if (retVal != DCAMERA_OK) { - DHLOGE("Set decoder output surface fail."); + DHLOGE("Set decoder output surface failed."); return retVal; } @@ -174,7 +174,7 @@ int32_t DecodeDataProcess::SetDecoderOutputSurface() decodeConsumerSurface_ = Surface::CreateSurfaceAsConsumer(); if (decodeConsumerSurface_ == nullptr) { - DHLOGE("Creat the decode consumer surface fail."); + DHLOGE("Create the decode consumer surface failed."); return DCAMERA_INIT_ERR; } decodeConsumerSurface_->SetDefaultWidthAndHeight((int32_t)sourceConfig_.GetWidth(), @@ -182,25 +182,25 @@ int32_t DecodeDataProcess::SetDecoderOutputSurface() decodeSurfaceListener_ = new DecodeSurfaceListener(decodeConsumerSurface_, shared_from_this()); if (decodeConsumerSurface_->RegisterConsumerListener(decodeSurfaceListener_) != SURFACE_ERROR_OK) { - DHLOGE("Register consumer listener fail."); + DHLOGE("Register consumer listener failed."); return DCAMERA_INIT_ERR; } sptr surfaceProducer = decodeConsumerSurface_->GetProducer(); if (surfaceProducer == nullptr) { - DHLOGE("Get the surface producer of the decode consumer surface fail."); + DHLOGE("Get the surface producer of the decode consumer surface failed."); return DCAMERA_INIT_ERR; } decodeProducerSurface_ = Surface::CreateSurfaceAsProducer(surfaceProducer); if (decodeProducerSurface_ == nullptr) { - DHLOGE("Creat the decode producer surface of the decode consumer surface fail."); + DHLOGE("Create the decode producer surface of the decode consumer surface failed."); return DCAMERA_INIT_ERR; } DHLOGD("Set the producer surface to video decoder output surface."); int32_t err = videoDecoder_->SetOutputSurface(decodeProducerSurface_); if (err != Media::MediaServiceErrCode::MSERR_OK) { - DHLOGE("Set decoder output surface fail."); + DHLOGE("Set decoder output surface failed."); return DCAMERA_INIT_ERR; } return DCAMERA_OK; @@ -277,7 +277,7 @@ int32_t DecodeDataProcess::ProcessData(std::vector>& return DCAMERA_INDEX_OVERFLOW; } if (inputBuffers[0]->Size() > MAX_YUV420_BUFFER_SIZE) { - DHLOGE("DecodeNode input buffer size %d error.", inputBuffers[0]->Size()); + DHLOGE("DecodeNode input buffer size %zu error.", inputBuffers[0]->Size()); return DCAMERA_MEMORY_OPT_ERROR; } if (!isDecoderProcess_) { @@ -285,12 +285,12 @@ int32_t DecodeDataProcess::ProcessData(std::vector>& return DCAMERA_DISABLE_PROCESS; } inputBuffersQueue_.push(inputBuffers[0]); - DHLOGD("Push inputBuffer sucess. BufSize %d, QueueSize %d.", inputBuffers[0]->Size(), inputBuffersQueue_.size()); + DHLOGD("Push inputBuf sucess. BufSize %zu, QueueSize %zu.", inputBuffers[0]->Size(), inputBuffersQueue_.size()); int32_t err = FeedDecoderInputBuffer(); if (err != DCAMERA_OK) { int32_t sleepTimeUs = 5000; std::this_thread::sleep_for(std::chrono::microseconds(sleepTimeUs)); - DHLOGD("Feed decoder input buffer fail. Try FeedDecoderInputBuffer again."); + DHLOGD("Feed decoder input buffer failed. Try FeedDecoderInputBuffer again."); std::shared_ptr reFeedInputPacket = std::make_shared(); reFeedInputPacket->SetVideoCodecType(sourceConfig_.GetVideoCodecType()); DCameraCodecEvent dCamCodecEv(*this, reFeedInputPacket, VideoCodecAction::ACTION_ONCE_AGAIN); @@ -309,7 +309,7 @@ int32_t DecodeDataProcess::FeedDecoderInputBuffer() while ((!inputBuffersQueue_.empty()) && (isDecoderProcess_)) { std::shared_ptr buffer = inputBuffersQueue_.front(); if (buffer == nullptr || availableInputIndexsQueue_.empty()) { - DHLOGE("inputBuffersQueue size %d, availableInputIndexsQueue size %d.", + DHLOGE("inputBuffersQueue size %zu, availableInputIndexsQueue size %zu.", inputBuffersQueue_.size(), availableInputIndexsQueue_.size()); return DCAMERA_BAD_VALUE; } @@ -323,7 +323,7 @@ int32_t DecodeDataProcess::FeedDecoderInputBuffer() uint32_t index = availableInputIndexsQueue_.front(); std::shared_ptr sharedMemoryInput = videoDecoder_->GetInputBuffer(index); if (sharedMemoryInput == nullptr) { - DHLOGE("Failed to obtain the input shared memory corresponding to the [%d] index.", index); + DHLOGE("Failed to obtain the input shared memory corresponding to the [%u] index.", index); return DCAMERA_BAD_VALUE; } size_t inputMemoDataSize = static_cast(sharedMemoryInput->GetSize()); @@ -333,7 +333,7 @@ int32_t DecodeDataProcess::FeedDecoderInputBuffer() return DCAMERA_MEMORY_OPT_ERROR; } int64_t timeUs = GetDecoderTimeStamp(); - DHLOGD("Decoder input buffer size %d, timeStamp %lld.", buffer->Size(), (long long)timeUs); + DHLOGD("Decoder input buffer size %zu, timeStamp %lld.", buffer->Size(), (long long)timeUs); Media::AVCodecBufferInfo bufferInfo {timeUs, static_cast(buffer->Size()), 0}; int32_t ret = videoDecoder_->QueueInputBuffer(index, bufferInfo, Media::AVCODEC_BUFFER_FLAG_NONE); @@ -420,7 +420,7 @@ void DecodeDataProcess::CopyDecodedImage(const sptr& surBuf, int6 bytesPerPixel / y2UvRatio); size_t surfaceBufSize = static_cast(surBuf->GetSize()); if (validDecodedImageAlignedSize > surfaceBufSize || validDecodedImageAlignedSize < validDecodedImageSize) { - DHLOGE("Buffer size error, validDecodedImageSize %d, validDecodedImageAlignedSize %d, surBufSize %d.", + DHLOGE("Buffer size error, validDecodedImageSize %zu, validDecodedImageAlignedSize %zu, surBufSize %zu.", validDecodedImageSize, validDecodedImageAlignedSize, surBuf->GetSize()); return; } @@ -567,7 +567,7 @@ int32_t DecodeDataProcess::DecodeDone(std::vector> o DHLOGD("Send to the next node of the decoder for processing."); int32_t err = nextDataProcess_->ProcessData(outputBuffers); if (err != DCAMERA_OK) { - DHLOGE("Someone node after the decoder processes fail."); + DHLOGE("Someone node after the decoder processes failed."); } return err; } @@ -636,7 +636,7 @@ void DecodeDataProcess::OnInputBufferAvailable(uint32_t index) DHLOGE("Video decoder available indexs queue overflow."); return; } - DHLOGD("Video decoder available indexs queue push index [%d].", index); + DHLOGD("Video decoder available indexs queue push index [%u].", index); availableInputIndexsQueue_.push(index); } @@ -667,7 +667,7 @@ void DecodeDataProcess::OnOutputBufferAvailable(uint32_t index, const Media::AVC } int32_t errRelease = videoDecoder_->ReleaseOutputBuffer(index, true); if (errRelease != Media::MediaServiceErrCode::MSERR_OK) { - DHLOGE("The video decoder output decoded data to surface fail, index : [%d].", index); + DHLOGE("The video decoder output decoded data to surface failed, index : [%u].", index); } } } diff --git a/services/data_process/src/pipeline_node/multimedia_codec/decode_video_callback.cpp b/services/data_process/src/pipeline_node/multimedia_codec/decode_video_callback.cpp index eb354c2feb2eae68095adcdc6f7e2ddbf557d401..04b1bcc631a7ea9f348dd0f8581eb70afbb4cf98 100644 --- a/services/data_process/src/pipeline_node/multimedia_codec/decode_video_callback.cpp +++ b/services/data_process/src/pipeline_node/multimedia_codec/decode_video_callback.cpp @@ -21,7 +21,7 @@ namespace OHOS { namespace DistributedHardware { void DecodeVideoCallback::OnError(Media::AVCodecErrorType errorType, int32_t errorCode) { - DHLOGE("DecodeVideoCallback : OnError. Error type: %d . Error code: %d ", errorType, errorCode); + DHLOGE("DecodeVideoCallback : OnError. Error type: %d. Error code: %d ", errorType, errorCode); std::shared_ptr targetDecoderNode = decodeVideoNode_.lock(); if (targetDecoderNode == nullptr) { DHLOGE("decodeVideoNode_ is nullptr."); diff --git a/services/data_process/src/pipeline_node/multimedia_codec/encode_data_process.cpp b/services/data_process/src/pipeline_node/multimedia_codec/encode_data_process.cpp index 7db3465a429458ad085c03bd12cf5237b0be36ec..7327f30dddbd0aa8d36db09ce5a78413af528630 100644 --- a/services/data_process/src/pipeline_node/multimedia_codec/encode_data_process.cpp +++ b/services/data_process/src/pipeline_node/multimedia_codec/encode_data_process.cpp @@ -71,7 +71,7 @@ int32_t EncodeDataProcess::InitNode() int32_t err = InitEncoder(); if (err != DCAMERA_OK) { - DHLOGE("Init video encoder fail."); + DHLOGE("Init video encoder failed."); ReleaseProcessNode(); return err; } @@ -97,12 +97,12 @@ int32_t EncodeDataProcess::InitEncoder() DHLOGD("Init video encoder."); int32_t err = InitEncoderMetadataFormat(); if (err != DCAMERA_OK) { - DHLOGE("Init video encoder metadata format fail."); + DHLOGE("Init video encoder metadata format failed."); return err; } err = InitEncoderBitrateFormat(); if (err != DCAMERA_OK) { - DHLOGE("Init video encoder bitrate format fail."); + DHLOGE("Init video encoder bitrate format failed."); return err; } @@ -269,7 +269,7 @@ int32_t EncodeDataProcess::ProcessData(std::vector>& } int32_t err = FeedEncoderInputBuffer(inputBuffers[0]); if (err != DCAMERA_OK) { - DHLOGE("Feed encoder input Buffer fail."); + DHLOGE("Feed encoder input Buffer failed."); return err; } { @@ -375,7 +375,7 @@ int32_t EncodeDataProcess::GetEncoderOutputBuffer(uint32_t index, Media::AVCodec } std::shared_ptr sharedMemoryOutput = videoEncoder_->GetOutputBuffer(index); if (sharedMemoryOutput == nullptr) { - DHLOGE("Failed to get the output shared memory, index : %d", index); + DHLOGE("Failed to get the output shared memory, index : %u", index); return DCAMERA_BAD_OPERATE; } @@ -412,7 +412,7 @@ int32_t EncodeDataProcess::EncodeDone(std::vector> o DHLOGD("Send to the next node of the encoder for processing."); int32_t err = nextDataProcess_->ProcessData(outputBuffers); if (err != DCAMERA_OK) { - DHLOGE("Someone node after the encoder processes fail."); + DHLOGE("Someone node after the encoder processes failed."); } return err; } @@ -442,7 +442,7 @@ void EncodeDataProcess::OnError() void EncodeDataProcess::OnInputBufferAvailable(uint32_t index) { - DHLOGD("The available input buffer index : %d. No operation when using surface input.", index); + DHLOGD("The available input buffer index : %u. No operation when using surface input.", index); } void EncodeDataProcess::OnOutputFormatChanged(const Media::Format &format) @@ -465,7 +465,7 @@ void EncodeDataProcess::OnOutputBufferAvailable(uint32_t index, Media::AVCodecBu info.presentationTimeUs, info.size, info.offset, flag); int32_t err = GetEncoderOutputBuffer(index, info); if (err != DCAMERA_OK) { - DHLOGE("Get encode output Buffer fail."); + DHLOGE("Get encode output Buffer failed."); return; } { @@ -482,7 +482,7 @@ void EncodeDataProcess::OnOutputBufferAvailable(uint32_t index, Media::AVCodecBu } int32_t errRelease = videoEncoder_->ReleaseOutputBuffer(index); if (errRelease != Media::MediaServiceErrCode::MSERR_OK) { - DHLOGE("The video encoder release output buffer fail, index : [%d].", index); + DHLOGE("The video encoder release output buffer failed, index : [%u].", index); } } VideoConfigParams EncodeDataProcess::GetSourceConfig() const diff --git a/services/data_process/src/pipeline_node/multimedia_codec/encode_video_callback.cpp b/services/data_process/src/pipeline_node/multimedia_codec/encode_video_callback.cpp index 07b80386d4f5f00348c887e5fda885229069540c..ed3214184e47bb5fd8a8472657253458731a76ae 100644 --- a/services/data_process/src/pipeline_node/multimedia_codec/encode_video_callback.cpp +++ b/services/data_process/src/pipeline_node/multimedia_codec/encode_video_callback.cpp @@ -20,7 +20,7 @@ namespace OHOS { namespace DistributedHardware { void EncodeVideoCallback::OnError(Media::AVCodecErrorType errorType, int32_t errorCode) { - DHLOGD("EncodeVideoCallback : OnError. Error type: %d . Error code: %d ", errorType, errorCode); + DHLOGD("EncodeVideoCallback : OnError. Error type: %d. Error code: %d ", errorType, errorCode); std::shared_ptr targetEncoderNode = encodeVideoNode_.lock(); if (targetEncoderNode == nullptr) { DHLOGE("encodeVideoNode_ is nullptr.");