Commit 75713931 by xiongziliang

完善注释

parent d0d73098
...@@ -233,12 +233,13 @@ void RtspPlayer::handleResDESCRIBE(const Parser& parser) { ...@@ -233,12 +233,13 @@ void RtspPlayer::handleResDESCRIBE(const Parser& parser) {
sendSetup(0); sendSetup(0);
} }
//有必的情况下创建udp端口 //有必的情况下创建udp端口
void RtspPlayer::createUdpSockIfNecessary(int track_idx){ void RtspPlayer::createUdpSockIfNecessary(int track_idx){
auto &rtpSockRef = _apRtpSock[track_idx]; auto &rtpSockRef = _apRtpSock[track_idx];
auto &rtcpSockRef = _apRtcpSock[track_idx]; auto &rtcpSockRef = _apRtcpSock[track_idx];
if(!rtpSockRef){ if(!rtpSockRef){
rtpSockRef.reset(new Socket(getPoller())); rtpSockRef.reset(new Socket(getPoller()));
//rtp随机端口
if (!rtpSockRef->bindUdpSock(0, get_local_ip().data())) { if (!rtpSockRef->bindUdpSock(0, get_local_ip().data())) {
rtpSockRef.reset(); rtpSockRef.reset();
throw std::runtime_error("open rtp sock failed"); throw std::runtime_error("open rtp sock failed");
...@@ -247,6 +248,7 @@ void RtspPlayer::createUdpSockIfNecessary(int track_idx){ ...@@ -247,6 +248,7 @@ void RtspPlayer::createUdpSockIfNecessary(int track_idx){
if(!rtcpSockRef){ if(!rtcpSockRef){
rtcpSockRef.reset(new Socket(getPoller())); rtcpSockRef.reset(new Socket(getPoller()));
//rtcp端口为rtp端口+1,目的是为了兼容某些服务器,其实更推荐随机端口
if (!rtcpSockRef->bindUdpSock(rtpSockRef->get_local_port() + 1, get_local_ip().data())) { if (!rtcpSockRef->bindUdpSock(rtpSockRef->get_local_port() + 1, get_local_ip().data())) {
rtcpSockRef.reset(); rtcpSockRef.reset();
throw std::runtime_error("open rtcp sock failed"); throw std::runtime_error("open rtcp sock failed");
......
...@@ -242,12 +242,12 @@ bool RtspPusher::handleAuthenticationFailure(const string &paramsStr) { ...@@ -242,12 +242,12 @@ bool RtspPusher::handleAuthenticationFailure(const string &paramsStr) {
return false; return false;
} }
//有必要的情况下创建udp端口
//有必须的情况下创建udp端口
void RtspPusher::createUdpSockIfNecessary(int track_idx){ void RtspPusher::createUdpSockIfNecessary(int track_idx){
auto &rtpSockRef = _apUdpSock[track_idx]; auto &rtpSockRef = _apUdpSock[track_idx];
if(!rtpSockRef){ if(!rtpSockRef){
rtpSockRef.reset(new Socket(getPoller())); rtpSockRef.reset(new Socket(getPoller()));
//rtp随机端口
if (!rtpSockRef->bindUdpSock(0, get_local_ip().data())) { if (!rtpSockRef->bindUdpSock(0, get_local_ip().data())) {
rtpSockRef.reset(); rtpSockRef.reset();
throw std::runtime_error("open rtp sock failed"); throw std::runtime_error("open rtp sock failed");
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论