确保rtp端口为偶数,rtcp端口为奇数

This commit is contained in:
xiongziliang 2019-11-19 10:20:57 +08:00
parent 517f3c229c
commit 2eb64d2c39

View File

@ -277,6 +277,13 @@ void RtspPlayer::createUdpSockIfNecessary(int track_idx){
throw std::runtime_error("open rtcp sock failed");
}
}
if(rtpSockRef->get_local_port() % 2 != 0){
//如果rtp端口不是偶数那么与rtcp端口互换目的是兼容一些要求严格的服务器
Socket::Ptr tmp = rtpSockRef;
rtpSockRef = rtcpSockRef;
rtcpSockRef = tmp;
}
}