From 26bb046bb81883cb9ef03c203b29c94ae32c472b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9F=A6=E5=9B=BD=E5=BA=86?= Date: Sat, 24 Aug 2024 10:26:39 +0800 Subject: [PATCH] =?UTF-8?q?change=20coody=20warning=20=EF=BC=88cherry=20pi?= =?UTF-8?q?cked=20commit=20from=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../av_trans_input/dscreen_input/dscreen_input_plugin.cpp | 4 ++++ .../dsoftbus_input/dsoftbus_input_plugin.cpp | 5 ++++- .../dsoftbus_output/dsoftbus_output_plugin.cpp | 8 ++++++-- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/av_transport/av_trans_engine/plugin/plugins/av_trans_input/dscreen_input/dscreen_input_plugin.cpp b/av_transport/av_trans_engine/plugin/plugins/av_trans_input/dscreen_input/dscreen_input_plugin.cpp index bff09995..81b579e5 100644 --- a/av_transport/av_trans_engine/plugin/plugins/av_trans_input/dscreen_input/dscreen_input_plugin.cpp +++ b/av_transport/av_trans_engine/plugin/plugins/av_trans_input/dscreen_input/dscreen_input_plugin.cpp @@ -127,6 +127,10 @@ Status DscreenInputPlugin::PushData(const std::string& inPort, std::shared_ptrSetMeta(Tag::USER_FRAME_NUMBER, frameNumber_.load()); + if (buffer->GetMemory() == nullptr) { + AVTRANS_LOGE("bufferMemory is nullptr."); + return Status::ERROR_NULL_POINTER; + } AVTRANS_LOGI("Push video buffer pts: %{public}ld, bufferLen: %{public}d, frameNumber: %{public}u.", buffer->pts, buffer->GetMemory()->GetSize(), Plugin::AnyCast(bufferMeta->GetMeta(Tag::USER_FRAME_NUMBER))); diff --git a/av_transport/av_trans_engine/plugin/plugins/av_trans_input/dsoftbus_input/dsoftbus_input_plugin.cpp b/av_transport/av_trans_engine/plugin/plugins/av_trans_input/dsoftbus_input/dsoftbus_input_plugin.cpp index e7f03ef1..dd79765d 100644 --- a/av_transport/av_trans_engine/plugin/plugins/av_trans_input/dsoftbus_input/dsoftbus_input_plugin.cpp +++ b/av_transport/av_trans_engine/plugin/plugins/av_trans_input/dsoftbus_input/dsoftbus_input_plugin.cpp @@ -288,7 +288,10 @@ std::shared_ptr DsoftbusInputPlugin::CreateBuffer(uint32_t metaType, } auto buffer = Buffer::CreateDefaultBuffer(static_cast(metaType), data->bufLen); auto bufData = buffer->GetMemory(); - + if (bufData == nullptr) { + AVTRANS_LOGE("bufferData is nullptr."); + return nullptr; + } auto writeSize = bufData->Write(reinterpret_cast(data->buf), data->bufLen, 0); if (static_cast(writeSize) != data->bufLen) { AVTRANS_LOGE("write buffer data failed."); diff --git a/av_transport/av_trans_engine/plugin/plugins/av_trans_output/dsoftbus_output/dsoftbus_output_plugin.cpp b/av_transport/av_trans_engine/plugin/plugins/av_trans_output/dsoftbus_output/dsoftbus_output_plugin.cpp index 7fc142cf..996b1800 100644 --- a/av_transport/av_trans_engine/plugin/plugins/av_trans_output/dsoftbus_output/dsoftbus_output_plugin.cpp +++ b/av_transport/av_trans_engine/plugin/plugins/av_trans_output/dsoftbus_output/dsoftbus_output_plugin.cpp @@ -260,8 +260,12 @@ Status DsoftbusOutputPlugin::PushData(const std::string &inPort, std::shared_ptr } if (GetDumpFlag() == true) { auto bufferData = buffer->GetMemory(); - DumpBufferToFile(SCREEN_FILE_NAME_AFTERCODING, - const_cast(bufferData->GetReadOnlyData()), bufferData->GetSize()); + if (bufferData != nullptr) { + DumpBufferToFile(SCREEN_FILE_NAME_AFTERCODING, + const_cast(bufferData->GetReadOnlyData()), bufferData->GetSize()); + } else { + AVTRANS_LOGE("bufferData is null."); + } } else { AVTRANS_LOGD("DumpFlag = false."); } -- Gitee