@ -45,8 +45,6 @@ using namespace srs_internal;
// @global the version to identify the core.
const char * _srs_version = " XCORE- " RTMP_SIG_SRS_SERVER ;
# define SRS_WIKI_URL_LOG "https: //github.com/ossrs/srs/wiki/v1_CN_SrsLog"
// when user config an invalid value, macros to perfer true or false.
# define SRS_CONF_PERFER_FALSE(conf_arg) conf_arg == "on"
# define SRS_CONF_PERFER_TRUE(conf_arg) conf_arg != "off"
@ -1408,17 +1406,6 @@ srs_error_t SrsConfig::reload_vhost(SrsConfDirective* old_root)
}
srs_trace ( " vhost %s reload dvr success. " , vhost . c_str ( ) ) ;
}
// dvr_apply, the dynamic dvr filter.
if ( true ) {
// we must reload the dvr_apply, for it's apply to specified stream,
// and we donot want one stream reload take effect on another one.
// @see https://github.com/ossrs/srs/issues/459#issuecomment-140296597
SrsConfDirective * nda = new_vhost - > get ( " dvr " ) ? new_vhost - > get ( " dvr " ) - > get ( " dvr_apply " ) : NULL ;
SrsConfDirective * oda = old_vhost - > get ( " dvr " ) ? old_vhost - > get ( " dvr " ) - > get ( " dvr_apply " ) : NULL ;
if ( ! srs_directive_equals ( nda , oda ) & & ( err = do_reload_vhost_dvr_apply ( vhost ) ) ! = srs_success ) {
return srs_error_wrap ( err , " reload dvr_apply " ) ;
}
}
// exec, only one per vhost
if ( ! srs_directive_equals ( new_vhost - > get ( " exec " ) , old_vhost - > get ( " exec " ) ) ) {
@ -2009,7 +1996,7 @@ srs_error_t SrsConfig::parse_options(int argc, char** argv)
return srs_error_new ( ERROR_SYSTEM_CONFIG_INVALID , " no log file " ) ;
}
if ( get_log_tank_file ( ) ) {
srs_trace ( " you can check log by: tail - f %s (@see %s) " , log_filename . c_str ( ) , SRS_WIKI_URL_LOG ) ;
srs_trace ( " you can check log by: tail - n 30 -f %s " , log_filename . c_str ( ) ) ;
srs_trace ( " please check SRS by: ./etc/init.d/srs status " ) ;
} else {
srs_trace ( " write log to console " ) ;
@ -3203,64 +3190,6 @@ srs_error_t SrsConfig::raw_enable_vhost(string vhost, bool& applied)
return err ;
}
srs_error_t SrsConfig : : raw_enable_dvr ( string vhost , string stream , bool & applied )
{
srs_error_t err = srs_success ;
applied = false ;
SrsConfDirective * conf = root - > get ( " vhost " , vhost ) ;
srs_assert ( conf ) ;
conf = conf - > get_or_create ( " dvr " ) - > get_or_create ( " dvr_apply " ) ;
if ( conf - > args . size ( ) = = 1 & & ( conf - > arg0 ( ) = = " all " | | conf - > arg0 ( ) = = " none " ) ) {
conf - > args . clear ( ) ;
}
if ( std : : find ( conf - > args . begin ( ) , conf - > args . end ( ) , stream ) = = conf - > args . end ( ) ) {
conf - > args . push_back ( stream ) ;
}
if ( ( err = do_reload_vhost_dvr_apply ( vhost ) ) ! = srs_success ) {
return srs_error_wrap ( err , " reload vhost dvr " ) ;
}
applied = true ;
return err ;
}
srs_error_t SrsConfig : : raw_disable_dvr ( string vhost , string stream , bool & applied )
{
srs_error_t err = srs_success ;
applied = false ;
SrsConfDirective * conf = root - > get ( " vhost " , vhost ) ;
srs_assert ( conf ) ;
conf = conf - > get_or_create ( " dvr " ) - > get_or_create ( " dvr_apply " ) ;
std : : vector < string > : : iterator it ;
if ( ( it = std : : find ( conf - > args . begin ( ) , conf - > args . end ( ) , stream ) ) ! = conf - > args . end ( ) ) {
conf - > args . erase ( it ) ;
}
if ( conf - > args . empty ( ) ) {
conf - > args . push_back ( " none " ) ;
}
if ( ( err = do_reload_vhost_dvr_apply ( vhost ) ) ! = srs_success ) {
return srs_error_wrap ( err , " reload vhost dvr " ) ;
}
applied = true ;
return err ;
}
// LCOV_EXCL_STOP
srs_error_t SrsConfig : : do_reload_listen ( )
@ -3428,22 +3357,6 @@ srs_error_t SrsConfig::do_reload_vhost_removed(string vhost)
return err ;
}
srs_error_t SrsConfig : : do_reload_vhost_dvr_apply ( string vhost )
{
srs_error_t err = srs_success ;
vector < ISrsReloadHandler * > : : iterator it ;
for ( it = subscribes . begin ( ) ; it ! = subscribes . end ( ) ; + + it ) {
ISrsReloadHandler * subscribe = * it ;
if ( ( err = subscribe - > on_reload_vhost_dvr_apply ( vhost ) ) ! = srs_success ) {
return srs_error_wrap ( err , " vhost %s notify subscribes dvr_apply failed " , vhost . c_str ( ) ) ;
}
}
srs_trace ( " vhost %s reload dvr_apply success. " , vhost . c_str ( ) ) ;
return err ;
}
string SrsConfig : : config ( )
{
return config_file ;
@ -3704,9 +3617,17 @@ srs_error_t SrsConfig::check_normal_config()
return srs_error_new ( ERROR_SYSTEM_CONFIG_INVALID , " listen requires params " ) ;
}
for ( int i = 0 ; i < ( int ) listens . size ( ) ; i + + ) {
string port = listens [ i ] ;
if ( port . empty ( ) | | : : atoi ( port . c_str ( ) ) < = 0 ) {
return srs_error_new ( ERROR_SYSTEM_CONFIG_INVALID , " listen.port=%s is invalid " , port . c_str ( ) ) ;
int port ; string ip ;
srs_parse_endpoint ( listens [ i ] , ip , port ) ;
// check ip
if ( ! srs_check_ip_addr_valid ( ip ) ) {
return srs_error_new ( ERROR_SYSTEM_CONFIG_INVALID , " listen.ip=%s is invalid " , ip . c_str ( ) ) ;
}
// check port
if ( port < = 0 ) {
return srs_error_new ( ERROR_SYSTEM_CONFIG_INVALID , " listen.port=%d is invalid " , port ) ;
}
}
}
@ -3773,7 +3694,7 @@ srs_error_t SrsConfig::check_normal_config()
return srs_error_new ( ERROR_SYSTEM_CONFIG_INVALID , " log file is empty " ) ;
}
if ( get_log_tank_file ( ) ) {
srs_trace ( " you can check log by: tail - f %s (@see %s) " , log_filename . c_str ( ) , SRS_WIKI_URL_LOG ) ;
srs_trace ( " you can check log by: tail - n 30 -f %s " , log_filename . c_str ( ) ) ;
srs_trace ( " please check SRS by: ./etc/init.d/srs status " ) ;
} else {
srs_trace ( " write log to console " ) ;