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
2015-05-28 14:59:12 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
394e070b2ef2fbcc8eeba817bbdcc036ba995582
394e070b
1 parent
e5461d2d
support dolphin
隐藏空白字符变更
内嵌
并排对比
正在显示
3 个修改的文件
包含
63 行增加
和
2 行删除
trunk/src/app/srs_app_config.cpp
trunk/src/app/srs_app_config.hpp
trunk/src/app/srs_app_server.cpp
trunk/src/app/srs_app_config.cpp
查看文件 @
394e070
...
...
@@ -364,6 +364,8 @@ int SrsConfDirective::read_token(SrsConfigBuffer* buffer, vector<string>& args,
SrsConfig
::
SrsConfig
()
{
dolphin
=
false
;
show_help
=
false
;
show_version
=
false
;
test_conf
=
false
;
...
...
@@ -378,6 +380,25 @@ SrsConfig::~SrsConfig()
srs_freep
(
root
);
}
bool
SrsConfig
::
is_dolphin
()
{
return
dolphin
;
}
void
SrsConfig
::
set_config_directive
(
SrsConfDirective
*
parent
,
string
dir
,
string
value
)
{
SrsConfDirective
*
d
=
parent
->
get
(
dir
);
if
(
!
d
)
{
d
=
new
SrsConfDirective
();
d
->
name
=
dir
;
parent
->
directives
.
push_back
(
d
);
}
d
->
args
.
clear
();
d
->
args
.
push_back
(
value
);
}
void
SrsConfig
::
subscribe
(
ISrsReloadHandler
*
handler
)
{
std
::
vector
<
ISrsReloadHandler
*>::
iterator
it
;
...
...
@@ -1260,6 +1281,19 @@ int SrsConfig::parse_argv(int& i, char** argv)
show_help
=
false
;
test_conf
=
true
;
break
;
case
'p'
:
dolphin
=
true
;
if
(
*
p
)
{
dolphin_port
=
p
;
continue
;
}
if
(
argv
[
++
i
])
{
dolphin_port
=
argv
[
i
];
continue
;
}
ret
=
ERROR_SYSTEM_CONFIG_INVALID
;
srs_error
(
"option
\"
-p
\"
requires params, ret=%d"
,
ret
);
return
ret
;
case
'v'
:
case
'V'
:
show_help
=
false
;
...
...
@@ -1269,11 +1303,11 @@ int SrsConfig::parse_argv(int& i, char** argv)
show_help
=
false
;
if
(
*
p
)
{
config_file
=
p
;
return
ret
;
continue
;
}
if
(
argv
[
++
i
])
{
config_file
=
argv
[
i
];
return
ret
;
continue
;
}
ret
=
ERROR_SYSTEM_CONFIG_INVALID
;
srs_error
(
"option
\"
-c
\"
requires parameter, ret=%d"
,
ret
);
...
...
@@ -1844,6 +1878,14 @@ int SrsConfig::parse_buffer(SrsConfigBuffer* buffer)
if
((
ret
=
root
->
parse
(
buffer
))
!=
ERROR_SUCCESS
)
{
return
ret
;
}
// mock by dolphin mode.
// for the dolphin will start srs with specified params.
if
(
dolphin
)
{
set_config_directive
(
root
,
"listen"
,
dolphin_port
);
set_config_directive
(
root
,
"daemon"
,
"off"
);
set_config_directive
(
root
,
"srs_log_tank"
,
"console"
);
}
return
ret
;
}
...
...
trunk/src/app/srs_app_config.hpp
查看文件 @
394e070
...
...
@@ -267,6 +267,12 @@ class SrsConfig
// user command
private:
/**
* whether srs is run in dolphin mode.
* @see https://github.com/simple-rtmp-server/srs-dolphin
*/
bool
dolphin
;
std
::
string
dolphin_port
;
/**
* whether show help and exit.
*/
bool
show_help
;
...
...
@@ -309,6 +315,14 @@ private:
public
:
SrsConfig
();
virtual
~
SrsConfig
();
// dolphin
public:
/**
* whether srs is in dolphin mode.
*/
virtual
bool
is_dolphin
();
private
:
virtual
void
set_config_directive
(
SrsConfDirective
*
parent
,
std
::
string
dir
,
std
::
string
value
);
// reload
public:
/**
...
...
trunk/src/app/srs_app_server.cpp
查看文件 @
394e070
...
...
@@ -639,6 +639,11 @@ int SrsServer::acquire_pid_file()
{
int
ret
=
ERROR_SUCCESS
;
// when srs in dolphin mode, no need the pid file.
if
(
_srs_config
->
is_dolphin
())
{
return
ret
;
}
std
::
string
pid_file
=
_srs_config
->
get_pid_file
();
// -rw-r--r--
...
...
请
注册
或
登录
后发表评论