From 4ea756534418638ae4f881d043e14dca4e6722ae Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Sun, 12 Nov 2023 19:53:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DstartSendRtp=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E5=BC=80=E5=90=AFrtcp=E6=97=B6=E8=A7=A6=E5=8F=91?= =?UTF-8?q?=E6=96=AD=E8=A8=80=E5=BC=82=E5=B8=B8=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 此问题由pr(#2924)引入 --- src/Rtp/RtpSender.cpp | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/Rtp/RtpSender.cpp b/src/Rtp/RtpSender.cpp index 172c9f2e..628696fa 100644 --- a/src/Rtp/RtpSender.cpp +++ b/src/Rtp/RtpSender.cpp @@ -173,15 +173,8 @@ void RtpSender::createRtcpSocket() { return; } - struct sockaddr_storage addr; - //目标rtp端口 - SockUtil::get_sock_peer_addr(_socket_rtp->rawFD(), addr); - //绑定目标rtcp端口(目标rtp端口 + 1) - switch (addr.ss_family) { - case AF_INET: ((sockaddr_in *)&addr)->sin_port = htons(ntohs(((sockaddr_in *)&addr)->sin_port) + 1); break; - case AF_INET6: ((sockaddr_in6 *)&addr)->sin6_port = htons(ntohs(((sockaddr_in6 *)&addr)->sin6_port) + 1); break; - default: assert(0); break; - } + // 绑定目标rtcp端口(目标rtp端口 + 1) + auto addr = SockUtil::make_sockaddr(_socket_rtp->get_peer_ip().data(), _socket_rtp->get_peer_port() + 1); _socket_rtcp->bindPeerAddr((struct sockaddr *)&addr, 0, true); _rtcp_context = std::make_shared();