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 bff09995382e9ae14d749cb083cfdef368c43e85..81b579e525a5eaacbe6aa83309bfe5d854e0104b 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 e7f03ef1a28c41b49bac9a77c0ea9d4089702141..dd79765d8e957e1c94b260193154a51af486457c 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 7fc142cfd230198c789531b34c019a452ef2b550..996b1800d77feefa221bbfb2f893297e72093a3a 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."); }