1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

For 2034, GB28181: Support transport over TCP

This commit is contained in:
yinjiaoyuan 2020-11-15 22:50:59 +08:00 committed by winlin
parent 751dab56d8
commit fe65c7bf84
12 changed files with 807 additions and 46 deletions

View file

@ -842,7 +842,7 @@ void SrsSipStack::resp_status(stringstream& ss, SrsSipRequest *req)
}
void SrsSipStack::req_invite(stringstream& ss, SrsSipRequest *req, string ip, int port, uint32_t ssrc)
void SrsSipStack::req_invite(stringstream& ss, SrsSipRequest *req, string ip, int port, uint32_t ssrc, bool tcpFlag)
{
/*
//request: sip-agent <-------INVITE------ sip-server
@ -919,23 +919,45 @@ void SrsSipStack::req_invite(stringstream& ss, SrsSipRequest *req, string ip, in
sprintf(_ssrc, "%010d", ssrc);
std::stringstream sdp;
sdp << "v=0" << SRS_RTSP_CRLF
<< "o=" << req->serial << " 0 0 IN IP4 " << ip << SRS_RTSP_CRLF
<< "s=Play" << SRS_RTSP_CRLF
<< "c=IN IP4 " << ip << SRS_RTSP_CRLF
<< "t=0 0" << SRS_RTSP_CRLF
//TODO 97 98 99 current no support
//<< "m=video " << port <<" RTP/AVP 96 97 98 99" << SRS_RTSP_CRLF
<< "m=video " << port <<" RTP/AVP 96" << SRS_RTSP_CRLF
<< "a=recvonly" << SRS_RTSP_CRLF
<< "a=rtpmap:96 PS/90000" << SRS_RTSP_CRLF
//TODO: current no support
//<< "a=rtpmap:97 MPEG4/90000" << SRS_RTSP_CRLF
//<< "a=rtpmap:98 H264/90000" << SRS_RTSP_CRLF
//<< "a=rtpmap:99 H265/90000" << SRS_RTSP_CRLF
//<< "a=streamMode:MAIN\r\n"
//<< "a=filesize:0\r\n"
<< "y=" << _ssrc << SRS_RTSP_CRLF;
if (!tcpFlag){
sdp << "v=0" << SRS_RTSP_CRLF
<< "o=" << req->serial << " 0 0 IN IP4 " << ip << SRS_RTSP_CRLF
<< "s=Play" << SRS_RTSP_CRLF
<< "c=IN IP4 " << ip << SRS_RTSP_CRLF
<< "t=0 0" << SRS_RTSP_CRLF
//TODO 97 98 99 current no support
//<< "m=video " << port <<" RTP/AVP 96 97 98 99" << SRS_RTSP_CRLF
<< "m=video " << port <<" RTP/AVP 96" << SRS_RTSP_CRLF
<< "a=recvonly" << SRS_RTSP_CRLF
<< "a=rtpmap:96 PS/90000" << SRS_RTSP_CRLF
//TODO: current no support
//<< "a=rtpmap:97 MPEG4/90000" << SRS_RTSP_CRLF
//<< "a=rtpmap:98 H264/90000" << SRS_RTSP_CRLF
//<< "a=rtpmap:99 H265/90000" << SRS_RTSP_CRLF
//<< "a=streamMode:MAIN\r\n"
//<< "a=filesize:0\r\n"
<< "y=" << _ssrc << SRS_RTSP_CRLF;
} else {
sdp << "v=0" << SRS_RTSP_CRLF
<< "o=" << req->serial << " 0 0 IN IP4 " << ip << SRS_RTSP_CRLF
<< "s=Play" << SRS_RTSP_CRLF
<< "c=IN IP4 " << ip << SRS_RTSP_CRLF
<< "t=0 0" << SRS_RTSP_CRLF
//TODO 97 98 99 current no support
//<< "m=video " << port <<" RTP/AVP 96 97 98 99" << SRS_RTSP_CRLF
//<< "m=video " << port <<" RTP/AVP 96" << SRS_RTSP_CRLF
<< "m=video " << port << " TCP/RTP/AVP 96" << SRS_RTSP_CRLF
//<< "m=video " << port << " TCP/RTP/AVP 98" << SRS_RTSP_CRLF
<< "a=recvonly" << SRS_RTSP_CRLF
<< "a=rtpmap:96 PS/90000" << SRS_RTSP_CRLF
//TODO: current no support
//<< "a=rtpmap:97 MPEG4/90000" << SRS_RTSP_CRLF
//<< "a=rtpmap:98 H264/90000" << SRS_RTSP_CRLF
//<< "a=rtpmap:99 H265/90000" << SRS_RTSP_CRLF
//<< "a=streamMode:MAIN\r\n"
//<< "a=filesize:0\r\n"
<< "y=" << _ssrc << SRS_RTSP_CRLF;
}
std::stringstream from, to, uri;

View file

@ -169,7 +169,7 @@ public:
//request: request sent by the sip-server, wait for sip-agent response
virtual void req_invite(std::stringstream& ss, SrsSipRequest *req, std::string ip,
int port, uint32_t ssrc);
int port, uint32_t ssrc, bool tcpFlag);
virtual void req_ack(std::stringstream& ss, SrsSipRequest *req);
virtual void req_bye(std::stringstream& ss, SrsSipRequest *req);
virtual void req_401_unauthorized(std::stringstream& ss, SrsSipRequest *req);