mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2026-07-06 11:38:11 +08:00
复用rtp/rtcp判断逻辑过滤非rtp包: #2247
This commit is contained in:
@@ -70,14 +70,9 @@ RtpProcess::~RtpProcess() {
|
||||
}
|
||||
}
|
||||
|
||||
static bool is_rtp(const char *buf) {
|
||||
RtpHeader *header = (RtpHeader *)buf;
|
||||
return ((header->pt < 64) || (header->pt >= 96));
|
||||
}
|
||||
|
||||
bool RtpProcess::inputRtp(bool is_udp, const Socket::Ptr &sock, const char *data, size_t len, const struct sockaddr *addr, uint64_t *dts_out) {
|
||||
if (!is_rtp(data)) {
|
||||
WarnL << "Not rtp packet";
|
||||
if (!isRtp(data, len)) {
|
||||
WarnP(this) << "Not rtp packet";
|
||||
return false;
|
||||
}
|
||||
if (_sock != sock) {
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "RtpSession.h"
|
||||
#include "RtpSelector.h"
|
||||
#include "Network/TcpServer.h"
|
||||
#include "Rtsp/Rtsp.h"
|
||||
#include "Rtsp/RtpReceiver.h"
|
||||
#include "Common/config.h"
|
||||
|
||||
@@ -93,6 +94,10 @@ void RtpSession::onRtpPacket(const char *data, size_t len) {
|
||||
}
|
||||
}
|
||||
if (!_process) {
|
||||
if (!isRtp(data, len)) {
|
||||
WarnP(this) << "Not rtp packet";
|
||||
return;
|
||||
}
|
||||
//未设置ssrc时,尝试获取ssrc
|
||||
if (!_ssrc && !RtpSelector::getSSRC(data, len, _ssrc)) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user