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-03-22 20:53:29 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
3c920b933c2f2da2837a7e5df20f3cf302262b3f
3c920b93
1 parent
d595f8fc
add ./etc/init.d/srs, refine configure to support make clean then make.
显示空白字符变更
内嵌
并排对比
正在显示
7 个修改的文件
包含
154 行增加
和
5 行删除
README.md
trunk/conf/full.conf
trunk/configure
trunk/etc/init.d/srs
trunk/src/app/srs_app_server.cpp
trunk/src/core/srs_core.hpp
trunk/src/main/srs_main_server.cpp
README.md
查看文件 @
3c920b9
...
...
@@ -169,6 +169,7 @@ See also: [Performance Test Guide](https://github.com/winlinvip/simple-rtmp-serv
*
nginx v1.5.0: 139524 lines
<br/>
## History
*
v1.0, 2014-03-22, add ./etc/init.d/srs, refine configure to support make clean then make.
*
v1.0, 2014-03-21, write pid to ./objs/srs.pid.
*
v1.0, 2014-03-20, refine hls code, support pure audio HLS.
*
v1.0, 2014-03-19, add vn/an for FFMPEG to drop video/audio for radio stream.
...
...
trunk/conf/full.conf
查看文件 @
3c920b9
...
...
@@ -21,7 +21,7 @@ log_dir ./objs/logs;
# the max connections.
# if exceed the max connections, server will drop the new connection.
# default: 2000
max_connections
2
000
;
max_connections
1
000
;
# vhost list, the __defaultVhost__ is the default vhost
# for example, user use ip to access the stream: rtmp://192.168.1.2/live/livestream.
# for which cannot identify the required vhost.
...
...
trunk/configure
查看文件 @
3c920b9
...
...
@@ -194,8 +194,7 @@ help:
@echo " utest build the utest for srs"
clean:
(rm -f Makefile)
(cd ${SRS_OBJS}; rm -rf ${SRS_BUILD_SUMMARY} srs bandwidth *.hpp srs_utest)
(cd ${SRS_OBJS}; rm -f rm -rf srs bandwidth srs_utest)
(cd ${SRS_OBJS}; rm -rf src research include lib utest)
(cd research/librtmp; make clean)
...
...
trunk/etc/init.d/srs
0 → 100755
查看文件 @
3c920b9
#!/bin/bash
### BEGIN INIT INFO
# Provides: simple-rtmp-server(srs)
# RequiRED-Start: $all
# RequiRED-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: simple-rtmp-server(srs)
# Description: https://github.com/winlinvip/simple-rtmp-server
### END INIT INFO
RED
=
"
\\
e[31m"
GREEN
=
"
\\
e[32m"
YELLOW
=
"
\\
e[33m"
BLACK
=
"
\\
e[0m"
POS
=
"
\\
e[60G"
# the pid file is generated by install wizard
ROOT
=
"./"
APP
=
"./objs/srs"
CONFIG
=
"./conf/srs.conf"
DEFAULT_PID_FILE
=
'./objs/srs.pid'
ok_msg
(){
echo
-e
"
${
1
}${
POS
}${
BLACK
}
[
${
GREEN
}
OK
${
BLACK
}
]"
}
failed_msg
(){
echo
-e
"
${
1
}${
POS
}${
BLACK
}
[
${
RED
}
FAILED
${
BLACK
}
]"
}
# load process info of srs
# @set variable $srs_pid to the process id in srs.pid file.
# @return 0, if process exists; otherwise:
# 1, for pid file not exists.
# 2, for get proecess info by pid failed.
# @set variable $error_msg if error.
# @set variable $srs_pid_file to pid file.
load_process_info
()
{
srs_pid_file
=
`
cat
${
ROOT
}
/
${
CONFIG
}
|grep ^pid|awk
'{print $2}'
|awk -F
';'
'{print $1}'
`
if
[[
-z
$srs_pid_file
]]
;
then
srs_pid_file
=
${
DEFAULT_PID_FILE
}
;
fi
srs_pid
=
`
cat
$srs_pid_file
2>/dev/null
`
ret
=
$?
;
if
[[
0 -ne
$ret
]]
;
then
error_msg
=
"file
$srs_pid_file
does not exists"
;
return
1;
fi
ps -p
${
srs_pid
}
>/dev/null 2>/dev/null
ret
=
$?
;
if
[[
0 -ne
$ret
]]
;
then
error_msg
=
"process
$srs_pid
does not exists"
;
return
2;
fi
return
0;
}
start
()
{
# if exists, exit.
load_process_info
if
[[
0 -eq
$?
]]
;
then
failed_msg
"srs started(pid
${
srs_pid
}
), should not start it again."
return
0
fi
# try to get log dir.
# not exists, start server
ok_msg
"Starting srs..."
# TODO: FIXME: set limit by, for instance, "ulimit -HSn 10000"
# TODO: FIXME: write log to, for instance, the same dir of log.
# TODO: FIXME: support deamon, without nohup.
(
cd
${
ROOT
}
; nohup
${
APP
}
-c
${
CONFIG
}
>/dev/null 2>&1 &
)
# check again after start server
load_process_info
if
[[
0 -eq
$?
]]
;
then
ok_msg
"srs started(pid
${
srs_pid
}
)"
else
failed_msg
"srs not started"
fi
}
stop
()
{
# not start, exit
load_process_info
if
[[
0 -ne
$?
]]
;
then
failed_msg
"srs not start."
return
0
fi
ok_msg
"Stopping srs(pid
${
srs_pid
}
)..."
# process exists, kill util stop
for
((
;;
))
;
do
load_process_info
if
[[
0 -eq
$?
]]
;
then
kill
-s SIGTERM
${
srs_pid
}
2>/dev/null
ret
=
$?
;
if
[[
0 -ne
$ret
]]
;
then
failed_msg
"send signal SIGTERM failed ret=
$ret
"
;
return
$ret
;
fi
sleep 0.1
else
ok_msg
"srs stopped"
break
;
fi
done
sleep 0.1
return
0
}
# get the status of srs process
# @return 0 if srs is running; otherwise, 1 for stopped.
status
()
{
load_process_info
ret
=
$?
;
if
[[
0 -eq
$ret
]]
;
then
echo
"srs(pid
${
srs_pid
}
) is running."
return
0
fi
echo
"srs is stopped,
$error_msg
"
return
1
}
menu
()
{
case
"
$1
"
in
start
)
start
;;
stop
)
stop
;;
restart
)
stop
start
;;
status
)
status
;;
*
)
echo
"Usage:
$0
{start|stop|status|restart|reload}"
return
1
;;
esac
}
menu
$1
code
=
$?
exit
${
code
}
...
...
trunk/src/app/srs_app_server.cpp
查看文件 @
3c920b9
...
...
@@ -371,7 +371,11 @@ void SrsServer::on_signal(int signo)
return
;
}
// TODO: handle the SIGINT, SIGTERM.
if
(
signo
==
SIGTERM
)
{
srs_trace
(
"user terminate program"
);
exit
(
0
);
return
;
}
}
void
SrsServer
::
close_listeners
()
...
...
trunk/src/core/srs_core.hpp
查看文件 @
3c920b9
...
...
@@ -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 "2
4"
#define VERSION_REVISION "2
5"
#define RTMP_SIG_SRS_VERSION VERSION_MAJOR"."VERSION_MINOR"."VERSION_REVISION
// server info.
#define RTMP_SIG_SRS_KEY "srs"
...
...
trunk/src/main/srs_main_server.cpp
查看文件 @
3c920b9
...
...
@@ -65,6 +65,7 @@ int main(int argc, char** argv)
#endif
signal
(
SIGNAL_RELOAD
,
handler
);
signal
(
SIGTERM
,
handler
);
signal
(
SIGINT
,
handler
);
if
((
ret
=
_srs_config
->
parse_options
(
argc
,
argv
))
!=
ERROR_SUCCESS
)
{
...
...
请
注册
或
登录
后发表评论