From dc676657847e4428478045a95580b98150981e90 Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Wed, 8 May 2019 16:24:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BF=BD=E7=95=A5=E9=9D=9E=E6=B3=95=E7=9A=84rt?= =?UTF-8?q?p/rtcp=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Rtsp/RtspSession.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Rtsp/RtspSession.cpp b/src/Rtsp/RtspSession.cpp index feb3a73a..68159991 100644 --- a/src/Rtsp/RtspSession.cpp +++ b/src/Rtsp/RtspSession.cpp @@ -1041,8 +1041,13 @@ inline void RtspSession::onRcvPeerUdpData(int intervaled, const Buffer::Ptr &pBu inline void RtspSession::startListenPeerUdpData(int trackIdx) { weak_ptr weakSelf = dynamic_pointer_cast(shared_from_this()); - - auto onUdpData = [weakSelf](const Buffer::Ptr &pBuf, struct sockaddr *pPeerAddr,int intervaled){ + auto srcIP = inet_addr(get_peer_ip().data()); + auto onUdpData = [weakSelf,srcIP](const Buffer::Ptr &pBuf, struct sockaddr *pPeerAddr,int intervaled){ + if (((struct sockaddr_in *) pPeerAddr)->sin_addr.s_addr != srcIP) { + WarnL << ((intervaled % 2 == 0) ? "收到其他地址的rtp数据:" : "收到其他地址的rtcp数据:") + << inet_ntoa(((struct sockaddr_in *) pPeerAddr)->sin_addr); + return true; + } auto strongSelf=weakSelf.lock(); if(!strongSelf) { return false;