Toggle navigation
Toggle navigation
此项目
正在载入...
Sign in
胡斌
/
srs
转到一个项目
Toggle navigation
项目
群组
代码片段
帮助
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
winlin
2014-07-18 10:50:02 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
1accd8c790c14ee79748fbd5b3128a588b6f556a
1accd8c7
1 parent
f572531e
refine config, add comments.
显示空白字符变更
内嵌
并排对比
正在显示
2 个修改的文件
包含
199 行增加
和
177 行删除
trunk/src/app/srs_app_config.cpp
trunk/src/app/srs_app_config.hpp
trunk/src/app/srs_app_config.cpp
查看文件 @
1accd8c
...
...
@@ -1431,91 +1431,113 @@ vector<SrsConfDirective*> SrsConfig::get_vhosts()
return
vhosts
;
}
SrsConfDirective
*
SrsConfig
::
get_vhost_on_connect
(
string
vhost
)
bool
SrsConfig
::
get_vhost_enabled
(
string
vhost
)
{
SrsConfDirective
*
conf
=
get_vhost
(
vhost
);
SrsConfDirective
*
vhost_
conf
=
get_vhost
(
vhost
);
if
(
!
conf
)
{
return
NULL
;
return
get_vhost_enabled
(
vhost_conf
);
}
bool
SrsConfig
::
get_vhost_enabled
(
SrsConfDirective
*
vhost
)
{
if
(
!
vhost
)
{
return
false
;
}
conf
=
conf
->
get
(
"http_hooks
"
);
SrsConfDirective
*
conf
=
vhost
->
get
(
"enabled
"
);
if
(
!
conf
)
{
return
NULL
;
return
true
;
}
SrsConfDirective
*
enabled
=
conf
->
get
(
"enabled"
);
if
(
!
enabled
||
enabled
->
arg0
()
!=
"on"
)
{
return
NULL
;
if
(
conf
->
arg0
()
==
"off"
)
{
return
false
;
}
return
conf
->
get
(
"on_connect"
)
;
return
true
;
}
SrsConfDirective
*
SrsConfig
::
get_vhost_on_clos
e
(
string
vhost
)
bool
SrsConfig
::
get_gop_cach
e
(
string
vhost
)
{
SrsConfDirective
*
conf
=
get_vhost
(
vhost
);
if
(
!
conf
)
{
return
NULL
;
return
true
;
}
conf
=
conf
->
get
(
"http_hooks"
);
conf
=
conf
->
get
(
"gop_cache"
);
if
(
conf
&&
conf
->
arg0
()
==
"off"
)
{
return
false
;
}
return
true
;
}
bool
SrsConfig
::
get_atc
(
string
vhost
)
{
SrsConfDirective
*
conf
=
get_vhost
(
vhost
);
if
(
!
conf
)
{
return
NULL
;
return
false
;
}
SrsConfDirective
*
enabled
=
conf
->
get
(
"enabled"
);
if
(
!
enabled
||
enabled
->
arg0
()
!=
"on"
)
{
return
NULL
;
conf
=
conf
->
get
(
"atc"
);
if
(
conf
&&
conf
->
arg0
()
==
"on"
)
{
return
true
;
}
return
conf
->
get
(
"on_close"
)
;
return
false
;
}
SrsConfDirective
*
SrsConfig
::
get_vhost_on_publish
(
string
vhost
)
bool
SrsConfig
::
get_atc_auto
(
string
vhost
)
{
SrsConfDirective
*
conf
=
get_vhost
(
vhost
);
if
(
!
conf
)
{
return
NULL
;
return
true
;
}
conf
=
conf
->
get
(
"http_hooks"
);
if
(
!
conf
)
{
return
NULL
;
conf
=
conf
->
get
(
"atc_auto"
);
if
(
conf
&&
conf
->
arg0
()
==
"off"
)
{
return
false
;
}
SrsConfDirective
*
enabled
=
conf
->
get
(
"enabled"
);
if
(
!
enabled
||
enabled
->
arg0
()
!=
"on"
)
{
return
NULL
;
return
true
;
}
int
SrsConfig
::
get_time_jitter
(
string
vhost
)
{
SrsConfDirective
*
dvr
=
get_vhost
(
vhost
);
std
::
string
time_jitter
=
SRS_CONF_DEFAULT_TIME_JITTER
;
if
(
dvr
)
{
SrsConfDirective
*
conf
=
dvr
->
get
(
"time_jitter"
);
if
(
conf
)
{
time_jitter
=
conf
->
arg0
();
}
}
return
conf
->
get
(
"on_publish"
);
return
_srs_time_jitter_string2int
(
time_jitter
);
}
SrsConfDirective
*
SrsConfig
::
get_vhost_on_unpublis
h
(
string
vhost
)
double
SrsConfig
::
get_queue_lengt
h
(
string
vhost
)
{
SrsConfDirective
*
conf
=
get_vhost
(
vhost
);
if
(
!
conf
)
{
return
NULL
;
}
conf
=
conf
->
get
(
"http_hooks"
);
if
(
!
conf
)
{
return
NULL
;
return
SRS_CONF_DEFAULT_QUEUE_LENGTH
;
}
SrsConfDirective
*
enabled
=
conf
->
get
(
"enabled"
);
if
(
!
enabled
||
enabled
->
arg0
()
!=
"on"
)
{
return
NULL
;
conf
=
conf
->
get
(
"queue_length"
);
if
(
!
conf
||
conf
->
arg0
().
empty
())
{
return
SRS_CONF_DEFAULT_QUEUE_LENGTH
;
}
return
conf
->
get
(
"on_unpublish"
);
return
::
atoi
(
conf
->
arg0
().
c_str
()
);
}
SrsConfDirective
*
SrsConfig
::
get_
vhost_on_play
(
string
vhost
)
SrsConfDirective
*
SrsConfig
::
get_
refer
(
string
vhost
)
{
SrsConfDirective
*
conf
=
get_vhost
(
vhost
);
...
...
@@ -1523,41 +1545,66 @@ SrsConfDirective* SrsConfig::get_vhost_on_play(string vhost)
return
NULL
;
}
conf
=
conf
->
get
(
"http_hooks"
);
return
conf
->
get
(
"refer"
);
}
SrsConfDirective
*
SrsConfig
::
get_refer_play
(
string
vhost
)
{
SrsConfDirective
*
conf
=
get_vhost
(
vhost
);
if
(
!
conf
)
{
return
NULL
;
}
SrsConfDirective
*
enabled
=
conf
->
get
(
"enabled"
);
if
(
!
enabled
||
enabled
->
arg0
()
!=
"on"
)
{
return
conf
->
get
(
"refer_play"
);
}
SrsConfDirective
*
SrsConfig
::
get_refer_publish
(
string
vhost
)
{
SrsConfDirective
*
conf
=
get_vhost
(
vhost
);
if
(
!
conf
)
{
return
NULL
;
}
return
conf
->
get
(
"
on_play
"
);
return
conf
->
get
(
"
refer_publish
"
);
}
SrsConfDirective
*
SrsConfig
::
get_vhost_on_stop
(
string
vhost
)
int
SrsConfig
::
get_chunk_size
(
const
string
&
vhost
)
{
SrsConfDirective
*
conf
=
get_vhost
(
vhost
);
if
(
!
conf
)
{
return
NULL
;
return
SRS_CONF_DEFAULT_CHUNK_SIZE
;
}
conf
=
conf
->
get
(
"
http_hooks
"
);
conf
=
conf
->
get
(
"
chunk_size
"
);
if
(
!
conf
)
{
return
NULL
;
// vhost does not specify the chunk size,
// use the global instead.
conf
=
root
->
get
(
"chunk_size"
);
if
(
!
conf
)
{
return
SRS_CONF_DEFAULT_CHUNK_SIZE
;
}
SrsConfDirective
*
enabled
=
conf
->
get
(
"enabled"
);
if
(
!
enabled
||
enabled
->
arg0
()
!=
"on"
)
{
return
::
atoi
(
conf
->
arg0
().
c_str
());
}
return
::
atoi
(
conf
->
arg0
().
c_str
());
}
SrsConfDirective
*
SrsConfig
::
get_forward
(
string
vhost
)
{
SrsConfDirective
*
conf
=
get_vhost
(
vhost
);
if
(
!
conf
)
{
return
NULL
;
}
return
conf
->
get
(
"
on_stop
"
);
return
conf
->
get
(
"
forward
"
);
}
SrsConfDirective
*
SrsConfig
::
get_vhost_on_
dvr_hss_reap_flv
(
string
vhost
)
SrsConfDirective
*
SrsConfig
::
get_vhost_on_
connect
(
string
vhost
)
{
SrsConfDirective
*
conf
=
get_vhost
(
vhost
);
...
...
@@ -1575,127 +1622,94 @@ SrsConfDirective* SrsConfig::get_vhost_on_dvr_hss_reap_flv(string vhost)
return
NULL
;
}
return
conf
->
get
(
"on_
dvr_hss_reap_flv
"
);
return
conf
->
get
(
"on_
connect
"
);
}
bool
SrsConfig
::
get_vhost_enabled
(
string
vhost
)
SrsConfDirective
*
SrsConfig
::
get_vhost_on_close
(
string
vhost
)
{
SrsConfDirective
*
vhost_conf
=
get_vhost
(
vhost
);
return
get_vhost_enabled
(
vhost_conf
);
}
SrsConfDirective
*
conf
=
get_vhost
(
vhost
);
bool
SrsConfig
::
get_vhost_enabled
(
SrsConfDirective
*
vhost
)
{
if
(
!
vhost
)
{
return
false
;
if
(
!
conf
)
{
return
NULL
;
}
SrsConfDirective
*
conf
=
vhost
->
get
(
"enabled
"
);
conf
=
conf
->
get
(
"http_hooks
"
);
if
(
!
conf
)
{
return
true
;
return
NULL
;
}
if
(
conf
->
arg0
()
==
"off"
)
{
return
false
;
SrsConfDirective
*
enabled
=
conf
->
get
(
"enabled"
);
if
(
!
enabled
||
enabled
->
arg0
()
!=
"on"
)
{
return
NULL
;
}
return
true
;
return
conf
->
get
(
"on_close"
)
;
}
bool
SrsConfig
::
get_gop_cache
(
string
vhost
)
SrsConfDirective
*
SrsConfig
::
get_vhost_on_publish
(
string
vhost
)
{
SrsConfDirective
*
conf
=
get_vhost
(
vhost
);
if
(
!
conf
)
{
return
true
;
}
conf
=
conf
->
get
(
"gop_cache"
);
if
(
conf
&&
conf
->
arg0
()
==
"off"
)
{
return
false
;
return
NULL
;
}
return
true
;
}
bool
SrsConfig
::
get_atc
(
string
vhost
)
{
SrsConfDirective
*
conf
=
get_vhost
(
vhost
);
conf
=
conf
->
get
(
"http_hooks"
);
if
(
!
conf
)
{
return
false
;
return
NULL
;
}
conf
=
conf
->
get
(
"atc"
);
if
(
conf
&&
conf
->
arg0
()
==
"on"
)
{
return
true
;
SrsConfDirective
*
enabled
=
conf
->
get
(
"enabled"
);
if
(
!
enabled
||
enabled
->
arg0
()
!=
"on"
)
{
return
NULL
;
}
return
false
;
return
conf
->
get
(
"on_publish"
)
;
}
bool
SrsConfig
::
get_atc_auto
(
string
vhost
)
SrsConfDirective
*
SrsConfig
::
get_vhost_on_unpublish
(
string
vhost
)
{
SrsConfDirective
*
conf
=
get_vhost
(
vhost
);
if
(
!
conf
)
{
return
true
;
return
NULL
;
}
conf
=
conf
->
get
(
"atc_auto"
);
if
(
conf
&&
conf
->
arg0
()
==
"off"
)
{
return
false
;
conf
=
conf
->
get
(
"http_hooks"
);
if
(
!
conf
)
{
return
NULL
;
}
return
true
;
}
int
SrsConfig
::
get_time_jitter
(
string
vhost
)
{
SrsConfDirective
*
dvr
=
get_vhost
(
vhost
);
std
::
string
time_jitter
=
SRS_CONF_DEFAULT_TIME_JITTER
;
if
(
dvr
)
{
SrsConfDirective
*
conf
=
dvr
->
get
(
"time_jitter"
);
if
(
conf
)
{
time_jitter
=
conf
->
arg0
();
}
SrsConfDirective
*
enabled
=
conf
->
get
(
"enabled"
);
if
(
!
enabled
||
enabled
->
arg0
()
!=
"on"
)
{
return
NULL
;
}
return
_srs_time_jitter_string2int
(
time_jitter
);
return
conf
->
get
(
"on_unpublish"
);
}
double
SrsConfig
::
get_queue_length
(
string
vhost
)
SrsConfDirective
*
SrsConfig
::
get_vhost_on_play
(
string
vhost
)
{
SrsConfDirective
*
conf
=
get_vhost
(
vhost
);
if
(
!
conf
)
{
return
SRS_CONF_DEFAULT_QUEUE_LENGTH
;
return
NULL
;
}
conf
=
conf
->
get
(
"queue_length"
);
if
(
!
conf
||
conf
->
arg0
().
empty
())
{
return
SRS_CONF_DEFAULT_QUEUE_LENGTH
;
conf
=
conf
->
get
(
"http_hooks"
);
if
(
!
conf
)
{
return
NULL
;
}
return
::
atoi
(
conf
->
arg0
().
c_str
());
}
SrsConfDirective
*
SrsConfig
::
get_forward
(
string
vhost
)
{
SrsConfDirective
*
conf
=
get_vhost
(
vhost
);
if
(
!
conf
)
{
SrsConfDirective
*
enabled
=
conf
->
get
(
"enabled"
);
if
(
!
enabled
||
enabled
->
arg0
()
!=
"on"
)
{
return
NULL
;
}
return
conf
->
get
(
"
forward
"
);
return
conf
->
get
(
"
on_play
"
);
}
SrsConfDirective
*
SrsConfig
::
get_
refer
(
string
vhost
)
SrsConfDirective
*
SrsConfig
::
get_
vhost_on_stop
(
string
vhost
)
{
SrsConfDirective
*
conf
=
get_vhost
(
vhost
);
...
...
@@ -1703,52 +1717,38 @@ SrsConfDirective* SrsConfig::get_refer(string vhost)
return
NULL
;
}
return
conf
->
get
(
"refer"
);
}
SrsConfDirective
*
SrsConfig
::
get_refer_play
(
string
vhost
)
{
SrsConfDirective
*
conf
=
get_vhost
(
vhost
);
conf
=
conf
->
get
(
"http_hooks"
);
if
(
!
conf
)
{
return
NULL
;
}
return
conf
->
get
(
"refer_play"
);
}
SrsConfDirective
*
SrsConfig
::
get_refer_publish
(
string
vhost
)
{
SrsConfDirective
*
conf
=
get_vhost
(
vhost
);
if
(
!
conf
)
{
SrsConfDirective
*
enabled
=
conf
->
get
(
"enabled"
);
if
(
!
enabled
||
enabled
->
arg0
()
!=
"on"
)
{
return
NULL
;
}
return
conf
->
get
(
"
refer_publish
"
);
return
conf
->
get
(
"
on_stop
"
);
}
int
SrsConfig
::
get_chunk_size
(
const
string
&
vhost
)
SrsConfDirective
*
SrsConfig
::
get_vhost_on_dvr_hss_reap_flv
(
string
vhost
)
{
SrsConfDirective
*
conf
=
get_vhost
(
vhost
);
if
(
!
conf
)
{
return
SRS_CONF_DEFAULT_CHUNK_SIZE
;
return
NULL
;
}
conf
=
conf
->
get
(
"chunk_size"
);
if
(
!
conf
)
{
// vhost does not specify the chunk size,
// use the global instead.
conf
=
root
->
get
(
"chunk_size"
);
conf
=
conf
->
get
(
"http_hooks"
);
if
(
!
conf
)
{
return
SRS_CONF_DEFAULT_CHUNK_SIZE
;
return
NULL
;
}
return
::
atoi
(
conf
->
arg0
().
c_str
());
SrsConfDirective
*
enabled
=
conf
->
get
(
"enabled"
);
if
(
!
enabled
||
enabled
->
arg0
()
!=
"on"
)
{
return
NULL
;
}
return
::
atoi
(
conf
->
arg0
().
c_str
()
);
return
conf
->
get
(
"on_dvr_hss_reap_flv"
);
}
bool
SrsConfig
::
get_bw_check_enabled
(
const
string
&
vhost
)
...
...
trunk/src/app/srs_app_config.hpp
查看文件 @
1accd8c
...
...
@@ -422,81 +422,103 @@ public:
*/
virtual
std
::
vector
<
SrsConfDirective
*>
get_vhosts
();
/**
*
* whether vhost is enabled
* @param vhost, the vhost name.
* @return true when vhost is ok; otherwise, false.
*/
virtual
bool
get_vhost_enabled
(
std
::
string
vhost
);
/**
*
* whether vhost is enabled
* @param vhost, the vhost directive.
* @return true when vhost is ok; otherwise, false.
*/
virtual
bool
get_vhost_enabled
(
SrsConfDirective
*
vhost
);
/**
*
* whether gop_cache is enabled of vhost.
* gop_cache used to cache last gop, for client to fast startup.
* @return true when gop_cache is ok; otherwise, false.
*/
virtual
SrsConfDirective
*
get_vhost_on_connect
(
std
::
string
vhost
);
virtual
bool
get_gop_cache
(
std
::
string
vhost
);
/**
*
* whether atc is enabled of vhost.
* atc always use encoder timestamp, SRS never adjust the time.
* @return true when atc is ok; otherwise, false.
*/
virtual
SrsConfDirective
*
get_vhost_on_close
(
std
::
string
vhost
);
virtual
bool
get_atc
(
std
::
string
vhost
);
/**
*
* whether atc_auto is enabled of vhost.
* atc_auto used to auto enable atc, when metadata specified the bravo_atc.
* @return true when atc_auto is ok; otherwise, false.
*/
virtual
SrsConfDirective
*
get_vhost_on_publish
(
std
::
string
vhost
);
virtual
bool
get_atc_auto
(
std
::
string
vhost
);
/**
*
* get the time_jitter algorithm.
* @return the time_jitter algorithm, defined in SrsRtmpJitterAlgorithm.
*/
virtual
SrsConfDirective
*
get_vhost_on_unpublish
(
std
::
string
vhost
);
virtual
int
get_time_jitter
(
std
::
string
vhost
);
/**
*
*/
virtual
SrsConfDirective
*
get_vhost_on_play
(
std
::
string
vhost
);
virtual
double
get_queue_length
(
std
::
string
vhost
);
/**
*
*/
virtual
SrsConfDirective
*
get_
vhost_on_stop
(
std
::
string
vhost
);
virtual
SrsConfDirective
*
get_
refer
(
std
::
string
vhost
);
/**
*
*/
virtual
SrsConfDirective
*
get_
vhost_on_dvr_hss_reap_flv
(
std
::
string
vhost
);
virtual
SrsConfDirective
*
get_
refer_play
(
std
::
string
vhost
);
/**
*
*/
virtual
bool
get_gop_cache
(
std
::
string
vhost
);
virtual
SrsConfDirective
*
get_refer_publish
(
std
::
string
vhost
);
/**
*
*/
virtual
bool
get_atc
(
std
::
string
vhost
);
virtual
int
get_chunk_size
(
const
std
::
string
&
vhost
);
// forward section
public:
/**
*
*/
virtual
bool
get_atc_auto
(
std
::
string
vhost
);
virtual
SrsConfDirective
*
get_forward
(
std
::
string
vhost
);
// http_hooks section
public:
/**
*
* get the on_connect callbacks of vhost.
* @return the on_connect callback directive, the args is the url to callback.
*/
virtual
int
get_time_jitter
(
std
::
string
vhost
);
virtual
SrsConfDirective
*
get_vhost_on_connect
(
std
::
string
vhost
);
/**
*
* get the on_close callbacks of vhost.
* @return the on_close callback directive, the args is the url to callback.
*/
virtual
double
get_queue_length
(
std
::
string
vhost
);
virtual
SrsConfDirective
*
get_vhost_on_close
(
std
::
string
vhost
);
/**
*
* get the on_publish callbacks of vhost.
* @return the on_publish callback directive, the args is the url to callback.
*/
virtual
SrsConfDirective
*
get_
forward
(
std
::
string
vhost
);
virtual
SrsConfDirective
*
get_
vhost_on_publish
(
std
::
string
vhost
);
/**
*
* get the on_unpublish callbacks of vhost.
* @return the on_unpublish callback directive, the args is the url to callback.
*/
virtual
SrsConfDirective
*
get_
refer
(
std
::
string
vhost
);
virtual
SrsConfDirective
*
get_
vhost_on_unpublish
(
std
::
string
vhost
);
/**
*
* get the on_play callbacks of vhost.
* @return the on_play callback directive, the args is the url to callback.
*/
virtual
SrsConfDirective
*
get_
refer
_play
(
std
::
string
vhost
);
virtual
SrsConfDirective
*
get_
vhost_on
_play
(
std
::
string
vhost
);
/**
*
* get the on_stop callbacks of vhost.
* @return the on_stop callback directive, the args is the url to callback.
*/
virtual
SrsConfDirective
*
get_
refer_publish
(
std
::
string
vhost
);
virtual
SrsConfDirective
*
get_
vhost_on_stop
(
std
::
string
vhost
);
/**
*
* get the on_dvr_hss_reap_flv callbacks of vhost.
* @return the on_dvr_hss_reap_flv callback directive, the args is the url to callback.
*/
virtual
int
get_chunk_size
(
const
std
::
string
&
vhost
);
virtual
SrsConfDirective
*
get_vhost_on_dvr_hss_reap_flv
(
std
::
string
vhost
);
// bwct(bandwidth check tool) section
public:
/**
...
...
请
注册
或
登录
后发表评论