From d957b6816ab8a017ecfd8bf14555f4d76f2f3f66 Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Sun, 1 Nov 2020 22:27:44 +0800 Subject: [PATCH] =?UTF-8?q?rtp=E6=8E=A8=E6=B5=81=E6=94=AF=E6=8C=81h264?= =?UTF-8?q?=E8=B4=9F=E8=BD=BD=EF=BC=9A#360?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Rtp/GB28181Process.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/Rtp/GB28181Process.cpp b/src/Rtp/GB28181Process.cpp index 27947533..4ac764f2 100644 --- a/src/Rtp/GB28181Process.cpp +++ b/src/Rtp/GB28181Process.cpp @@ -13,6 +13,7 @@ #include "Util/File.h" #include "Http/HttpTSPlayer.h" #include "Extension/CommonRtp.h" +#include "Extension/H264Rtp.h" namespace mediakit{ @@ -54,6 +55,13 @@ void GB28181Process::onRtpSorted(const RtpPacket::Ptr &rtp, int) { break; } + case 98: { + //H264负载 + _rtp_decoder = std::make_shared(); + _interface->addTrack(std::make_shared()); + break; + } + default: WarnL << "不支持的rtp负载类型:" << (int) rtp->PT; return; @@ -89,6 +97,12 @@ const char *GB28181Process::onSearchPacketTail(const char *packet,uint64_t bytes } void GB28181Process::onRtpDecode(const Frame::Ptr &frame) { + if (frame->getCodecId() == CodecH264) { + //这是H264 + _interface->inputFrame(frame); + return; + } + //这是TS或PS if (_save_file_ps) { fwrite(frame->data(), frame->size(), 1, _save_file_ps.get());