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-25 09:38:48 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
1c27f3b9137edd8844656a2c39c7c12a81472518
1c27f3b9
1 parent
394cb4b4
refine config, warning when feature disabled.
隐藏空白字符变更
内嵌
并排对比
正在显示
4 个修改的文件
包含
88 行增加
和
9 行删除
trunk/conf/ffmpeg.conf → trunk/conf/ffmpeg.transcode.conf
trunk/conf/http.hooks.callback.conf
trunk/src/app/srs_app_config.cpp
trunk/src/app/srs_app_config.hpp
trunk/conf/ffmpeg.conf → trunk/conf/ffmpeg.
transcode.
conf
查看文件 @
1c27f3b
trunk/conf/http.hooks.callback.conf
0 → 100644
查看文件 @
1c27f3b
# http-hooks or http-callbacks config for srs.
# @see full.conf for detail config.
listen
1935
;
srs_log_tank
file
;
srs_log_file
./
objs
/
srs
.
log
;
vhost
__
defaultVhost__
{
http_hooks
{
enabled
on
;
on_connect
http
://
127
.
0
.
0
.
1
:
8085
/
api
/
v1
/
clients
http
://
localhost
:
8085
/
api
/
v1
/
clients
;
on_close
http
://
127
.
0
.
0
.
1
:
8085
/
api
/
v1
/
clients
http
://
localhost
:
8085
/
api
/
v1
/
clients
;
on_publish
http
://
127
.
0
.
0
.
1
:
8085
/
api
/
v1
/
streams
http
://
localhost
:
8085
/
api
/
v1
/
streams
;
on_unpublish
http
://
127
.
0
.
0
.
1
:
8085
/
api
/
v1
/
streams
http
://
localhost
:
8085
/
api
/
v1
/
streams
;
on_play
http
://
127
.
0
.
0
.
1
:
8085
/
api
/
v1
/
sessions
http
://
localhost
:
8085
/
api
/
v1
/
sessions
;
on_stop
http
://
127
.
0
.
0
.
1
:
8085
/
api
/
v1
/
sessions
http
://
localhost
:
8085
/
api
/
v1
/
sessions
;
on_dvr_hss_reap_flv
http
://
127
.
0
.
0
.
1
:
8085
/
api
/
v1
/
dvrs
http
://
localhost
:
8085
/
api
/
v1
/
dvrs
;
}
}
...
...
trunk/src/app/srs_app_config.cpp
查看文件 @
1c27f3b
...
...
@@ -44,6 +44,8 @@ using namespace std;
#include <srs_app_source.hpp>
#include <srs_kernel_file.hpp>
using
namespace
_srs_internal
;
#define SRS_WIKI_URL_LOG "https://github.com/winlinvip/simple-rtmp-server/wiki/SrsLog"
#define FILE_OFFSET(fd) lseek(fd, 0, SEEK_CUR)
...
...
@@ -145,13 +147,13 @@ bool SrsConfDirective::is_vhost()
return
name
==
"vhost"
;
}
int
SrsConfDirective
::
parse
(
_srs_internal
::
SrsConfigBuffer
*
buffer
)
int
SrsConfDirective
::
parse
(
SrsConfigBuffer
*
buffer
)
{
return
parse_conf
(
buffer
,
parse_file
);
}
// see: ngx_conf_parse
int
SrsConfDirective
::
parse_conf
(
_srs_internal
::
SrsConfigBuffer
*
buffer
,
SrsDirectiveType
type
)
int
SrsConfDirective
::
parse_conf
(
SrsConfigBuffer
*
buffer
,
SrsDirectiveType
type
)
{
int
ret
=
ERROR_SUCCESS
;
...
...
@@ -213,7 +215,7 @@ int SrsConfDirective::parse_conf(_srs_internal::SrsConfigBuffer* buffer, SrsDire
}
// see: ngx_conf_read_token
int
SrsConfDirective
::
read_token
(
_srs_internal
::
SrsConfigBuffer
*
buffer
,
vector
<
string
>&
args
,
int
&
line_start
)
int
SrsConfDirective
::
read_token
(
SrsConfigBuffer
*
buffer
,
vector
<
string
>&
args
,
int
&
line_start
)
{
int
ret
=
ERROR_SUCCESS
;
...
...
@@ -1166,7 +1168,7 @@ int SrsConfig::parse_file(const char* filename)
return
ERROR_SYSTEM_CONFIG_INVALID
;
}
_srs_internal
::
SrsConfigBuffer
buffer
;
SrsConfigBuffer
buffer
;
if
((
ret
=
buffer
.
fullfill
(
config_file
.
c_str
()))
!=
ERROR_SUCCESS
)
{
return
ret
;
...
...
@@ -1175,13 +1177,9 @@ int SrsConfig::parse_file(const char* filename)
return
parse_buffer
(
&
buffer
);
}
int
SrsConfig
::
parse_buffer
(
_srs_internal
::
SrsConfigBuffer
*
buffer
)
int
SrsConfig
::
check_config
(
)
{
int
ret
=
ERROR_SUCCESS
;
if
((
ret
=
root
->
parse
(
buffer
))
!=
ERROR_SUCCESS
)
{
return
ret
;
}
// check empty
if
(
root
->
directives
.
size
()
==
0
)
{
...
...
@@ -1230,9 +1228,67 @@ int SrsConfig::parse_buffer(_srs_internal::SrsConfigBuffer* buffer)
srs_trace
(
"write log to console"
);
}
// check features
#ifndef SRS_AUTO_HTTP_SERVER
if
(
get_http_stream_enabled
())
{
srs_warn
(
"http_stream is disabled by configure"
);
}
#endif
#ifndef SRS_AUTO_HTTP_API
if
(
get_http_api_enabled
())
{
srs_warn
(
"http_api is disabled by configure"
);
}
#endif
vector
<
SrsConfDirective
*>
vhosts
=
get_vhosts
();
for
(
int
i
=
0
;
i
<
(
int
)
vhosts
.
size
();
i
++
)
{
SrsConfDirective
*
vhost
=
vhosts
[
i
];
#ifndef SRS_AUTO_DVR
if
(
get_dvr_enabled
(
vhost
->
arg0
()))
{
srs_warn
(
"dvr of vhost %s is disabled by configure"
,
vhost
->
arg0
().
c_str
());
}
#endif
#ifndef SRS_AUTO_HLS
if
(
get_hls_enabled
(
vhost
->
arg0
()))
{
srs_warn
(
"hls of vhost %s is disabled by configure"
,
vhost
->
arg0
().
c_str
());
}
#endif
#ifndef SRS_AUTO_HTTP_CALLBACK
if
(
get_vhost_http_hooks_enabled
(
vhost
->
arg0
()))
{
srs_warn
(
"http_hooks of vhost %s is disabled by configure"
,
vhost
->
arg0
().
c_str
());
}
#endif
#ifndef SRS_AUTO_TRANSCODE
if
(
get_transcode_enabled
(
get_transcode
(
vhost
->
arg0
(),
""
)))
{
srs_warn
(
"transcode of vhost %s is disabled by configure"
,
vhost
->
arg0
().
c_str
());
}
#endif
#ifndef SRS_AUTO_INGEST
vector
<
SrsConfDirective
*>
ingesters
=
get_ingesters
(
vhost
->
arg0
());
for
(
int
j
=
0
;
j
<
(
int
)
ingesters
.
size
();
j
++
)
{
SrsConfDirective
*
ingest
=
ingesters
[
j
];
if
(
get_ingest_enabled
(
ingest
))
{
srs_warn
(
"ingest %s of vhost %s is disabled by configure"
,
ingest
->
arg0
().
c_str
(),
vhost
->
arg0
().
c_str
()
);
}
}
#endif
}
return
ret
;
}
int
SrsConfig
::
parse_buffer
(
SrsConfigBuffer
*
buffer
)
{
int
ret
=
ERROR_SUCCESS
;
if
((
ret
=
root
->
parse
(
buffer
))
!=
ERROR_SUCCESS
)
{
return
ret
;
}
return
check_config
();
}
string
SrsConfig
::
cwd
()
{
return
_cwd
;
...
...
trunk/src/app/srs_app_config.hpp
查看文件 @
1c27f3b
...
...
@@ -338,6 +338,11 @@ protected:
* @remark, protected for the utest to override with mock.
*/
virtual
int
parse_buffer
(
_srs_internal
::
SrsConfigBuffer
*
buffer
);
private
:
/**
* check the parsed config.
*/
virtual
int
check_config
();
// global env
public:
/**
...
...
请
注册
或
登录
后发表评论