mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2026-06-30 14:52:23 +08:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
@@ -69,7 +69,7 @@ CommonRtpEncoder::CommonRtpEncoder(CodecId codec, uint32_t ssrc, uint32_t mtu_si
|
||||
}
|
||||
|
||||
void CommonRtpEncoder::inputFrame(const Frame::Ptr &frame){
|
||||
auto stamp = frame->dts();
|
||||
auto stamp = frame->pts();
|
||||
auto ptr = frame->data() + frame->prefixSize();
|
||||
auto len = frame->size() - frame->prefixSize();
|
||||
auto remain_size = len;
|
||||
|
||||
@@ -521,6 +521,10 @@ RtpHeader* RtpPacket::getHeader(){
|
||||
return (RtpHeader*)(data() + RtpPacket::kRtpTcpHeaderSize);
|
||||
}
|
||||
|
||||
string RtpPacket::dumpString() const{
|
||||
return ((RtpPacket *) this)->getHeader()->dumpString(size() - RtpPacket::kRtpTcpHeaderSize);
|
||||
}
|
||||
|
||||
uint16_t RtpPacket::getSeq(){
|
||||
return ntohs(getHeader()->seq);
|
||||
}
|
||||
|
||||
@@ -150,7 +150,11 @@ public:
|
||||
kRtpTcpHeaderSize = 4
|
||||
};
|
||||
|
||||
//获取rtp头
|
||||
RtpHeader* getHeader();
|
||||
//打印调试信息
|
||||
string dumpString() const;
|
||||
|
||||
//主机字节序的seq
|
||||
uint16_t getSeq();
|
||||
//主机字节序的时间戳,已经转换为毫秒
|
||||
|
||||
@@ -56,7 +56,11 @@ public:
|
||||
//需要解复用rtp
|
||||
key_pos = _demuxer->inputRtp(rtp);
|
||||
}
|
||||
RtspMediaSource::onWrite(std::move(rtp), key_pos);
|
||||
GET_CONFIG(bool, directProxy, Rtsp::kDirectProxy);
|
||||
if (directProxy) {
|
||||
//直接代理模式才直接使用原始rtp
|
||||
RtspMediaSource::onWrite(std::move(rtp), key_pos);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -72,8 +76,10 @@ public:
|
||||
* @param enableMP4 是否mp4录制
|
||||
*/
|
||||
void setProtocolTranslation(bool enableHls,bool enableMP4){
|
||||
//不重复生成rtsp
|
||||
_muxer = std::make_shared<MultiMediaSourceMuxer>(getVhost(), getApp(), getId(), _demuxer->getDuration(), false, true, enableHls, enableMP4);
|
||||
GET_CONFIG(bool, directProxy, Rtsp::kDirectProxy);
|
||||
//开启直接代理模式时,rtsp直接代理,不重复产生;但是有些rtsp推流端,由于sdp中已有sps pps,rtp中就不再包括sps pps,
|
||||
//导致rtc无法播放,所以在rtsp推流rtc播放时,建议关闭直接代理模式
|
||||
_muxer = std::make_shared<MultiMediaSourceMuxer>(getVhost(), getApp(), getId(), _demuxer->getDuration(), !directProxy, true, enableHls, enableMP4);
|
||||
_muxer->setMediaListener(getListener());
|
||||
_muxer->setTrackListener(static_pointer_cast<RtspMediaSourceImp>(shared_from_this()));
|
||||
//让_muxer对象拦截一部分事件(比如说录像相关事件)
|
||||
|
||||
Reference in New Issue
Block a user