1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-02-14 20:31:56 +00:00

fix bug, add param for generating tc url and add play stream to make-bandwidth checking success (#790)

This commit is contained in:
ME_Kun_Han 2017-03-04 14:44:34 +08:00 committed by winlin
parent 8ab43b3e78
commit 3562424ee3
4 changed files with 17 additions and 12 deletions

View file

@ -69,6 +69,11 @@ int do_check(srs_rtmp_t rtmp)
srs_human_trace("Retrieve server version failed, ret=%d", ret);
return ret;
}
if ((ret = srs_rtmp_play_stream(rtmp)) != 0) {
srs_human_trace("Play rtmp stream failed. ret=%d", ret);
return ret;
}
if ((ret = srs_rtmp_bandwidth_check(rtmp,
&start_time, &end_time, &play_kbps, &publish_kbps,

View file

@ -753,14 +753,14 @@ int srs_rtmp_connect_app(srs_rtmp_t rtmp)
string tcUrl;
switch(context->schema) {
case srs_url_schema_normal:
tcUrl=srs_generate_normal_tc_url(context->ip, context->vhost, context->app, context->port);
tcUrl=srs_generate_normal_tc_url(context->ip, context->vhost, context->app, context->port, context->param);
break;
case srs_url_schema_via:
tcUrl=srs_generate_via_tc_url(context->ip, context->vhost, context->app, context->port);
tcUrl=srs_generate_via_tc_url(context->ip, context->vhost, context->app, context->port, context->param);
break;
case srs_url_schema_vis:
case srs_url_schema_vis2:
tcUrl=srs_generate_vis_tc_url(context->ip, context->vhost, context->app, context->port);
tcUrl=srs_generate_vis_tc_url(context->ip, context->vhost, context->app, context->port, context->param);
break;
default:
break;

View file

@ -177,19 +177,19 @@ string srs_generate_tc_url(string ip, string vhost, string app, int port, string
return tcUrl;
}
string srs_generate_normal_tc_url(string ip, string vhost, string app, int port)
string srs_generate_normal_tc_url(string ip, string vhost, string app, int port, string param)
{
return "rtmp://" + vhost + ":" + srs_int2str(port) + "/" + app;
return "rtmp://" + vhost + ":" + srs_int2str(port) + "/" + app + (param.empty() ? "" : "?" + param);
}
string srs_generate_via_tc_url(string ip, string vhost, string app, int port)
string srs_generate_via_tc_url(string ip, string vhost, string app, int port, string param)
{
return "rtmp://" + ip + ":" + srs_int2str(port) + "/" + vhost + "/" + app;
return "rtmp://" + ip + ":" + srs_int2str(port) + "/" + vhost + "/" + app + (param.empty() ? "" : "?" + param);
}
string srs_generate_vis_tc_url(string ip, string vhost, string app, int port)
string srs_generate_vis_tc_url(string ip, string vhost, string app, int port, string param)
{
return "rtmp://" + ip + ":" + srs_int2str(port) + "/" + app;
return "rtmp://" + ip + ":" + srs_int2str(port) + "/" + app + (param.empty() ? "" : "?" + param);
}
template<typename T>

View file

@ -89,19 +89,19 @@ extern std::string srs_generate_tc_url(
* srs_detect_tools generate the normal tcUrl
*/
extern std::string srs_generate_normal_tc_url(
std::string ip, std::string vhost, std::string app, int port);
std::string ip, std::string vhost, std::string app, int port, std::string param);
/**
* srs_detect_tools generate the normal tcUrl
*/
extern std::string srs_generate_via_tc_url(
std::string ip, std::string vhost, std::string app, int port);
std::string ip, std::string vhost, std::string app, int port, std::string param);
/**
* srs_detect_tools generate the vis/vis2 tcUrl
*/
extern std::string srs_generate_vis_tc_url(
std::string ip, std::string vhost, std::string app, int port);
std::string ip, std::string vhost, std::string app, int port, std::string param);
/**
* create shared ptr message from bytes.