确保rtp端口为偶数

This commit is contained in:
xiongziliang 2020-05-12 09:26:02 +08:00
parent 4ab270ca10
commit f303ab3222
1 changed files with 8 additions and 0 deletions

View File

@ -640,6 +640,14 @@ void RtspSession::handleReq_Setup(const Parser &parser) {
send_NotAcceptable();
throw SockException(Err_shutdown, "open rtcp socket failed");
}
if(pSockRtp->get_local_port() % 2 != 0){
//如果rtp端口不是偶数那么与rtcp端口互换目的是兼容一些要求严格的播放器
Socket::Ptr tmp = pSockRtp;
pSockRtp = pSockRtcp;
pSockRtcp = tmp;
}
_apRtpSock[trackIdx] = pSockRtp;
_apRtcpSock[trackIdx] = pSockRtcp;
//设置客户端内网端口信息