rtp推流支持h264负载:#360

This commit is contained in:
xiongziliang 2020-11-01 22:27:44 +08:00
parent d36e64eff4
commit d957b6816a

View File

@ -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<H264RtpDecoder>();
_interface->addTrack(std::make_shared<H264Track>());
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());