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-04-12 20:35:40 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
b38df9cd1ae84706a7aec8b487330b91eb069ea5
b38df9cd
1 parent
7c64a893
refine main object(server, config, log, context), handler reload in intialize(), change to 0.9.59
隐藏空白字符变更
内嵌
并排对比
正在显示
8 个修改的文件
包含
84 行增加
和
57 行删除
trunk/research/api-server/server.py
trunk/src/app/srs_app_log.cpp
trunk/src/app/srs_app_log.hpp
trunk/src/app/srs_app_server.cpp
trunk/src/core/srs_core.hpp
trunk/src/kernel/srs_kernel_log.cpp
trunk/src/kernel/srs_kernel_log.hpp
trunk/src/main/srs_main_server.cpp
trunk/research/api-server/server.py
查看文件 @
b38df9c
...
...
@@ -350,7 +350,7 @@ class RESTServers(object):
if
rtmp_url
is
None
:
return
"meeting stream not found"
urls
=
rtmp_url
.
replace
(
"...vhost..."
,
"?vhost="
)
.
replace
(
"rtmp://"
,
""
)
.
split
(
"/"
)
hls_url
=
"http://
%
s:8080/
%
s/
%
s.m3u8"
%
(
urls
[
0
]
.
replace
(
":1935"
,
"
"
),
urls
[
1
]
.
split
(
"?"
)[
0
],
urls
[
2
])
hls_url
=
"http://
%
s:8080/
%
s/
%
s.m3u8"
%
(
urls
[
0
]
.
strip
(
":19350"
)
.
strip
(
":1935
"
),
urls
[
1
]
.
split
(
"?"
)[
0
],
urls
[
2
])
return
"""
<video width="640" height="360"
autoplay controls autobuffer
...
...
trunk/src/app/srs_app_log.cpp
查看文件 @
b38df9c
...
...
@@ -31,6 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <fcntl.h>
#include <srs_app_config.hpp>
#include <srs_kernel_error.hpp>
SrsThreadContext
::
SrsThreadContext
()
{
...
...
@@ -65,8 +66,6 @@ SrsFastLog::SrsFastLog()
log_data
=
new
char
[
LOG_MAX_SIZE
];
fd
=
-
1
;
// TODO: support reload.
}
SrsFastLog
::~
SrsFastLog
()
...
...
@@ -79,6 +78,12 @@ SrsFastLog::~SrsFastLog()
}
}
int
SrsFastLog
::
initialize
()
{
// TODO: support reload.
return
ERROR_SUCCESS
;
}
int
SrsFastLog
::
level
()
{
return
_level
;
...
...
trunk/src/app/srs_app_log.hpp
查看文件 @
b38df9c
...
...
@@ -69,6 +69,7 @@ public:
SrsFastLog
();
virtual
~
SrsFastLog
();
public
:
virtual
int
initialize
();
virtual
int
level
();
virtual
void
set_level
(
int
level
);
virtual
void
verbose
(
const
char
*
tag
,
int
context_id
,
const
char
*
fmt
,
...);
...
...
trunk/src/app/srs_app_server.cpp
查看文件 @
b38df9c
...
...
@@ -160,9 +160,6 @@ SrsServer::SrsServer()
signal_reload
=
false
;
signal_gmc_stop
=
false
;
srs_assert
(
_srs_config
);
_srs_config
->
subscribe
(
this
);
// donot new object in constructor,
// for some global instance is not ready now,
// new these objects in initialize instead.
...
...
@@ -208,6 +205,12 @@ int SrsServer::initialize()
{
int
ret
=
ERROR_SUCCESS
;
// for the main objects(server, config, log),
// never subscribe handler in constructor,
// instead, subscribe handler in initialize method.
srs_assert
(
_srs_config
);
_srs_config
->
subscribe
(
this
);
#ifdef SRS_HTTP_API
srs_assert
(
!
http_api_handler
);
http_api_handler
=
SrsHttpHandler
::
create_http_api
();
...
...
trunk/src/core/srs_core.hpp
查看文件 @
b38df9c
...
...
@@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// current release version
#define VERSION_MAJOR "0"
#define VERSION_MINOR "9"
#define VERSION_REVISION "5
8
"
#define VERSION_REVISION "5
9
"
#define RTMP_SIG_SRS_VERSION VERSION_MAJOR"."VERSION_MINOR"."VERSION_REVISION
// server info.
#define RTMP_SIG_SRS_KEY "srs"
...
...
trunk/src/kernel/srs_kernel_log.cpp
查看文件 @
b38df9c
...
...
@@ -23,6 +23,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_kernel_log.hpp>
#include <srs_kernel_error.hpp>
ISrsLog
::
ISrsLog
()
{
}
...
...
@@ -31,6 +33,11 @@ ISrsLog::~ISrsLog()
{
}
int
ISrsLog
::
initialize
()
{
return
ERROR_SUCCESS
;
}
int
ISrsLog
::
level
()
{
return
SrsLogLevel
::
Trace
;
...
...
trunk/src/kernel/srs_kernel_log.hpp
查看文件 @
b38df9c
...
...
@@ -64,6 +64,11 @@ public:
virtual
~
ISrsLog
();
public
:
/**
* initialize log utilities.
*/
virtual
int
initialize
();
public
:
/**
* defined in SrsLogLevel.
*/
virtual
int
level
();
...
...
trunk/src/main/srs_main_server.cpp
查看文件 @
b38df9c
...
...
@@ -55,38 +55,61 @@ void handler(int signo)
_srs_server
->
on_signal
(
signo
);
}
int
run_master
()
int
run
();
int
run_master
();
int
main
(
int
argc
,
char
**
argv
)
{
int
ret
=
ERROR_SUCCESS
;
signal
(
SIGNAL_RELOAD
,
handler
);
signal
(
SIGTERM
,
handler
);
signal
(
SIGINT
,
handler
);
if
((
ret
=
_srs_server
->
acquire_pid_file
())
!=
ERROR_SUCCESS
)
{
return
ret
;
}
// TODO: support both little and big endian.
srs_assert
(
srs_is_little_endian
());
#ifdef SRS_GPERF_MP
HeapProfilerStart
(
"gperf.srs.gmp"
);
#endif
#ifdef SRS_GPERF_CP
ProfilerStart
(
"gperf.srs.gcp"
);
#endif
#ifdef SRS_GPERF_MC
#ifdef SRS_GPERF_MP
srs_error
(
"option --with-gmc confict with --with-gmp, "
"@see: http://google-perftools.googlecode.com/svn/trunk/doc/heap_checker.html
\n
"
"Note that since the heap-checker uses the heap-profiling framework internally, "
"it is not possible to run both the heap-checker and heap profiler at the same time"
);
return
-
1
;
#endif
#endif
if
((
ret
=
_srs_server
->
initialize_st
())
!=
ERROR_SUCCESS
)
{
// never use srs log(srs_trace, srs_error, etc) before config parse the option,
// which will load the log config and apply it.
if
((
ret
=
_srs_config
->
parse_options
(
argc
,
argv
))
!=
ERROR_SUCCESS
)
{
return
ret
;
}
if
((
ret
=
_srs_server
->
listen
())
!=
ERROR_SUCCESS
)
{
// config parsed, initialize log.
if
((
ret
=
_srs_log
->
initialize
())
!=
ERROR_SUCCESS
)
{
return
ret
;
}
_srs_log
->
set_level
(
srs_get_log_level
(
_srs_config
->
get_srs_log_level
()));
if
((
ret
=
_srs_server
->
ingest
())
!=
ERROR_SUCCESS
)
{
return
ret
;
}
srs_trace
(
"srs(simple-rtmp-server) "
RTMP_SIG_SRS_VERSION
);
srs_trace
(
"uname: "
SRS_UNAME
);
srs_trace
(
"build: %s, %s"
,
SRS_BUILD_DATE
,
srs_is_little_endian
()
?
"little-endian"
:
"big-endian"
);
srs_trace
(
"configure: "
SRS_CONFIGURE
);
#ifdef SRS_ARM_UBUNTU12
srs_trace
(
"arm tool chain: "
SRS_ARM_TOOL_CHAIN
);
#endif
if
((
ret
=
_srs_server
->
cycl
e
())
!=
ERROR_SUCCESS
)
{
if
((
ret
=
_srs_server
->
initializ
e
())
!=
ERROR_SUCCESS
)
{
return
ret
;
}
return
0
;
return
run
()
;
}
int
run
()
int
run
()
{
// if not deamon, directly run master.
if
(
!
_srs_config
->
get_deamon
())
{
...
...
@@ -133,50 +156,33 @@ int run()
return
run_master
();
}
int
main
(
int
argc
,
char
**
argv
)
int
run_master
()
{
int
ret
=
ERROR_SUCCESS
;
// TODO: support both little and big endian.
srs_assert
(
srs_is_little_endian
());
#ifdef SRS_GPERF_MP
HeapProfilerStart
(
"gperf.srs.gmp"
);
#endif
#ifdef SRS_GPERF_CP
ProfilerStart
(
"gperf.srs.gcp"
);
#endif
#ifdef SRS_GPERF_MC
#ifdef SRS_GPERF_MP
srs_error
(
"option --with-gmc confict with --with-gmp, "
"@see: http://google-perftools.googlecode.com/svn/trunk/doc/heap_checker.html
\n
"
"Note that since the heap-checker uses the heap-profiling framework internally, "
"it is not possible to run both the heap-checker and heap profiler at the same time"
);
return
-
1
;
#endif
#endif
signal
(
SIGNAL_RELOAD
,
handler
);
signal
(
SIGTERM
,
handler
);
signal
(
SIGINT
,
handler
);
// never use srs log(srs_trace, srs_error, etc) before config parse the option,
// which will load the log config and apply it.
if
((
ret
=
_srs_config
->
parse_options
(
argc
,
argv
))
!=
ERROR_SUCCESS
)
{
if
((
ret
=
_srs_server
->
acquire_pid_file
())
!=
ERROR_SUCCESS
)
{
return
ret
;
}
// config parsed, initialize log.
_srs_log
->
set_level
(
srs_get_log_level
(
_srs_config
->
get_srs_log_level
()));
if
((
ret
=
_srs_server
->
initialize_st
())
!=
ERROR_SUCCESS
)
{
return
ret
;
}
srs_trace
(
"srs(simple-rtmp-server) "
RTMP_SIG_SRS_VERSION
);
srs_trace
(
"uname: "
SRS_UNAME
);
srs_trace
(
"build: %s, %s"
,
SRS_BUILD_DATE
,
srs_is_little_endian
()
?
"little-endian"
:
"big-endian"
);
srs_trace
(
"configure: "
SRS_CONFIGURE
);
#ifdef SRS_ARM_UBUNTU12
srs_trace
(
"arm tool chain: "
SRS_ARM_TOOL_CHAIN
);
#endif
if
((
ret
=
_srs_server
->
listen
())
!=
ERROR_SUCCESS
)
{
return
ret
;
}
if
((
ret
=
_srs_server
->
in
itialize
())
!=
ERROR_SUCCESS
)
{
if
((
ret
=
_srs_server
->
in
gest
())
!=
ERROR_SUCCESS
)
{
return
ret
;
}
return
run
();
if
((
ret
=
_srs_server
->
cycle
())
!=
ERROR_SUCCESS
)
{
return
ret
;
}
return
0
;
}
...
...
请
注册
或
登录
后发表评论