From 99333986146e5b29ca6555a0d2a5584e9a8dd297 Mon Sep 17 00:00:00 2001 From: waken <33921191+mc373906408@users.noreply.github.com> Date: Wed, 13 Dec 2023 17:41:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=80=E4=B8=AA=E5=85=B3?= =?UTF-8?q?=E9=97=ADGB28181=E6=97=B6=E5=BC=95=E5=8F=91=E7=9A=84=E5=B4=A9?= =?UTF-8?q?=E6=BA=83=E9=97=AE=E9=A2=98=20=20(#3118)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix #3116 #3115 --- postman/ZLMediaKit.postman_collection.json | 2 +- src/Extension/Factory.cpp | 3 +++ src/Rtp/Decoder.cpp | 4 ++++ 3 files changed, 8 insertions(+), 1 deletion(-) 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);