From 034dbbf7bac1182ce8bafad6ee5a0f1edbc61482 Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Thu, 27 Jun 2019 12:53:35 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Drtp=E6=89=93=E6=B4=9E?= =?UTF-8?q?=E5=8C=85=E7=9B=B8=E5=85=B3=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Rtsp/RtspSession.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Rtsp/RtspSession.cpp b/src/Rtsp/RtspSession.cpp index 5e72f038..95ca8816 100644 --- a/src/Rtsp/RtspSession.cpp +++ b/src/Rtsp/RtspSession.cpp @@ -926,19 +926,20 @@ inline void RtspSession::onRcvPeerUdpData(int intervaled, const Buffer::Ptr &pBu if(intervaled % 2 == 0){ if(_pushSrc){ + //这是rtsp推流上来的rtp包 handleOneRtp(intervaled / 2,_aTrackInfo[intervaled / 2],( unsigned char *)pBuf->data(),pBuf->size()); - }else if(_udpSockConnected.count(intervaled)){ - //这是rtp打洞包 + }else if(!_udpSockConnected.count(intervaled)){ + //这是rtsp播放器的rtp打洞包 _udpSockConnected.emplace(intervaled); _apRtpSock[intervaled / 2]->setSendPeerAddr(&addr); } }else{ //rtcp包 - if(_udpSockConnected.count(intervaled)){ + if(!_udpSockConnected.count(intervaled)){ + _udpSockConnected.emplace(intervaled); _apRtcpSock[(intervaled - 1) / 2]->setSendPeerAddr(&addr); } - onRtcpPacket((intervaled - 1) / 2, _aTrackInfo[(intervaled - 1) / 2], (unsigned char *) pBuf->data(), - pBuf->size()); + onRtcpPacket((intervaled - 1) / 2, _aTrackInfo[(intervaled - 1) / 2], (unsigned char *) pBuf->data(),pBuf->size()); } }