diff --git a/postman/ZLMediaKit.postman_collection.json b/postman/ZLMediaKit.postman_collection.json index 1111850f..59840416 100644 --- a/postman/ZLMediaKit.postman_collection.json +++ b/postman/ZLMediaKit.postman_collection.json @@ -2252,4 +2252,4 @@ "value": "__defaultVhost__" } ] -} \ No newline at end of file +} diff --git a/src/Extension/Factory.cpp b/src/Extension/Factory.cpp index f69eead7..9904a784 100644 --- a/src/Extension/Factory.cpp +++ b/src/Extension/Factory.cpp @@ -205,6 +205,9 @@ Frame::Ptr Factory::getFrameFromPtr(CodecId codec, const char *data, size_t byte Frame::Ptr Factory::getFrameFromBuffer(CodecId codec, Buffer::Ptr data, uint64_t dts, uint64_t pts) { auto frame = Factory::getFrameFromPtr(codec, data->data(), data->size(), dts, pts); + if(!frame){ + return nullptr; + } return std::make_shared(frame, false, std::move(data)); } diff --git a/src/Rtp/Decoder.cpp b/src/Rtp/Decoder.cpp index 65dc655c..dacd3ab5 100644 --- a/src/Rtp/Decoder.cpp +++ b/src/Rtp/Decoder.cpp @@ -110,6 +110,10 @@ void DecoderImp::onDecode(int stream, int codecid, int flags, int64_t pts, int64 if (!ref.first) { onTrack(stream, Factory::getTrackByCodecId(codec, 8000, 1, 16)); } + if (!ref.first) { + WarnL << "not support codec :" << getCodecName(codec); + return; + } auto frame = Factory::getFrameFromPtr(codec, (char *)data, bytes, dts, pts); if (getTrackType(codec) != TrackVideo) { onFrame(stream, frame);