修复某些rtsp服务器返回不规范导致兼容性问题

This commit is contained in:
xiongziliang 2019-07-11 11:53:11 +08:00
parent 1df3859c98
commit 6518398aa5

View File

@ -280,7 +280,7 @@ void RtspPlayer::handleResSETUP(const Parser &parser, unsigned int uiTrackIndex)
} }
auto strTransport = parser["Transport"]; auto strTransport = parser["Transport"];
if(strTransport.find("TCP") != string::npos){ if(strTransport.find("TCP") != string::npos || strTransport.find("interleaved") != string::npos){
_eType = Rtsp::RTP_TCP; _eType = Rtsp::RTP_TCP;
}else if(strTransport.find("multicast") != string::npos){ }else if(strTransport.find("multicast") != string::npos){
_eType = Rtsp::RTP_MULTICAST; _eType = Rtsp::RTP_MULTICAST;
@ -314,6 +314,9 @@ void RtspPlayer::handleResSETUP(const Parser &parser, unsigned int uiTrackIndex)
SockUtil::joinMultiAddr(fd, multiAddr.data(),get_local_ip().data()); SockUtil::joinMultiAddr(fd, multiAddr.data(),get_local_ip().data());
} }
} else { } else {
if(!pRtpSockRef || !pRtcpSockRef){
throw std::runtime_error("udp socket not created yet when rtp over udp");
}
//udp单播 //udp单播
struct sockaddr_in rtpto; struct sockaddr_in rtpto;
rtpto.sin_port = ntohs(rtp_port); rtpto.sin_port = ntohs(rtp_port);