From 0a19627d86984c5f208b67da547ffbd7ef9dc618 Mon Sep 17 00:00:00 2001 From: leibnewton <787627654@qq.com> Date: Wed, 25 Oct 2023 15:14:08 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DstartSendRtp=E6=88=90?= =?UTF-8?q?=E5=8A=9F=E5=90=8Eudp=E5=A5=97=E6=8E=A5=E5=AD=97=E8=A2=AB?= =?UTF-8?q?=E5=85=B3=E9=97=AD=E7=9A=84=E9=97=AE=E9=A2=98=20(#2468=20#2924)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 对端端口未打开,udp得到connection refused的错误而关闭。 --- src/Rtp/RtpSender.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Rtp/RtpSender.cpp b/src/Rtp/RtpSender.cpp index a102d5e2..172c9f2e 100644 --- a/src/Rtp/RtpSender.cpp +++ b/src/Rtp/RtpSender.cpp @@ -140,7 +140,7 @@ void RtpSender::startSend(const MediaSourceEvent::SendRtpArgs &args, const funct cb(0, SockException(Err_other, ex.what())); return; } - strong_self->_socket_rtp->bindPeerAddr((struct sockaddr *)&addr); + strong_self->_socket_rtp->bindPeerAddr((struct sockaddr *)&addr, 0, true); strong_self->onConnect(); cb(strong_self->_socket_rtp->get_local_port(), SockException()); }); @@ -182,7 +182,7 @@ void RtpSender::createRtcpSocket() { case AF_INET6: ((sockaddr_in6 *)&addr)->sin6_port = htons(ntohs(((sockaddr_in6 *)&addr)->sin6_port) + 1); break; default: assert(0); break; } - _socket_rtcp->bindPeerAddr((struct sockaddr *)&addr); + _socket_rtcp->bindPeerAddr((struct sockaddr *)&addr, 0, true); _rtcp_context = std::make_shared(); weak_ptr weak_self = shared_from_this(); @@ -349,4 +349,4 @@ void RtpSender::setOnClose(std::function } }//namespace mediakit -#endif// defined(ENABLE_RTPPROXY) \ No newline at end of file +#endif// defined(ENABLE_RTPPROXY)