mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2026-06-28 21:52:22 +08:00
复用rtp/rtcp判断逻辑过滤非rtp包: #2247
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
#include "Rtcp/Rtcp.h"
|
||||
#include "Rtcp/RtcpFCI.h"
|
||||
#include "Rtcp/RtcpContext.h"
|
||||
#include "Rtsp/Rtsp.h"
|
||||
#include "Rtsp/RtpReceiver.h"
|
||||
#include "WebRtcTransport.h"
|
||||
|
||||
@@ -287,20 +288,10 @@ std::string WebRtcTransport::getAnswerSdp(const string &offer) {
|
||||
}
|
||||
}
|
||||
|
||||
static bool is_dtls(char *buf) {
|
||||
static bool isDtls(char *buf) {
|
||||
return ((*buf > 19) && (*buf < 64));
|
||||
}
|
||||
|
||||
static bool is_rtp(char *buf) {
|
||||
RtpHeader *header = (RtpHeader *)buf;
|
||||
return ((header->pt < 64) || (header->pt >= 96));
|
||||
}
|
||||
|
||||
static bool is_rtcp(char *buf) {
|
||||
RtpHeader *header = (RtpHeader *)buf;
|
||||
return ((header->pt >= 64) && (header->pt < 96));
|
||||
}
|
||||
|
||||
static string getPeerAddress(RTC::TransportTuple *tuple) {
|
||||
return SockUtil::inet_ntoa(tuple);
|
||||
}
|
||||
@@ -315,11 +306,11 @@ void WebRtcTransport::inputSockData(char *buf, int len, RTC::TransportTuple *tup
|
||||
_ice_server->ProcessStunPacket(packet.get(), tuple);
|
||||
return;
|
||||
}
|
||||
if (is_dtls(buf)) {
|
||||
if (isDtls(buf)) {
|
||||
_dtls_transport->ProcessDtlsData((uint8_t *)buf, len);
|
||||
return;
|
||||
}
|
||||
if (is_rtp(buf)) {
|
||||
if (isRtp(buf, len)) {
|
||||
if (!_srtp_session_recv) {
|
||||
WarnL << "received rtp packet when dtls not completed from:" << getPeerAddress(tuple);
|
||||
return;
|
||||
@@ -329,7 +320,7 @@ void WebRtcTransport::inputSockData(char *buf, int len, RTC::TransportTuple *tup
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (is_rtcp(buf)) {
|
||||
if (isRtcp(buf, len)) {
|
||||
if (!_srtp_session_recv) {
|
||||
WarnL << "received rtcp packet when dtls not completed from:" << getPeerAddress(tuple);
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user