确保rtp/rtcp端口偶奇约定:#292

This commit is contained in:
xiongziliang 2020-05-12 10:37:23 +08:00
parent 8c46688886
commit 7102b85d67

View File

@ -373,7 +373,7 @@ std::pair<Socket::Ptr, Socket::Ptr> makeSockPair_l(const EventPoller::Ptr &polle
}
//是否是偶数
bool even_numbers = pSockRtp->get_local_port() % 2 != 0;
bool even_numbers = pSockRtp->get_local_port() % 2 == 0;
auto pSockRtcp = std::make_shared<Socket>(poller);
if (!pSockRtcp->bindUdpSock(pSockRtp->get_local_port() + (even_numbers ? 1 : -1), local_ip.data())) {
//分配端口失败