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/src/dcamera_device/dmetadata_processor.cpp b/camera_hdf/hdi_impl/src/dcamera_device/dmetadata_processor.cpp index 44fa7a12ce74549f2558bf4387bf029a44dce093..b7bc5e308beb5cef054fee5f74b0eef5da935c30 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/dstream_operator/dcamera_steam.cpp b/camera_hdf/hdi_impl/src/dstream_operator/dcamera_steam.cpp index ee3cb82a32b01e541f9e9fec395f43f45f933f75..2cbc6f4a2f50d329ed7c6edf84a0d778a289c474 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 362fa246f766e7593a8b23e2c2bc7b330cd34de6..0eec08abd7631001e3cdc17fe7150a4c2479fb35 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 = 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 6b67de6aaf3cefe902519543908f1b8bb66decab..470a10be2c9b9ba9181ab9c3eca9be3c8cd311ed 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 da30b84d40d0088b916be927a736851f95e2360a..fd07419d142dbc81b00bcd64211e6e4afdc2d60b 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 e657d632f1c88f503a4fb9b92ac01187b7ec3998..6eb671a0db6e190fa669e9fdc5313de2c3c8a8e5 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 b971960ad9a0fcf4cf4693620861dba169d5e20a..dcba3ac27018ec08d554d3a35e2d608b8be8041c 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 8a9acc630467a1e942f6707d0bc6fe38c05bff1a..c3f577906e6d897cade4f98c1e4647c4eb7225f1 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_)) { diff --git a/camera_hdf/interfaces/include/types.h b/camera_hdf/interfaces/include/types.h index d49e2d955dfaefbc562f91c35da77c281f080823..e77adba9578f6e239257d2e61fb48c6998271db9 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..d3fa84811fbd7911ad2e826164b0a03b657a4d1d 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 diff --git a/interfaces/inner_kits/native_cpp/camera_sink/BUILD.gn b/interfaces/inner_kits/native_cpp/camera_sink/BUILD.gn index 8c8d618cf2eba5b354e07219be2154e452fd9c6d..73b77ae4b5bd162fa19a82154b23174d05d3e6ac 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_source/BUILD.gn b/interfaces/inner_kits/native_cpp/camera_source/BUILD.gn index d7a463a3aefe31ff59938af23187d0a4347b3b03..43b7dfa478b03e0bf402bedcc44965106f2716f6 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/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 c92d304e9351c440f74a0c02dc3cb17f40e7b3b5..1504df6d86d1ee7b30fc90b5569e146c160a365e 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/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_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/handler/BUILD.gn b/services/cameraservice/cameraoperator/handler/BUILD.gn index 39c468a28fcab989bb3d2c26bedbed28f1a36899..fa88481b486dc4dace76cc37cd70049a1090716d 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 4167d4f3693a2015c4db1da4c3924b9274073435..d92c1e442744885bb607275d629c2666671ce80b 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/sinkservice/BUILD.gn b/services/cameraservice/sinkservice/BUILD.gn index 8f442aed5edd400ad90232d98e62eac8b5888340..58260e30854f469c41d0f488066dc86cd53d6e0a 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 479caf7524af4f6eed51f53dd356536b38e5c68b..8f722eeab727d581ef1802b960badfcad4b3332d 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 48deca9a4a72fea8be6aff7dd602885560314118..bd182c41f069f16cfefbff21dfffd119b0ea948f 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 dca14bbf6b8286be4d691247c7a322438b873775..87a4937a8ac20682de77858a8562c88effa2c67f 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 abb5601dd681eefedd0521f43fd249fccc4173c2..92869e5bae532ba65aed0e909a9aeddf7e2fe141 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 7096cd47d20200edab0de2ea73dd39e084128265..4f88a2f0d499bb57e98c926469496da9296af4e4 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 56ca76b0fc53d0d7c4d52023bb696c7af00ed8e8..ecc5428b9895a9f1538066fea7481194d519311b 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..1851eeaded8d751d39bcebefe32b84d871942d6c 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 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 dd45a32a81f555fe26e5302a2e2990fff45b66bb..54f0df865da23f30f4cd9c7c87806d876da3dc29 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 f993f583fb797ec498aa65b476556e6e1f7bf4a4..3c73c545eec8c67f0a6ba4f2f9d430b0fa0b362d 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::vector #include "surface.h" +#include "ibuffer_consumer_listener.h" #include "media_errors.h" #include "avcodec_common.h" #include "format.h" @@ -78,7 +79,9 @@ private: int32_t InitDecoder(); int32_t InitDecoderMetadataFormat(); int32_t SetDecoderOutputSurface(); - void ReleaseDecoder(); + int32_t StopVideoDecoder(); + void ReleaseVideoDecoder(); + void ReleaseDecoderSurface(); int32_t FeedDecoderInputBuffer(); int64_t GetDecoderTimeStamp(); int32_t GetAlignedHeight(); @@ -113,6 +116,7 @@ private: std::shared_ptr decodeVideoCallback_ = nullptr; sptr decodeConsumerSurface_ = nullptr; sptr decodeProducerSurface_ = nullptr; + sptr decodeSurfaceListener_ = nullptr; bool isDecoderProcess_ = false; int32_t waitDecoderOutputCount_ = 0; @@ -126,21 +130,6 @@ private: std::queue> inputBuffersQueue_; std::queue availableInputIndexsQueue_; }; - -class DecodeSurfaceListener : public IBufferConsumerListener { -public: - DecodeSurfaceListener(sptr surface, std::weak_ptr decodeVideoNode) - : surface_(surface), decodeVideoNode_(decodeVideoNode) {} - ~DecodeSurfaceListener() = default; - - void OnBufferAvailable() override; - void SetSurface(const sptr& surface); - void SetDecodeVideoNode(const std::weak_ptr& decodeVideoNode); - -private: - sptr surface_; - std::weak_ptr decodeVideoNode_; -}; } } #endif \ No newline at end of file diff --git a/services/data_process/include/pipeline_node/multimedia_codec/decode_surface_listener.h b/services/data_process/include/pipeline_node/multimedia_codec/decode_surface_listener.h new file mode 100644 index 0000000000000000000000000000000000000000..223b936b7083b6ced574649f8995eb6676a06efa --- /dev/null +++ b/services/data_process/include/pipeline_node/multimedia_codec/decode_surface_listener.h @@ -0,0 +1,46 @@ +/* + * 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OHOS_DECODE_SURFACE_LISTENER_H +#define OHOS_DECODE_SURFACE_LISTENER_H + +#include "surface.h" +#include "ibuffer_consumer_listener.h" + +#include "decode_data_process.h" + +namespace OHOS { +namespace DistributedHardware { +class DecodeDataProcess; + +class DecodeSurfaceListener : public IBufferConsumerListener { +public: + DecodeSurfaceListener(sptr surface, std::weak_ptr decodeVideoNode) + : surface_(surface), decodeVideoNode_(decodeVideoNode) {} + ~DecodeSurfaceListener(); + + void OnBufferAvailable() override; + void SetSurface(const sptr& surface); + void SetDecodeVideoNode(const std::weak_ptr& decodeVideoNode); + sptr GetSurface() const; + std::shared_ptr GetDecodeVideoNode() const; + +private: + sptr surface_; + std::weak_ptr decodeVideoNode_; +}; +} +} +#endif \ No newline at end of file diff --git a/services/data_process/include/pipeline_node/multimedia_codec/encode_data_process.h b/services/data_process/include/pipeline_node/multimedia_codec/encode_data_process.h index ba265fa51c5cdcaaee04dc93a36801333dbad460..0d15682fa72c08dde6d2ebbc7eb2b518f5741042 100644 --- a/services/data_process/include/pipeline_node/multimedia_codec/encode_data_process.h +++ b/services/data_process/include/pipeline_node/multimedia_codec/encode_data_process.h @@ -63,6 +63,8 @@ private: int32_t InitEncoder(); int32_t InitEncoderMetadataFormat(); int32_t InitEncoderBitrateFormat(); + int32_t StopVideoEncoder(); + void ReleaseVideoEncoder(); int32_t FeedEncoderInputBuffer(std::shared_ptr& inputBuffer); sptr GetEncoderInputSurfaceBuffer(); int64_t GetEncoderTimeStamp(); 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 090aa045ab9d63aa57ff2b59bcbbe319f55c971d..0b52c49aba7c8bdd5c72bc22978472690e6a5cb2 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 488dec5bf9580e5f4bfea1b593b854b0356cc4d8..8f604063c216dfdbe07895559814c6da7dac16ba 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 @@ -20,6 +20,7 @@ #include "convert_nv12_to_nv21.h" #include "dcamera_utils_tools.h" +#include "decode_surface_listener.h" #include "decode_video_callback.h" namespace OHOS { @@ -53,7 +54,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,11 +102,11 @@ 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; } - videoDecoder_ = Media::VideoDecoderFactory::CreateByName("OMX_hisi_video_decoder_avc"); + videoDecoder_ = Media::VideoDecoderFactory::CreateByMime(processType_); if (videoDecoder_ == nullptr) { DHLOGE("Create video decoder failed."); return DCAMERA_INIT_ERR; @@ -123,7 +124,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,39 +175,94 @@ 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(), (int32_t)sourceConfig_.GetHeight()); - sptr decodeSurfaceListener_ = new DecodeSurfaceListener(decodeConsumerSurface_, - shared_from_this()); + 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; } +int32_t DecodeDataProcess::StopVideoDecoder() +{ + if (videoDecoder_ == nullptr) { + DHLOGE("The video decoder does not exist before StopVideoDecoder."); + return DCAMERA_BAD_VALUE; + } + + int32_t ret = videoDecoder_->Flush(); + if (ret != Media::MediaServiceErrCode::MSERR_OK) { + DHLOGE("VideoDecoder flush failed. Error type: %d.", ret); + return DCAMERA_BAD_OPERATE; + } + ret = videoDecoder_->Stop(); + if (ret != Media::MediaServiceErrCode::MSERR_OK) { + DHLOGE("VideoDecoder stop failed. Error type: %d.", ret); + return DCAMERA_BAD_OPERATE; + } + return DCAMERA_OK; +} + +void DecodeDataProcess::ReleaseVideoDecoder() +{ + std::lock_guard lck(mtxDecoderState_); + DHLOGD("Start release videoDecoder."); + if (videoDecoder_ == nullptr) { + DHLOGE("The video decoder does not exist before ReleaseVideoDecoder."); + decodeVideoCallback_ = nullptr; + return; + } + int32_t ret = StopVideoDecoder(); + if (ret != DCAMERA_OK) { + DHLOGE("StopVideoDecoder failed."); + } + ret = videoDecoder_->Release(); + if (ret != Media::MediaServiceErrCode::MSERR_OK) { + DHLOGE("VideoDecoder release failed. Error type: %d.", ret); + } + videoDecoder_ = nullptr; + decodeVideoCallback_ = nullptr; +} + +void DecodeDataProcess::ReleaseDecoderSurface() +{ + if (decodeConsumerSurface_ == nullptr) { + decodeProducerSurface_ = nullptr; + DHLOGE("The decode consumer surface does not exist before UnregisterConsumerListener."); + return; + } + int32_t ret = decodeConsumerSurface_->UnregisterConsumerListener(); + if (ret != SURFACE_ERROR_OK) { + DHLOGE("Unregister consumer listener failed. Error type: %d.", ret); + } + decodeConsumerSurface_ = nullptr; + decodeProducerSurface_ = nullptr; +} + void DecodeDataProcess::ReleaseProcessNode() { DHLOGD("Start release [%d] node : DecodeNode.", nodeRank_); @@ -223,19 +279,8 @@ void DecodeDataProcess::ReleaseProcessNode() eventBusPipeline_ = nullptr; } - { - std::lock_guard lck(mtxDecoderState_); - if (videoDecoder_ != nullptr) { - DHLOGD("Start release videoDecoder."); - videoDecoder_->Flush(); - videoDecoder_->Stop(); - videoDecoder_->Release(); - decodeConsumerSurface_ = nullptr; - decodeProducerSurface_ = nullptr; - videoDecoder_ = nullptr; - decodeVideoCallback_ = nullptr; - } - } + ReleaseVideoDecoder(); + ReleaseDecoderSurface(); processType_ = ""; std::queue> emptyBuffersQueue; @@ -271,7 +316,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_) { @@ -279,12 +324,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); @@ -303,7 +348,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; } @@ -317,7 +362,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()); @@ -327,7 +372,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); @@ -414,7 +459,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; } @@ -561,7 +606,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; } @@ -630,7 +675,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); } @@ -661,7 +706,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); } } } @@ -675,26 +720,5 @@ VideoConfigParams DecodeDataProcess::GetTargetConfig() const { return targetConfig_; } - -void DecodeSurfaceListener::OnBufferAvailable() -{ - DHLOGD("DecodeSurfaceListener : OnBufferAvailable."); - std::shared_ptr targetDecoderNode = decodeVideoNode_.lock(); - if (targetDecoderNode == nullptr) { - DHLOGE("decodeVideoNode_ is nullptr."); - return; - } - targetDecoderNode->GetDecoderOutputBuffer(surface_); -} - -void DecodeSurfaceListener::SetSurface(const sptr& surface) -{ - surface_ = surface; -} - -void DecodeSurfaceListener::SetDecodeVideoNode(const std::weak_ptr& decodeVideoNode) -{ - decodeVideoNode_ = decodeVideoNode; -} } } \ No newline at end of file diff --git a/services/data_process/src/pipeline_node/multimedia_codec/decode_surface_listener.cpp b/services/data_process/src/pipeline_node/multimedia_codec/decode_surface_listener.cpp new file mode 100644 index 0000000000000000000000000000000000000000..2e2fae3a2fbf4566d142b4d1da23490018e85084 --- /dev/null +++ b/services/data_process/src/pipeline_node/multimedia_codec/decode_surface_listener.cpp @@ -0,0 +1,63 @@ +/* + * 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "decode_surface_listener.h" + +#include "distributed_hardware_log.h" + +namespace OHOS { +namespace DistributedHardware { +DecodeSurfaceListener::~DecodeSurfaceListener() +{ + DHLOGD("DecodeSurfaceListener : ~DecodeSurfaceListener."); + surface_ = nullptr; +} + +void DecodeSurfaceListener::OnBufferAvailable() +{ + DHLOGD("DecodeSurfaceListener : OnBufferAvailable."); + std::shared_ptr targetDecoderNode = decodeVideoNode_.lock(); + if (targetDecoderNode == nullptr) { + DHLOGE("decodeVideoNode_ is nullptr."); + return; + } + targetDecoderNode->GetDecoderOutputBuffer(surface_); +} + +void DecodeSurfaceListener::SetSurface(const sptr& surface) +{ + surface_ = surface; +} + +void DecodeSurfaceListener::SetDecodeVideoNode(const std::weak_ptr& decodeVideoNode) +{ + decodeVideoNode_ = decodeVideoNode; +} + +sptr DecodeSurfaceListener::GetSurface() const +{ + return surface_; +} + +std::shared_ptr DecodeSurfaceListener::GetDecodeVideoNode() const +{ + std::shared_ptr targetDecoderNode = decodeVideoNode_.lock(); + if (targetDecoderNode == nullptr) { + DHLOGE("decodeVideoNode_ is nullptr."); + } + return targetDecoderNode; +} +} +} \ No newline at end of file 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 401f367244d5d108f4479df7853751cb734b9729..a4aa68833fb8318070c5ccc78546b6c900dd2c63 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 f5d9c92a79ac1eedac7bef09c6627cfaf7da27a1..b833daf481ce6beee068681b93b43494dfd8223a 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; } @@ -214,6 +214,49 @@ int32_t EncodeDataProcess::InitEncoderBitrateFormat() return DCAMERA_OK; } +int32_t EncodeDataProcess::StopVideoEncoder() +{ + if (videoEncoder_ == nullptr) { + DHLOGE("The video encoder does not exist before StopVideoEncoder."); + return DCAMERA_BAD_VALUE; + } + int32_t ret = videoEncoder_->Flush(); + if (ret != Media::MediaServiceErrCode::MSERR_OK) { + DHLOGE("VideoEncoder flush failed. Error type: %d.", ret); + return DCAMERA_BAD_OPERATE; + } + ret = videoEncoder_->Stop(); + if (ret != Media::MediaServiceErrCode::MSERR_OK) { + DHLOGE("VideoEncoder stop failed. Error type: %d.", ret); + return DCAMERA_BAD_OPERATE; + } + return DCAMERA_OK; +} + +void EncodeDataProcess::ReleaseVideoEncoder() +{ + std::lock_guard lck(mtxEncoderState_); + DHLOGD("Start release videoEncoder."); + if (videoEncoder_ == nullptr) { + DHLOGE("The video encoder does not exist before ReleaseVideoEncoder."); + encodeProducerSurface_ = nullptr; + encodeVideoCallback_ = nullptr; + return; + } + + int32_t ret = StopVideoEncoder(); + if (ret != DCAMERA_OK) { + DHLOGE("StopVideoEncoder failed."); + } + ret = videoEncoder_->Release(); + if (ret != Media::MediaServiceErrCode::MSERR_OK) { + DHLOGE("VideoEncoder release failed. Error type: %d.", ret); + } + encodeProducerSurface_ = nullptr; + videoEncoder_ = nullptr; + encodeVideoCallback_ = nullptr; +} + void EncodeDataProcess::ReleaseProcessNode() { DHLOGD("Start release [%d] node : EncodeNode.", nodeRank_); @@ -222,18 +265,7 @@ void EncodeDataProcess::ReleaseProcessNode() nextDataProcess_->ReleaseProcessNode(); } - { - std::lock_guard lck(mtxEncoderState_); - if (videoEncoder_ != nullptr) { - DHLOGD("Start release videoEncoder."); - videoEncoder_->Flush(); - videoEncoder_->Stop(); - videoEncoder_->Release(); - encodeProducerSurface_ = nullptr; - videoEncoder_ = nullptr; - encodeVideoCallback_ = nullptr; - } - } + ReleaseVideoEncoder(); waitEncoderOutputCount_ = 0; lastFeedEncoderInputBufferTimeUs_ = 0; @@ -269,7 +301,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 +407,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 +444,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 +474,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 +497,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 +514,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 27b05a22544a0d61d99796e7f5ef5fe0a478c3d2..0c47eaa00fe4084c3d855df25ad1dafccdb5f3d6 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.");