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-22 11:01:20 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
2c9e16a9e7f652e089b36abcbda71979e3e95570
2c9e16a9
1 parent
d612597a
add utest for config vhosts, transcode/dvr/hls
显示空白字符变更
内嵌
并排对比
正在显示
6 个修改的文件
包含
51 行增加
和
68 行删除
trunk/conf/full.conf
trunk/src/app/srs_app_config.cpp
trunk/src/app/srs_app_config.hpp
trunk/src/app/srs_app_dvr.cpp
trunk/src/app/srs_app_rtmp_conn.cpp
trunk/src/utest/srs_utest_config.cpp
trunk/conf/full.conf
查看文件 @
2c9e16a
trunk/src/app/srs_app_config.cpp
查看文件 @
2c9e16a
...
...
@@ -1630,7 +1630,7 @@ SrsConfDirective* SrsConfig::get_forward(string vhost)
return
conf
->
get
(
"forward"
);
}
SrsConfDirective
*
SrsConfig
::
get_vhost_
on_connect
(
string
vhost
)
SrsConfDirective
*
SrsConfig
::
get_vhost_
http_hooks
(
string
vhost
)
{
SrsConfDirective
*
conf
=
get_vhost
(
vhost
);
...
...
@@ -1638,34 +1638,41 @@ SrsConfDirective* SrsConfig::get_vhost_on_connect(string vhost)
return
NULL
;
}
conf
=
conf
->
get
(
"http_hooks"
);
return
conf
->
get
(
"http_hooks"
);
}
bool
SrsConfig
::
get_vhost_http_hooks_enabled
(
string
vhost
)
{
SrsConfDirective
*
conf
=
get_vhost_http_hooks
(
vhost
);
if
(
!
conf
)
{
return
NULL
;
return
false
;
}
SrsConfDirective
*
enabled
=
conf
->
get
(
"enabled"
);
if
(
!
enabled
||
enabled
->
arg0
()
!=
"on"
)
{
return
NULL
;
return
false
;
}
return
conf
->
get
(
"on_connect"
)
;
return
true
;
}
SrsConfDirective
*
SrsConfig
::
get_vhost_on_c
lose
(
string
vhost
)
SrsConfDirective
*
SrsConfig
::
get_vhost_on_c
onnect
(
string
vhost
)
{
SrsConfDirective
*
conf
=
get_vhost
(
vhost
);
SrsConfDirective
*
conf
=
get_vhost
_http_hooks
(
vhost
);
if
(
!
conf
)
{
return
NULL
;
}
conf
=
conf
->
get
(
"http_hooks"
);
if
(
!
conf
)
{
return
NULL
;
}
return
conf
->
get
(
"on_connect"
);
}
SrsConfDirective
*
enabled
=
conf
->
get
(
"enabled"
);
if
(
!
enabled
||
enabled
->
arg0
()
!=
"on"
)
{
SrsConfDirective
*
SrsConfig
::
get_vhost_on_close
(
string
vhost
)
{
SrsConfDirective
*
conf
=
get_vhost_http_hooks
(
vhost
);
if
(
!
conf
)
{
return
NULL
;
}
...
...
@@ -1674,106 +1681,56 @@ SrsConfDirective* SrsConfig::get_vhost_on_close(string vhost)
SrsConfDirective
*
SrsConfig
::
get_vhost_on_publish
(
string
vhost
)
{
SrsConfDirective
*
conf
=
get_vhost
(
vhost
);
SrsConfDirective
*
conf
=
get_vhost
_http_hooks
(
vhost
);
if
(
!
conf
)
{
return
NULL
;
}
conf
=
conf
->
get
(
"http_hooks"
);
if
(
!
conf
)
{
return
NULL
;
}
SrsConfDirective
*
enabled
=
conf
->
get
(
"enabled"
);
if
(
!
enabled
||
enabled
->
arg0
()
!=
"on"
)
{
return
NULL
;
}
return
conf
->
get
(
"on_publish"
);
}
SrsConfDirective
*
SrsConfig
::
get_vhost_on_unpublish
(
string
vhost
)
{
SrsConfDirective
*
conf
=
get_vhost
(
vhost
);
SrsConfDirective
*
conf
=
get_vhost
_http_hooks
(
vhost
);
if
(
!
conf
)
{
return
NULL
;
}
conf
=
conf
->
get
(
"http_hooks"
);
if
(
!
conf
)
{
return
NULL
;
}
SrsConfDirective
*
enabled
=
conf
->
get
(
"enabled"
);
if
(
!
enabled
||
enabled
->
arg0
()
!=
"on"
)
{
return
NULL
;
}
return
conf
->
get
(
"on_unpublish"
);
}
SrsConfDirective
*
SrsConfig
::
get_vhost_on_play
(
string
vhost
)
{
SrsConfDirective
*
conf
=
get_vhost
(
vhost
);
SrsConfDirective
*
conf
=
get_vhost
_http_hooks
(
vhost
);
if
(
!
conf
)
{
return
NULL
;
}
conf
=
conf
->
get
(
"http_hooks"
);
if
(
!
conf
)
{
return
NULL
;
}
SrsConfDirective
*
enabled
=
conf
->
get
(
"enabled"
);
if
(
!
enabled
||
enabled
->
arg0
()
!=
"on"
)
{
return
NULL
;
}
return
conf
->
get
(
"on_play"
);
}
SrsConfDirective
*
SrsConfig
::
get_vhost_on_stop
(
string
vhost
)
{
SrsConfDirective
*
conf
=
get_vhost
(
vhost
);
SrsConfDirective
*
conf
=
get_vhost
_http_hooks
(
vhost
);
if
(
!
conf
)
{
return
NULL
;
}
conf
=
conf
->
get
(
"http_hooks"
);
if
(
!
conf
)
{
return
NULL
;
}
SrsConfDirective
*
enabled
=
conf
->
get
(
"enabled"
);
if
(
!
enabled
||
enabled
->
arg0
()
!=
"on"
)
{
return
NULL
;
}
return
conf
->
get
(
"on_stop"
);
}
SrsConfDirective
*
SrsConfig
::
get_vhost_on_dvr_hss_reap_flv
(
string
vhost
)
{
SrsConfDirective
*
conf
=
get_vhost
(
vhost
);
SrsConfDirective
*
conf
=
get_vhost
_http_hooks
(
vhost
);
if
(
!
conf
)
{
return
NULL
;
}
conf
=
conf
->
get
(
"http_hooks"
);
if
(
!
conf
)
{
return
NULL
;
}
SrsConfDirective
*
enabled
=
conf
->
get
(
"enabled"
);
if
(
!
enabled
||
enabled
->
arg0
()
!=
"on"
)
{
return
NULL
;
}
return
conf
->
get
(
"on_dvr_hss_reap_flv"
);
}
...
...
trunk/src/app/srs_app_config.hpp
查看文件 @
2c9e16a
...
...
@@ -515,8 +515,18 @@ public:
*/
virtual
SrsConfDirective
*
get_forward
(
std
::
string
vhost
);
// http_hooks section
private:
/**
* get the http_hooks directive of vhost.
*/
virtual
SrsConfDirective
*
get_vhost_http_hooks
(
std
::
string
vhost
);
public
:
/**
* whether vhost http-hooks enabled.
* @remark, if not enabled, donot callback all http hooks.
*/
virtual
bool
get_vhost_http_hooks_enabled
(
std
::
string
vhost
);
/**
* get the on_connect callbacks of vhost.
* @return the on_connect callback directive, the args is the url to callback.
*/
...
...
trunk/src/app/srs_app_dvr.cpp
查看文件 @
2c9e16a
...
...
@@ -371,6 +371,7 @@ int SrsDvrPlan::on_dvr_hss_reap_flv()
int
ret
=
ERROR_SUCCESS
;
#ifdef SRS_AUTO_HTTP_CALLBACK
if
(
!
_srs_config
->
get_vhost_http_hooks_enabled
(
_req
->
vhost
))
{
// HTTP: on_dvr_hss_reap_flv
SrsConfDirective
*
on_dvr_hss_reap_flv
=
_srs_config
->
get_vhost_on_dvr_hss_reap_flv
(
_req
->
vhost
);
if
(
!
on_dvr_hss_reap_flv
)
{
...
...
@@ -382,6 +383,7 @@ int SrsDvrPlan::on_dvr_hss_reap_flv()
std
::
string
url
=
on_dvr_hss_reap_flv
->
args
.
at
(
i
);
SrsHttpHooks
::
on_dvr_hss_reap_flv
(
url
,
_req
,
segment
);
}
}
#endif
return
ret
;
...
...
@@ -641,6 +643,7 @@ int SrsDvrHssPlan::on_dvr_hss_reap_flv_header(string path)
int
ret
=
ERROR_SUCCESS
;
#ifdef SRS_AUTO_HTTP_CALLBACK
if
(
!
_srs_config
->
get_vhost_http_hooks_enabled
(
_req
->
vhost
))
{
// HTTP: on_dvr_hss_reap_flv_header
SrsConfDirective
*
on_dvr_hss_reap_flv
=
_srs_config
->
get_vhost_on_dvr_hss_reap_flv
(
_req
->
vhost
);
if
(
!
on_dvr_hss_reap_flv
)
{
...
...
@@ -652,6 +655,7 @@ int SrsDvrHssPlan::on_dvr_hss_reap_flv_header(string path)
std
::
string
url
=
on_dvr_hss_reap_flv
->
args
.
at
(
i
);
SrsHttpHooks
::
on_dvr_hss_reap_flv_header
(
url
,
_req
,
path
);
}
}
#endif
return
ret
;
...
...
trunk/src/app/srs_app_rtmp_conn.cpp
查看文件 @
2c9e16a
...
...
@@ -984,6 +984,7 @@ int SrsRtmpConn::http_hooks_on_connect()
int
ret
=
ERROR_SUCCESS
;
#ifdef SRS_AUTO_HTTP_CALLBACK
if
(
!
_srs_config
->
get_vhost_http_hooks_enabled
(
req
->
vhost
))
{
// HTTP: on_connect
SrsConfDirective
*
on_connect
=
_srs_config
->
get_vhost_on_connect
(
req
->
vhost
);
if
(
!
on_connect
)
{
...
...
@@ -999,6 +1000,7 @@ int SrsRtmpConn::http_hooks_on_connect()
return
ret
;
}
}
}
#endif
return
ret
;
...
...
@@ -1007,6 +1009,7 @@ int SrsRtmpConn::http_hooks_on_connect()
void
SrsRtmpConn
::
http_hooks_on_close
()
{
#ifdef SRS_AUTO_HTTP_CALLBACK
if
(
!
_srs_config
->
get_vhost_http_hooks_enabled
(
req
->
vhost
))
{
// whatever the ret code, notify the api hooks.
// HTTP: on_close
SrsConfDirective
*
on_close
=
_srs_config
->
get_vhost_on_close
(
req
->
vhost
);
...
...
@@ -1020,6 +1023,7 @@ void SrsRtmpConn::http_hooks_on_close()
std
::
string
url
=
on_close
->
args
.
at
(
i
);
SrsHttpHooks
::
on_close
(
url
,
connection_id
,
ip
,
req
);
}
}
#endif
}
...
...
@@ -1028,6 +1032,7 @@ int SrsRtmpConn::http_hooks_on_publish()
int
ret
=
ERROR_SUCCESS
;
#ifdef SRS_AUTO_HTTP_CALLBACK
if
(
!
_srs_config
->
get_vhost_http_hooks_enabled
(
req
->
vhost
))
{
// HTTP: on_publish
SrsConfDirective
*
on_publish
=
_srs_config
->
get_vhost_on_publish
(
req
->
vhost
);
if
(
!
on_publish
)
{
...
...
@@ -1043,6 +1048,7 @@ int SrsRtmpConn::http_hooks_on_publish()
return
ret
;
}
}
}
#endif
return
ret
;
...
...
@@ -1051,6 +1057,7 @@ int SrsRtmpConn::http_hooks_on_publish()
void
SrsRtmpConn
::
http_hooks_on_unpublish
()
{
#ifdef SRS_AUTO_HTTP_CALLBACK
if
(
!
_srs_config
->
get_vhost_http_hooks_enabled
(
req
->
vhost
))
{
// whatever the ret code, notify the api hooks.
// HTTP: on_unpublish
SrsConfDirective
*
on_unpublish
=
_srs_config
->
get_vhost_on_unpublish
(
req
->
vhost
);
...
...
@@ -1064,6 +1071,7 @@ void SrsRtmpConn::http_hooks_on_unpublish()
std
::
string
url
=
on_unpublish
->
args
.
at
(
i
);
SrsHttpHooks
::
on_unpublish
(
url
,
connection_id
,
ip
,
req
);
}
}
#endif
}
...
...
@@ -1072,6 +1080,7 @@ int SrsRtmpConn::http_hooks_on_play()
int
ret
=
ERROR_SUCCESS
;
#ifdef SRS_AUTO_HTTP_CALLBACK
if
(
!
_srs_config
->
get_vhost_http_hooks_enabled
(
req
->
vhost
))
{
// HTTP: on_play
SrsConfDirective
*
on_play
=
_srs_config
->
get_vhost_on_play
(
req
->
vhost
);
if
(
!
on_play
)
{
...
...
@@ -1087,6 +1096,7 @@ int SrsRtmpConn::http_hooks_on_play()
return
ret
;
}
}
}
#endif
return
ret
;
...
...
@@ -1095,6 +1105,7 @@ int SrsRtmpConn::http_hooks_on_play()
void
SrsRtmpConn
::
http_hooks_on_stop
()
{
#ifdef SRS_AUTO_HTTP_CALLBACK
if
(
!
_srs_config
->
get_vhost_http_hooks_enabled
(
req
->
vhost
))
{
// whatever the ret code, notify the api hooks.
// HTTP: on_stop
SrsConfDirective
*
on_stop
=
_srs_config
->
get_vhost_on_stop
(
req
->
vhost
);
...
...
@@ -1108,6 +1119,7 @@ void SrsRtmpConn::http_hooks_on_stop()
std
::
string
url
=
on_stop
->
args
.
at
(
i
);
SrsHttpHooks
::
on_stop
(
url
,
connection_id
,
ip
,
req
);
}
}
#endif
return
;
...
...
trunk/src/utest/srs_utest_config.cpp
查看文件 @
2c9e16a
此 diff 太大无法显示。
请
注册
或
登录
后发表评论