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:21:34 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
96e0e699dda76e0d4029b0b8e3202601b16c98e9
96e0e699
1 parent
1243d962
refine the get port, return a vector<string> contains ports.
隐藏空白字符变更
内嵌
并排对比
正在显示
4 个修改的文件
包含
40 行增加
和
22 行删除
trunk/src/app/srs_app_config.cpp
trunk/src/app/srs_app_config.hpp
trunk/src/app/srs_app_ingest.cpp
trunk/src/app/srs_app_server.cpp
trunk/src/app/srs_app_config.cpp
查看文件 @
96e0e69
...
...
@@ -1175,15 +1175,6 @@ int SrsConfig::parse_buffer(_srs_internal::SrsConfigBuffer* buffer)
return
ret
;
}
SrsConfDirective
*
conf
=
NULL
;
// check rtmp port specified by directive listen.
if
((
conf
=
get_listen
())
==
NULL
||
conf
->
args
.
size
()
==
0
)
{
ret
=
ERROR_SYSTEM_CONFIG_INVALID
;
srs_error
(
"line %d: conf error, "
"directive
\"
listen
\"
is empty, ret=%d"
,
(
conf
?
conf
->
conf_line
:
0
),
ret
);
return
ret
;
}
// check root directives.
for
(
int
i
=
0
;
i
<
(
int
)
root
->
directives
.
size
();
i
++
)
{
SrsConfDirective
*
conf
=
root
->
at
(
i
);
...
...
@@ -1200,6 +1191,13 @@ int SrsConfig::parse_buffer(_srs_internal::SrsConfigBuffer* buffer)
}
}
// check rtmp port specified by directive listen.
if
(
_srs_config
->
get_listen
().
size
()
<=
0
)
{
ret
=
ERROR_SYSTEM_CONFIG_INVALID
;
srs_error
(
"directive
\"
listen
\"
is empty, ret=%d"
,
ret
);
return
ret
;
}
// TODO: FIXME: check others.
// check log
...
...
@@ -1259,9 +1257,20 @@ int SrsConfig::get_max_connections()
return
::
atoi
(
conf
->
arg0
().
c_str
());
}
SrsConfDirective
*
SrsConfig
::
get_listen
()
vector
<
string
>
SrsConfig
::
get_listen
()
{
return
root
->
get
(
"listen"
);
std
::
vector
<
string
>
ports
;
SrsConfDirective
*
conf
=
root
->
get
(
"listen"
);
if
(
!
conf
)
{
return
ports
;
}
for
(
int
i
=
0
;
i
<
(
int
)
conf
->
args
.
size
();
i
++
)
{
ports
.
push_back
(
conf
->
args
.
at
(
i
));
}
return
ports
;
}
string
SrsConfig
::
get_pid_file
()
...
...
trunk/src/app/srs_app_config.hpp
查看文件 @
96e0e69
...
...
@@ -345,17 +345,26 @@ public:
*/
virtual
SrsConfDirective
*
get_root
();
/**
*
* get the deamon config.
* if true, SRS will run in deamon mode, fork and fork to reap the
* grand-child process to init process.
*/
virtual
bool
get_deamon
();
/**
*
* get the max connections limit of system.
* if exceed the max connection, SRS will disconnect the connection.
* @remark, linux will limit the connections of each process,
* for example, when you need SRS to service 10000+ connections,
* user must use "ulimit -HSn 10000" and config the max connections
* of SRS.
*/
virtual
int
get_max_connections
();
/**
*
* get the listen port of SRS.
* user can specifies multiple listen ports,
* each args of directive is a listen port.
*/
virtual
SrsConfDirective
*
get_listen
();
virtual
std
::
vector
<
std
::
string
>
get_listen
();
/**
*
*/
...
...
trunk/src/app/srs_app_ingest.cpp
查看文件 @
96e0e69
...
...
@@ -232,9 +232,9 @@ int SrsIngester::initialize_ffmpeg(SrsFFMPEG* ffmpeg, SrsConfDirective* vhost, S
{
int
ret
=
ERROR_SUCCESS
;
SrsConfDirective
*
listen
=
_srs_config
->
get_listen
();
srs_assert
(
listen
->
args
.
size
()
>
0
);
std
::
string
port
=
listen
->
arg0
();
std
::
vector
<
std
::
string
>
ports
=
_srs_config
->
get_listen
();
srs_assert
(
ports
.
size
()
>
0
);
std
::
string
port
=
ports
[
0
];
std
::
string
output
=
_srs_config
->
get_engine_output
(
engine
);
// output stream, to other/self server
...
...
trunk/src/app/srs_app_server.cpp
查看文件 @
96e0e69
...
...
@@ -759,16 +759,16 @@ int SrsServer::listen_rtmp()
int
ret
=
ERROR_SUCCESS
;
// stream service port.
SrsConfDirective
*
conf
=
_srs_config
->
get_listen
();
srs_assert
(
conf
);
std
::
vector
<
std
::
string
>
ports
=
_srs_config
->
get_listen
();
srs_assert
((
int
)
ports
.
size
()
>
0
);
close_listeners
(
SrsListenerRtmpStream
);
for
(
int
i
=
0
;
i
<
(
int
)
conf
->
arg
s
.
size
();
i
++
)
{
for
(
int
i
=
0
;
i
<
(
int
)
port
s
.
size
();
i
++
)
{
SrsListener
*
listener
=
new
SrsListener
(
this
,
SrsListenerRtmpStream
);
listeners
.
push_back
(
listener
);
int
port
=
::
atoi
(
conf
->
args
.
at
(
i
)
.
c_str
());
int
port
=
::
atoi
(
ports
[
i
]
.
c_str
());
if
((
ret
=
listener
->
listen
(
port
))
!=
ERROR_SUCCESS
)
{
srs_error
(
"RTMP stream listen at port %d failed. ret=%d"
,
port
,
ret
);
return
ret
;
...
...
请
注册
或
登录
后发表评论