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

for #133, finish rtsp sdp, start rtp.

This commit is contained in:
winlin 2015-02-17 22:20:47 +08:00
parent f14af45413
commit 45c0b12958
3 changed files with 48 additions and 3 deletions

View file

@ -486,6 +486,11 @@ bool SrsRtspRequest::is_setup()
return method == __SRS_METHOD_SETUP;
}
bool SrsRtspRequest::is_record()
{
return method == __SRS_METHOD_RECORD;
}
SrsRtspResponse::SrsRtspResponse(int cseq)
{
seq = cseq;
@ -513,6 +518,11 @@ int SrsRtspResponse::encode(stringstream& ss)
<< "Pragma: no-cache" << __SRS_RTSP_CRLF
<< "Server: " << RTMP_SIG_SRS_SERVER << __SRS_RTSP_CRLF;
// session if specified.
if (!session.empty()) {
ss << __SRS_TOKEN_SESSION << ":" << session << __SRS_RTSP_CRLF;
}
if ((ret = encode_header(ss)) != ERROR_SUCCESS) {
srs_error("rtsp: encode header failed. ret=%d", ret);
return ret;
@ -730,6 +740,13 @@ int SrsRtspStack::do_recv_message(SrsRtspRequest* req)
srs_error("rtsp: parse transport failed, transport=%s. ret=%d", transport.c_str(), ret);
return ret;
}
} else if (token == __SRS_TOKEN_SESSION) {
if ((ret = recv_token_eof(req->session)) != ERROR_SUCCESS) {
if (!srs_is_client_gracefully_close(ret)) {
srs_error("rtsp: parse %s failed. ret=%d", __SRS_TOKEN_SESSION, ret);
}
return ret;
}
} else {
// unknown header name, parse util EOF.
SrsRtspTokenState state = SrsRtspTokenStateNormal;

View file

@ -337,6 +337,10 @@ public:
* assumed. It is interpreted according to [H14.14].
*/
long content_length;
/**
* the session id.
*/
std::string session;
/**
* the sdp in announce, NULL for no sdp.
@ -357,6 +361,7 @@ public:
virtual bool is_options();
virtual bool is_announce();
virtual bool is_setup();
virtual bool is_record();
};
/**
@ -401,6 +406,10 @@ public:
* for retransmissions of the same request).
*/
long seq;
/**
* the session id.
*/
std::string session;
public:
SrsRtspResponse(int cseq);
virtual ~SrsRtspResponse();