mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-26 04:31:37 +08:00
添加RTP异常包处理逻辑
This commit is contained in:
parent
9ce5c146a9
commit
c0d3185a38
@ -98,7 +98,14 @@ bool RtpReceiver::handleOneRtp(int iTrackidx,SdpTrack::Ptr &track, unsigned char
|
||||
ext = (AV_RB16(pucData + rtppt.offset - 2) + 1) << 2;
|
||||
rtppt.offset += ext;
|
||||
}
|
||||
|
||||
if(rtppt.length - rtppt.offset <= 0){
|
||||
WarnL << "无有效负载的rtp包:" << rtppt.length << "<=" << (int)rtppt.offset;
|
||||
return false;
|
||||
}
|
||||
|
||||
if(uiLen > sizeof(rtppt.payload) - 4){
|
||||
WarnL << "超长的rtp包:" << uiLen << ">" << sizeof(rtppt.payload) - 4;
|
||||
return false;
|
||||
}
|
||||
memcpy(rtppt.payload + 4, pucData, uiLen);
|
||||
|
@ -447,6 +447,7 @@ void RtspPlayer::onWholeRtspPacket(Parser &parser) {
|
||||
void RtspPlayer::onRtpPacket(const char *data, uint64_t len) {
|
||||
if(len > 1600){
|
||||
//没有大于MTU的包
|
||||
WarnL << "大于MTU的RTP包:" << len << ",来自:" << get_peer_ip();
|
||||
return;
|
||||
}
|
||||
int trackIdx = -1;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2016 xiongziliang <771730766@qq.com>
|
||||
@ -188,6 +188,7 @@ void RtspSession::onRtpPacket(const char *data, uint64_t len) {
|
||||
}
|
||||
if(len > 1600){
|
||||
//没有大于MTU的包
|
||||
WarnL << "大于MTU的RTP包:" << len << ",来自:" << get_peer_ip();
|
||||
return;
|
||||
}
|
||||
int trackIdx = -1;
|
||||
|
@ -46,7 +46,7 @@ public:
|
||||
uint32_t timeStamp;
|
||||
uint16_t sequence;
|
||||
uint32_t ssrc;
|
||||
uint8_t payload[1560];
|
||||
uint8_t payload[1600];
|
||||
uint8_t offset;
|
||||
TrackType type;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user