过滤无效rtp包

This commit is contained in:
xiongziliang 2018-12-20 17:06:33 +08:00
parent c64bf1ea7a
commit 338c2e18fc

View File

@ -180,6 +180,9 @@ void RtspSession::onWholeRtspPacket(Parser &parser) {
} }
void RtspSession::onRtpPacket(const char *data, uint64_t len) { void RtspSession::onRtpPacket(const char *data, uint64_t len) {
if(!_pushSrc){
return;
}
if(len > 1600){ if(len > 1600){
//没有大于MTU的包 //没有大于MTU的包
return; return;
@ -1007,16 +1010,17 @@ inline void RtspSession::sendRtpPacket(const RtpPacket::Ptr & pkt) {
} }
void RtspSession::onRtpSorted(const RtpPacket::Ptr &rtppt, int trackidx) { void RtspSession::onRtpSorted(const RtpPacket::Ptr &rtppt, int trackidx) {
if(_pushSrc){
_pushSrc->onWrite(rtppt, false); _pushSrc->onWrite(rtppt, false);
}
} }
inline void RtspSession::onRcvPeerUdpData(int iTrackIdx, const Buffer::Ptr &pBuf, const struct sockaddr& addr) { inline void RtspSession::onRcvPeerUdpData(int iTrackIdx, const Buffer::Ptr &pBuf, const struct sockaddr& addr) {
//这是rtcp心跳包说明播放器还存活 //这是rtcp心跳包说明播放器还存活
_ticker.resetTime(); _ticker.resetTime();
if(iTrackIdx % 2 == 0){ if(iTrackIdx % 2 == 0){
if(_pushSrc){
handleOneRtp(iTrackIdx / 2,_aTrackInfo[iTrackIdx / 2],( unsigned char *)pBuf->data(),pBuf->size()); handleOneRtp(iTrackIdx / 2,_aTrackInfo[iTrackIdx / 2],( unsigned char *)pBuf->data(),pBuf->size());
}
//这是rtp探测包 //这是rtp探测包
if(!_bGotAllPeerUdp){ if(!_bGotAllPeerUdp){
@ -1038,8 +1042,6 @@ inline void RtspSession::onRcvPeerUdpData(int iTrackIdx, const Buffer::Ptr &pBuf
} }
} }
} }
}else{
// TraceL << "rtcp数据包" << (iTrackIdx-1)/2 ;
} }
} }