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

use system utility for string finds

This commit is contained in:
winlin 2015-10-13 16:06:37 +08:00
parent ca73534d7e
commit d9f991ed2f
16 changed files with 111 additions and 112 deletions

View file

@ -270,10 +270,7 @@ int SrsRtspConn::do_cycle()
if ((pos = rtsp_tcUrl.rfind(".sdp")) != string::npos) {
rtsp_tcUrl = rtsp_tcUrl.substr(0, pos);
}
if ((pos = rtsp_tcUrl.rfind("/")) != string::npos) {
rtsp_stream = rtsp_tcUrl.substr(pos + 1);
rtsp_tcUrl = rtsp_tcUrl.substr(0, pos);
}
srs_parse_rtmp_url(rtsp_tcUrl, rtsp_tcUrl, rtsp_stream);
srs_assert(req->sdp);
video_id = ::atoi(req->sdp->video_stream_id.c_str());
@ -651,8 +648,6 @@ int SrsRtspConn::connect()
// parse uri
if (!req) {
req = new SrsRequest();
std::string schema, host, vhost, app, port, param;
srs_discovery_tc_url(rtsp_tcUrl, schema, host, vhost, app, port, param);
@ -660,19 +655,10 @@ int SrsRtspConn::connect()
std::string output = output_template;
output = srs_string_replace(output, "[app]", app);
output = srs_string_replace(output, "[stream]", rtsp_stream);
size_t pos = string::npos;
string uri = req->tcUrl = output;
// tcUrl, stream
if ((pos = uri.rfind("/")) != string::npos) {
req->stream = uri.substr(pos + 1);
req->tcUrl = uri = uri.substr(0, pos);
}
srs_discovery_tc_url(req->tcUrl,
req->schema, req->host, req->vhost, req->app, req->port,
req->param);
req = new SrsRequest();
srs_parse_rtmp_url(output, req->tcUrl, req->stream);
srs_discovery_tc_url(req->tcUrl, req->schema, req->host, req->vhost, req->app, req->port, req->param);
}
// connect host.