diff --git a/bundle.json b/bundle.json index f8695282c6ab530ace993fbef0f29d3f9887921b..6ec237aea52d24820c6dad9c9bd390c00c175fd9 100644 --- a/bundle.json +++ b/bundle.json @@ -29,6 +29,7 @@ "access_token", "accessibility", "ipc", + "init", "eventhandler", "camera_framework", "graphic_surface", diff --git a/common/BUILD.gn b/common/BUILD.gn index a737e8140a788c21a1d5d78c34376e52dde46359..7782a902e41afbb24699541bf9c41b9c61d72050 100644 --- a/common/BUILD.gn +++ b/common/BUILD.gn @@ -68,6 +68,7 @@ ohos_shared_library("distributed_camera_utils") { "hilog:libhilog", "hisysevent:libhisysevent", "hitrace:hitrace_meter", + "init:libbegetutil", "safwk:system_ability_fwk", "samgr:samgr_proxy", ] diff --git a/common/include/utils/dcamera_utils_tools.h b/common/include/utils/dcamera_utils_tools.h index 6bcf240e89ff77589688f70eda02741cfe8a444c..5c61fb2f059a16f56bd61ca539af55b78a1e5304 100644 --- a/common/include/utils/dcamera_utils_tools.h +++ b/common/include/utils/dcamera_utils_tools.h @@ -20,6 +20,7 @@ #include #include #include +#include #ifdef DCAMERA_MMAP_RESERVE #include "image_converter.h" @@ -56,6 +57,24 @@ private: OHOS::OpenSourceLibyuv::ImageConverter converter_ = {0}; }; #endif + +const std::string DUMP_SERVER_PARA = "sys.dcamera.dump.write.enable"; +const std::string DUMP_SERVICE_DIR = "/data/local/tmp/"; +const std::string DUMP_DCAMERA_AFTER_ENC_FILENAME = "dump_after_enc_dcamsink.h265"; +const std::string DUMP_DCAMERA_BEFORE_DEC_FILENAME = "dump_before_dec_dcamsource.h265"; +const std::string DUMP_DCAMERA_AFTER_DEC_FILENAME = "dump_after_dec_dcamsource.yuv"; +const std::string DUMP_DCAMERA_AFTER_SCALE_FILENAME = "dump_after_scale_dcamsource.yuv"; + +class DumpFileUtil { +public: + static void WriteDumpFile(FILE *dumpFile, void *buffer, size_t bufferSize); + static void CloseDumpFile(FILE **dumpFile); + static std::map g_lastPara; + static void OpenDumpFile(std::string para, std::string fileName, FILE **file); +private: + static FILE *OpenDumpFileInner(std::string para, std::string fileName); + static void ChangeDumpFileState(std::string para, FILE **dumpFile, std::string fileName); +}; } // namespace DistributedHardware } // namespace OHOS #endif // OHOS_DCAMERA_UTILS_TOOL_H diff --git a/common/src/utils/dcamera_utils_tools.cpp b/common/src/utils/dcamera_utils_tools.cpp index 2333dd3dd6320326321c2855e090fb0f551cfb70..169bb6b03cb22a06f6b359d74052e4a7aafeb31d 100644 --- a/common/src/utils/dcamera_utils_tools.cpp +++ b/common/src/utils/dcamera_utils_tools.cpp @@ -18,10 +18,13 @@ #include #include #include +#include +#include #include "distributed_camera_constants.h" #include "distributed_camera_errno.h" #include "distributed_hardware_log.h" +#include "parameter.h" #include "softbus_bus_center.h" @@ -286,5 +289,96 @@ const OHOS::OpenSourceLibyuv::ImageConverter& ConverterHandle::GetHandle() return converter_; } #endif + +template +bool GetSysPara(const char *key, T &value) +{ + CHECK_AND_RETURN_RET_LOG(key == nullptr, false, "key is nullptr"); + char paraValue[30] = {0}; // 30 for system parameter + auto res = GetParameter(key, "-1", paraValue, sizeof(paraValue)); + + CHECK_AND_RETURN_RET_LOG(res <= 0, false, "GetParameter fail, key:%{public}s res:%{public}d", key, res); + DHLOGI("GetSysPara key:%{public}s value:%{public}s", key, paraValue); + std::stringstream valueStr; + valueStr << paraValue; + valueStr >> value; + return true; +} + +template bool GetSysPara(const char *key, int32_t &value); +template bool GetSysPara(const char *key, uint32_t &value); +template bool GetSysPara(const char *key, int64_t &value); +template bool GetSysPara(const char *key, std::string &value); + +std::map DumpFileUtil::g_lastPara = {}; + +FILE *DumpFileUtil::OpenDumpFileInner(std::string para, std::string fileName) +{ + std::string filePath = DUMP_SERVICE_DIR + fileName; + std::string dumpPara; + FILE *dumpFile = nullptr; + bool res = GetSysPara(para.c_str(), dumpPara); + if (!res || dumpPara.empty()) { + DHLOGI("%{public}s is not set, dump dcamera is not required", para.c_str()); + g_lastPara[para] = dumpPara; + return dumpFile; + } + DHLOGI("%{public}s = %{public}s, filePath: %{public}s", para.c_str(), dumpPara.c_str(), filePath.c_str()); + if (dumpPara == "w") { + dumpFile = fopen(filePath.c_str(), "wb+"); + CHECK_AND_RETURN_RET_LOG(dumpFile == nullptr, dumpFile, "Error opening dump file!"); + } else if (dumpPara == "a") { + dumpFile = fopen(filePath.c_str(), "ab+"); + CHECK_AND_RETURN_RET_LOG(dumpFile == nullptr, dumpFile, "Error opening dump file!"); + } + g_lastPara[para] = dumpPara; + return dumpFile; +} + +void DumpFileUtil::WriteDumpFile(FILE *dumpFile, void *buffer, size_t bufferSize) +{ + if (dumpFile == nullptr) { + return; + } + CHECK_AND_RETURN_LOG(buffer == nullptr, "Invalid write param"); + size_t writeResult = fwrite(buffer, 1, bufferSize, dumpFile); + CHECK_AND_RETURN_LOG(writeResult != bufferSize, "Failed to write the file."); +} + +void DumpFileUtil::CloseDumpFile(FILE **dumpFile) +{ + if (*dumpFile) { + fclose(*dumpFile); + *dumpFile = nullptr; + } +} + +void DumpFileUtil::ChangeDumpFileState(std::string para, FILE **dumpFile, std::string filePath) +{ + CHECK_AND_RETURN_LOG(*dumpFile == nullptr, "Invalid file para"); + CHECK_AND_RETURN_LOG(g_lastPara[para] != "w" || g_lastPara[para] != "a", "Invalid input para"); + std::string dumpPara; + bool res = GetSysPara(para.c_str(), dumpPara); + if (!res || dumpPara.empty()) { + DHLOGE("get %{public}s fail", para.c_str()); + } + if (g_lastPara[para] == "w" && dumpPara == "w") { + return; + } + CloseDumpFile(dumpFile); + OpenDumpFile(para, filePath, dumpFile); +} + +void DumpFileUtil::OpenDumpFile(std::string para, std::string fileName, FILE **file) +{ + if (*file != nullptr) { + DumpFileUtil::ChangeDumpFileState(para, file, fileName); + return; + } + + if (para == DUMP_SERVER_PARA) { + *file = DumpFileUtil::OpenDumpFileInner(para, fileName); + } +} } // namespace DistributedHardware } // namespace OHOS diff --git a/services/cameraservice/sinkservice/include/distributedcameramgr/dcamera_sink_data_process.h b/services/cameraservice/sinkservice/include/distributedcameramgr/dcamera_sink_data_process.h index ec71147d053908b8fd7ee2336f1111812fce7308..9d285ce5e6a65c49dba89698bdd45518ab103bb0 100644 --- a/services/cameraservice/sinkservice/include/distributedcameramgr/dcamera_sink_data_process.h +++ b/services/cameraservice/sinkservice/include/distributedcameramgr/dcamera_sink_data_process.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-2024 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 @@ -25,6 +25,7 @@ #include "icamera_sink_data_process.h" #include "idata_process_pipeline.h" #include "image_common_type.h" +#include "dcamera_utils_tools.h" namespace OHOS { namespace DistributedHardware { @@ -60,6 +61,7 @@ private: std::thread eventThread_; std::condition_variable eventCon_; std::shared_ptr eventHandler_; + FILE *dumpFile_ = nullptr; }; } // namespace DistributedHardware } // namespace OHOS diff --git a/services/cameraservice/sinkservice/src/distributedcameramgr/dcamera_sink_data_process.cpp b/services/cameraservice/sinkservice/src/distributedcameramgr/dcamera_sink_data_process.cpp index 8bf4ad5684b375fca877ba13e71b11e08199b727..54c91ca91cbf61efb59440f227216b3cdeb2e749 100644 --- a/services/cameraservice/sinkservice/src/distributedcameramgr/dcamera_sink_data_process.cpp +++ b/services/cameraservice/sinkservice/src/distributedcameramgr/dcamera_sink_data_process.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2023 Huawei Device Co., Ltd. + * Copyright (c) 2021-2024 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 @@ -20,7 +20,6 @@ #include "dcamera_pipeline_sink.h" #include "dcamera_sink_data_process_listener.h" #include "dcamera_hidumper.h" -#include "dcamera_utils_tools.h" #include "distributed_camera_constants.h" #include "distributed_camera_errno.h" #include "distributed_hardware_log.h" @@ -42,6 +41,7 @@ DCameraSinkDataProcess::~DCameraSinkDataProcess() } eventThread_.join(); eventHandler_ = nullptr; + DumpFileUtil::CloseDumpFile(&dumpFile_); } void DCameraSinkDataProcess::Init() @@ -71,6 +71,7 @@ int32_t DCameraSinkDataProcess::StartCapture(std::shared_ptr DHLOGI("StartCapture dhId: %{public}s, width: %{public}d, height: %{public}d, format: %{public}d, stream: " "%{public}d, encode: %{public}d", GetAnonyString(dhId_).c_str(), captureInfo->width_, captureInfo->height_, captureInfo->format_, captureInfo->streamType_, captureInfo->encodeType_); + DumpFileUtil::OpenDumpFile(DUMP_SERVER_PARA, DUMP_DCAMERA_AFTER_ENC_FILENAME, &dumpFile_); captureInfo_ = captureInfo; if (pipeline_ != nullptr) { DHLOGI("StartCapture %{public}s pipeline already exits", GetAnonyString(dhId_).c_str()); @@ -164,6 +165,7 @@ void DCameraSinkDataProcess::OnProcessedVideoBuffer(const std::shared_ptrData(), videoResult->Size()); } #endif + DumpFileUtil::WriteDumpFile(dumpFile_, static_cast(videoResult->Data()), videoResult->Size()); SendDataAsync(videoResult); } diff --git a/services/data_process/include/pipeline_node/multimedia_codec/decoder/decode_data_process.h b/services/data_process/include/pipeline_node/multimedia_codec/decoder/decode_data_process.h index 5283dbf3db4d04e61526b7c402fc09dcb2fba45b..830de4afee5e862b000ee1e087ac1a5e76eccf5a 100644 --- a/services/data_process/include/pipeline_node/multimedia_codec/decoder/decode_data_process.h +++ b/services/data_process/include/pipeline_node/multimedia_codec/decoder/decode_data_process.h @@ -40,6 +40,7 @@ #include "dcamera_pipeline_source.h" #include "distributed_camera_errno.h" #include "image_common_type.h" +#include "dcamera_utils_tools.h" namespace OHOS { namespace DistributedHardware { @@ -158,6 +159,8 @@ private: std::queue> availableInputBufferQueue_; std::queue availableInputIndexsQueue_; std::deque frameInfoDeque_; + FILE *dumpDecBeforeFile_ = nullptr; + FILE *dumpDecAfterFile_ = nullptr; }; } // namespace DistributedHardware } // namespace OHOS diff --git a/services/data_process/include/pipeline_node/scale_conversion/scale_convert_process.h b/services/data_process/include/pipeline_node/scale_conversion/scale_convert_process.h index 866ef45e48d67a080e4804f4257071df6250066a..f39669e8a9f98b9e7ae3ed4a118525c955294e9b 100644 --- a/services/data_process/include/pipeline_node/scale_conversion/scale_convert_process.h +++ b/services/data_process/include/pipeline_node/scale_conversion/scale_convert_process.h @@ -36,6 +36,7 @@ extern "C" { #include "dcamera_pipeline_source.h" #include "image_common_type.h" +#include "dcamera_utils_tools.h" namespace OHOS { namespace DistributedHardware { @@ -100,6 +101,7 @@ private: VideoConfigParams processedConfig_; std::weak_ptr callbackPipelineSource_; std::atomic isScaleConvert_ = false; + FILE *dumpFile_ = nullptr; }; } // namespace DistributedHardware } // namespace OHOS diff --git a/services/data_process/src/pipeline_node/multimedia_codec/decoder/decode_data_process.cpp b/services/data_process/src/pipeline_node/multimedia_codec/decoder/decode_data_process.cpp index 57227ac5d3acd94fde3f00203382a6e3efa69ea6..06388c1a78d74752e470f56f5e1e37f6cbdb225e 100644 --- a/services/data_process/src/pipeline_node/multimedia_codec/decoder/decode_data_process.cpp +++ b/services/data_process/src/pipeline_node/multimedia_codec/decoder/decode_data_process.cpp @@ -19,7 +19,6 @@ #include "distributed_hardware_log.h" #include "dcamera_hisysevent_adapter.h" #include "dcamera_hidumper.h" -#include "dcamera_utils_tools.h" #include "decode_surface_listener.h" #include "decode_video_callback.h" #include "graphic_common_c.h" @@ -32,6 +31,8 @@ const std::string ENUM_VIDEOFORMAT_STRINGS[] = { DecodeDataProcess::~DecodeDataProcess() { + DumpFileUtil::CloseDumpFile(&dumpDecBeforeFile_); + DumpFileUtil::CloseDumpFile(&dumpDecAfterFile_); if (isDecoderProcess_.load()) { DHLOGD("~DecodeDataProcess : ReleaseProcessNode."); ReleaseProcessNode(); @@ -323,6 +324,8 @@ int32_t DecodeDataProcess::ProcessData(std::vector>& DHLOGE("The input data buffers is empty."); return DCAMERA_BAD_VALUE; } + DumpFileUtil::OpenDumpFile(DUMP_SERVER_PARA, DUMP_DCAMERA_BEFORE_DEC_FILENAME, &dumpDecBeforeFile_); + DumpFileUtil::OpenDumpFile(DUMP_SERVER_PARA, DUMP_DCAMERA_AFTER_DEC_FILENAME, &dumpDecAfterFile_); if (sourceConfig_.GetVideoCodecType() == processedConfig_.GetVideoCodecType()) { DHLOGD("The target VideoCodecType : %{public}d is the same as the source VideoCodecType : %{public}d.", sourceConfig_.GetVideoCodecType(), processedConfig_.GetVideoCodecType()); @@ -397,10 +400,8 @@ int32_t DecodeDataProcess::FeedDecoderInputBuffer() int64_t timeStamp = buffer->frameInfo_.pts; { std::lock_guard inputLock(mtxDecoderLock_); - if (videoDecoder_ == nullptr) { - DHLOGE("The video decoder does not exist before GetInputBuffer."); - return DCAMERA_OK; - } + CHECK_AND_RETURN_RET_LOG( + videoDecoder_ == nullptr, DCAMERA_OK, "The video decoder does not exist before GetInputBuffer."); uint32_t index = availableInputIndexsQueue_.front(); std::shared_ptr sharedMemoryInput = availableInputBufferQueue_.front(); if (sharedMemoryInput == nullptr) { @@ -408,12 +409,10 @@ int32_t DecodeDataProcess::FeedDecoderInputBuffer() return DCAMERA_BAD_VALUE; } BeforeDecodeDump(buffer->Data(), buffer->Size()); + DumpFileUtil::WriteDumpFile(dumpDecBeforeFile_, static_cast(buffer->Data()), buffer->Size()); size_t inputMemoDataSize = static_cast(sharedMemoryInput->GetSize()); errno_t err = memcpy_s(sharedMemoryInput->GetBase(), inputMemoDataSize, buffer->Data(), buffer->Size()); - if (err != EOK) { - DHLOGE("memcpy_s buffer failed."); - return DCAMERA_MEMORY_OPT_ERROR; - } + CHECK_AND_RETURN_RET_LOG(err != EOK, DCAMERA_MEMORY_OPT_ERROR, "memcpy_s buffer failed."); DHLOGD("Decoder input buffer size %{public}zu, timeStamp %{public}" PRId64"us.", buffer->Size(), timeStamp); MediaAVCodec::AVCodecBufferInfo bufferInfo {timeStamp, static_cast(buffer->Size()), 0}; int32_t ret = videoDecoder_->QueueInputBuffer(index, bufferInfo, @@ -558,6 +557,7 @@ void DecodeDataProcess::CopyDecodedImage(const sptr& surBuf, int3 DumpBufferToFile(DUMP_PATH + fileName, bufferOutput->Data(), bufferOutput->Size()); } #endif + DumpFileUtil::WriteDumpFile(dumpDecAfterFile_, static_cast(bufferOutput->Data()), bufferOutput->Size()); PostOutputDataBuffers(bufferOutput); } diff --git a/services/data_process/src/pipeline_node/multimedia_codec/decoder/decode_data_process_common.cpp b/services/data_process/src/pipeline_node/multimedia_codec/decoder/decode_data_process_common.cpp index 3fd6040c68d3b1d2f6d4598a47b5042ca09c8751..26adfe13fdc1a615b03f943966f0e77635eeda96 100644 --- a/services/data_process/src/pipeline_node/multimedia_codec/decoder/decode_data_process_common.cpp +++ b/services/data_process/src/pipeline_node/multimedia_codec/decoder/decode_data_process_common.cpp @@ -20,7 +20,6 @@ #include "dcamera_hisysevent_adapter.h" #include "dcamera_hidumper.h" -#include "dcamera_utils_tools.h" #include "decode_surface_listener.h" #include "decode_video_callback.h" @@ -32,6 +31,8 @@ const std::string ENUM_VIDEOFORMAT_STRINGS[] = { DecodeDataProcess::~DecodeDataProcess() { + DumpFileUtil::CloseDumpFile(&dumpDecBeforeFile_); + DumpFileUtil::CloseDumpFile(&dumpDecAfterFile_); if (isDecoderProcess_.load()) { DHLOGD("~DecodeDataProcess : ReleaseProcessNode."); ReleaseProcessNode(); @@ -369,6 +370,8 @@ int32_t DecodeDataProcess::ProcessData(std::vector>& DHLOGE("The input data buffers is empty."); return DCAMERA_BAD_VALUE; } + DumpFileUtil::OpenDumpFile(DUMP_SERVER_PARA, DUMP_DCAMERA_BEFORE_DEC_FILENAME, &dumpDecBeforeFile_); + DumpFileUtil::OpenDumpFile(DUMP_SERVER_PARA, DUMP_DCAMERA_AFTER_DEC_FILENAME, &dumpDecAfterFile_); if (sourceConfig_.GetVideoCodecType() == processedConfig_.GetVideoCodecType()) { DHLOGD("The target VideoCodecType : %{public}d is the same as the source VideoCodecType : %{public}d.", sourceConfig_.GetVideoCodecType(), processedConfig_.GetVideoCodecType()); @@ -443,10 +446,8 @@ int32_t DecodeDataProcess::FeedDecoderInputBuffer() int64_t timeStamp = buffer->frameInfo_.pts; { std::lock_guard inputLock(mtxDecoderLock_); - if (videoDecoder_ == nullptr) { - DHLOGE("The video decoder does not exist before GetInputBuffer."); - return DCAMERA_OK; - } + CHECK_AND_RETURN_RET_LOG( + videoDecoder_ == nullptr, DCAMERA_OK, "The video decoder does not exist before GetInputBuffer."); uint32_t index = availableInputIndexsQueue_.front(); std::shared_ptr sharedMemoryInput = availableInputBufferQueue_.front(); if (sharedMemoryInput == nullptr) { @@ -454,12 +455,10 @@ int32_t DecodeDataProcess::FeedDecoderInputBuffer() return DCAMERA_BAD_VALUE; } BeforeDecodeDump(buffer->Data(), buffer->Size()); + DumpFileUtil::WriteDumpFile(dumpDecBeforeFile_, static_cast(buffer->Data()), buffer->Size()); size_t inputMemoDataSize = static_cast(sharedMemoryInput->GetSize()); errno_t err = memcpy_s(sharedMemoryInput->GetBase(), inputMemoDataSize, buffer->Data(), buffer->Size()); - if (err != EOK) { - DHLOGE("memcpy_s buffer failed."); - return DCAMERA_MEMORY_OPT_ERROR; - } + CHECK_AND_RETURN_RET_LOG(err != EOK, DCAMERA_MEMORY_OPT_ERROR, "memcpy_s buffer failed."); DHLOGD("Decoder input buffer size %{public}zu, timeStamp %{public}" PRId64"us.", buffer->Size(), timeStamp); MediaAVCodec::AVCodecBufferInfo bufferInfo {timeStamp, static_cast(buffer->Size()), 0}; int32_t ret = videoDecoder_->QueueInputBuffer(index, bufferInfo, @@ -593,6 +592,7 @@ void DecodeDataProcess::CopyDecodedImage(const sptr& surBuf, int3 DumpBufferToFile(DUMP_PATH + fileName, bufferOutput->Data(), bufferOutput->Size()); } #endif + DumpFileUtil::WriteDumpFile(dumpDecAfterFile_, static_cast(bufferOutput->Data()), bufferOutput->Size()); PostOutputDataBuffers(bufferOutput); } diff --git a/services/data_process/src/pipeline_node/scale_conversion/scale_convert_process.cpp b/services/data_process/src/pipeline_node/scale_conversion/scale_convert_process.cpp index 52d923f7dbe599b39f06254293ad1da3d12f31a3..221bdfab2c0be5ceee4d3a25da94b676e6291521 100644 --- a/services/data_process/src/pipeline_node/scale_conversion/scale_convert_process.cpp +++ b/services/data_process/src/pipeline_node/scale_conversion/scale_convert_process.cpp @@ -15,7 +15,6 @@ #include "scale_convert_process.h" -#include "dcamera_utils_tools.h" #include "distributed_camera_constants.h" #include "distributed_camera_errno.h" #include "distributed_hardware_log.h" @@ -25,6 +24,7 @@ namespace OHOS { namespace DistributedHardware { ScaleConvertProcess::~ScaleConvertProcess() { + DumpFileUtil::CloseDumpFile(&dumpFile_); if (isScaleConvert_.load()) { DHLOGI("~ScaleConvertProcess : ReleaseProcessNode"); ReleaseProcessNode(); @@ -86,6 +86,7 @@ int ScaleConvertProcess::ProcessData(std::vector>& i return DCAMERA_BAD_VALUE; } inputBuffers[0]->frameInfo_.timePonit.startScale = startScaleTime; + DumpFileUtil::OpenDumpFile(DUMP_SERVER_PARA, DUMP_DCAMERA_AFTER_SCALE_FILENAME, &dumpFile_); if (!IsConvertible(sourceConfig_, processedConfig_)) { DHLOGD("The target resolution: %{public}dx%{public}d format: %{public}d is the same as the source " @@ -119,6 +120,7 @@ int ScaleConvertProcess::ProcessData(std::vector>& i dstBuf->SetInt32("width", processedConfig_.GetWidth()); dstBuf->SetInt32("height", processedConfig_.GetHeight()); + DumpFileUtil::WriteDumpFile(dumpFile_, static_cast(dstBuf->Data()), dstBuf->Size()); std::vector> outputBuffers; outputBuffers.push_back(dstBuf); return ConvertDone(outputBuffers); diff --git a/services/data_process/src/pipeline_node/scale_conversion/scale_convert_process_common.cpp b/services/data_process/src/pipeline_node/scale_conversion/scale_convert_process_common.cpp index f3b1375fdc4ce45e7af5d937ac0d43a9f794cf04..4da3d324f1a04edfbe599df2f09d2b26b2edfe15 100644 --- a/services/data_process/src/pipeline_node/scale_conversion/scale_convert_process_common.cpp +++ b/services/data_process/src/pipeline_node/scale_conversion/scale_convert_process_common.cpp @@ -13,7 +13,6 @@ * limitations under the License. */ -#include "dcamera_utils_tools.h" #include "distributed_camera_constants.h" #include "distributed_camera_errno.h" #include "distributed_hardware_log.h" @@ -24,6 +23,7 @@ namespace OHOS { namespace DistributedHardware { ScaleConvertProcess::~ScaleConvertProcess() { + DumpFileUtil::CloseDumpFile(&dumpFile_); if (isScaleConvert_.load()) { DHLOGI("~ScaleConvertProcess : ReleaseProcessNode"); ReleaseProcessNode(); @@ -119,6 +119,7 @@ int ScaleConvertProcess::ProcessData(std::vector>& i return DCAMERA_BAD_VALUE; } inputBuffers[0]->frameInfo_.timePonit.startScale = startScaleTime; + DumpFileUtil::OpenDumpFile(DUMP_SERVER_PARA, DUMP_DCAMERA_AFTER_SCALE_FILENAME, &dumpFile_); if (!IsConvertible(sourceConfig_, processedConfig_)) { DHLOGD("The target resolution: %{public}dx%{public}d format: %{public}d is the same as the source " @@ -150,6 +151,7 @@ int ScaleConvertProcess::ProcessData(std::vector>& i dstBuf->SetInt32("width", processedConfig_.GetWidth()); dstBuf->SetInt32("height", processedConfig_.GetHeight()); + DumpFileUtil::WriteDumpFile(dumpFile_, static_cast(dstBuf->Data()), dstBuf->Size()); std::vector> outputBuffers; outputBuffers.push_back(dstBuf); return ConvertDone(outputBuffers);