mirror of
				https://github.com/ossrs/srs.git
				synced 2025-03-09 15:49:59 +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:
		
							parent
							
								
									8ab43b3e78
								
							
						
					
					
						commit
						3562424ee3
					
				
					 4 changed files with 17 additions and 12 deletions
				
			
		| 
						 | 
				
			
			@ -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,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue