修复rtsp服务可能无法发送rtp给nat内播放器的bug (#2737 #2740)

在udp connect rtsp播放器内网端口后,可能导致过滤掉其公网端口发送的打洞包;
从未无法完成与rtsp播放器udp端口的双向通信。
Socket::bindPeerAddr修改成软绑定时,只是保存发送目标地址,不会导致打洞包的过滤。
This commit is contained in:
夏楚 2023-08-05 09:25:35 +08:00 committed by GitHub
parent 2935bc1932
commit ff225114ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

@ -1 +1 @@
Subproject commit 79db405ba43c29453c60c3e054d863ce6bd1ef29 Subproject commit d2016522a0e4b1d8df51a78b7415fe148f7245ca

View File

@ -721,11 +721,11 @@ void RtspSession::handleReq_Setup(const Parser &parser) {
auto peerAddr = SockUtil::make_sockaddr(get_peer_ip().data(), ui16RtpPort); auto peerAddr = SockUtil::make_sockaddr(get_peer_ip().data(), ui16RtpPort);
//设置rtp发送目标地址 //设置rtp发送目标地址
pr.first->bindPeerAddr((struct sockaddr *) (&peerAddr)); pr.first->bindPeerAddr((struct sockaddr *) (&peerAddr), 0, true);
//设置rtcp发送目标地址 //设置rtcp发送目标地址
peerAddr = SockUtil::make_sockaddr(get_peer_ip().data(), ui16RtcpPort); peerAddr = SockUtil::make_sockaddr(get_peer_ip().data(), ui16RtcpPort);
pr.second->bindPeerAddr((struct sockaddr *) (&peerAddr)); pr.second->bindPeerAddr((struct sockaddr *) (&peerAddr), 0, true);
//尝试获取客户端nat映射地址 //尝试获取客户端nat映射地址
startListenPeerUdpData(trackIdx); startListenPeerUdpData(trackIdx);