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
2013-11-10 11:52:19 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
3669419e4c238321044693d0a214328cb9040ccd
3669419e
1 parent
6c3b5943
support config and reload the pithy print.
隐藏空白字符变更
内嵌
并排对比
正在显示
20 个修改的文件
包含
234 行增加
和
96 行删除
README.md
trunk/3rdparty/http-parser-2.1.zip
trunk/auto/modules.sh
trunk/conf/srs.conf
trunk/configure
trunk/src/core/srs_core_auto_free.cpp → trunk/src/core/srs_core_autofree.cpp
trunk/src/core/srs_core_auto_free.hpp → trunk/src/core/srs_core_autofree.hpp
trunk/src/core/srs_core_client.cpp
trunk/src/core/srs_core_config.cpp
trunk/src/core/srs_core_config.hpp
trunk/src/core/srs_core_complex_handshake.cpp → trunk/src/core/srs_core_handshake.cpp
trunk/src/core/srs_core_complex_handshake.hpp → trunk/src/core/srs_core_handshake.hpp
trunk/src/core/srs_core_pithy_print.cpp
trunk/src/core/srs_core_protocol.cpp
trunk/src/core/srs_core_reload.cpp
trunk/src/core/srs_core_reload.hpp
trunk/src/core/srs_core_rtmp.cpp
trunk/src/core/srs_core_rtmp.hpp
trunk/src/core/srs_core_source.cpp
trunk/src/srs/srs.upp
README.md
查看文件 @
3669419
...
...
@@ -48,6 +48,7 @@ url: rtmp://127.0.0.1:1935/live/livestream
*
nginx v1.5.0: 139524 lines
<br/>
### History
*
v0.4, 2013-11-10, support config and reload the pithy print.
*
v0.4, 2013-11-09, support reload config(vhost and its detail).
*
v0.4, 2013-11-09, support reload config(listen and chunk_size) by SIGHUP(1).
*
v0.4, 2013-11-09, support longtime(>4.6hours) publish/play.
...
...
trunk/3rdparty/http-parser-2.1.zip
0 → 100644
查看文件 @
3669419
不能预览此文件类型
trunk/auto/modules.sh
100644 → 100755
查看文件 @
3669419
...
...
@@ -15,15 +15,15 @@ FILE=${GLOBAL_DIR_OBJS}/${GLOBAL_FILE_MAKEFILE}
# INCS
INCS_NAME
=
"
${
MODULE_ID
}
_INCS"
echo
"# the
${
MODULE_ID
}
module."
>>
${
FILE
}
echo
"
${
MODULE_ID
}
_MODULE_INCS = -I
${
MODULE_DIR
}
"
>>
${
FILE
}
echo
-n
"
${
INCS_NAME
}
= -I
${
MODULE_DIR
}
"
>>
${
FILE
}
echo
"
${
MODULE_ID
}
_MODULE_INCS = -I
${
MODULE_DIR
}
"
>>
${
FILE
}
echo
-n
"
${
INCS_NAME
}
= -I
${
MODULE_DIR
}
"
>>
${
FILE
}
for
item
in
${
MODULE_DEPENDS
[*]
}
;
do
DEP_INCS_NAME
=
"
${
item
}
_INCS"
do
DEP_INCS_NAME
=
"
${
item
}
_MODULE_INCS"
echo
-n
"
\$
(
${
DEP_INCS_NAME
}
) "
>>
${
FILE
}
done
for
item
in
${
ModuleLibIncs
[*]
}
;
do
echo
-n
"-I
${
item
}
"
>>
${
FILE
}
echo
-n
"-I
${
item
}
"
>>
${
FILE
}
done
echo
""
>>
${
FILE
}
...
...
@@ -50,7 +50,7 @@ for item in ${MODULE_FILES[*]}; do
MODULE_OBJS
=
"
${
MODULE_OBJS
[@]
}
${
CPP_FILE
}
"
if
[
-f
${
CPP_FILE
}
]
;
then
echo
"
${
OBJ_FILE
}
:
\$
(
${
DEPS_NAME
}
)
${
CPP_FILE
}
"
>>
${
FILE
}
echo
"
\$
(GCC) -c
\$
(CXXFLAGS)
\$
(
${
INCS_NAME
}
)
-o
${
OBJ_FILE
}
${
CPP_FILE
}
"
>>
${
FILE
}
echo
"
\$
(GCC) -c
\$
(CXXFLAGS)
\$
(
${
INCS_NAME
}
)-o
${
OBJ_FILE
}
${
CPP_FILE
}
"
>>
${
FILE
}
fi
done
echo
""
>>
${
FILE
}
...
...
trunk/conf/srs.conf
查看文件 @
3669419
# the listen ports, split by space.
listen
1935
;
listen
1935
;
# the default chunk size is 128, max is 65536,
# some client does not support chunk size change,
# however, most clients supports it and it can improve
# performance about 10%.
# if not specified, set to 4096.
chunk_size
65000
;
chunk_size
65000
;
# vhost list, the __defaultVhost__ is the default vhost
# for which cannot identify the required vhost.
vhost
__
defaultVhost__
{
...
...
@@ -47,4 +47,15 @@ vhost refer.anti_suck.com {
# default: not specified.
refer_play
github
.
com
github
.
io
;
}
# config for the pithy print,
# which always print constant message specified by interval,
# whatever the clients in concurrency.
pithy_print
{
# shared print interval for all publish clients, in milliseconds.
# if not specified, set to 1100.
publish
2000
;
# shared print interval for all play clients, in milliseconds.
# if not specified, set to 1300.
play
3000
;
}
...
...
trunk/configure
查看文件 @
3669419
...
...
@@ -16,13 +16,36 @@ if [[ -f ${GLOBAL_DIR_OBJS}/st-1.9/obj/libst.a && -f ${GLOBAL_DIR_OBJS}/st-1.9/o
echo
"st-1.9t is ok."
;
else
echo
"build st-1.9t"
;
(
rm -rf
${
GLOBAL_DIR_OBJS
}
/st-1.9
&&
cd
${
GLOBAL_DIR_OBJS
}
&&
unzip ../3rdparty/st-1.9.zip
&&
cd
st-1.9
&&
make linux-debug
)
(
rm -rf
${
GLOBAL_DIR_OBJS
}
/st-1.9
&&
cd
${
GLOBAL_DIR_OBJS
}
&&
unzip -q ../3rdparty/st-1.9.zip
&&
cd
st-1.9
&&
make linux-debug
&&
cd
..
&&
rm -f st
&&
ln -sf st-1.9/obj st
)
fi
# check status
ret
=
$?
;
if
[[
$ret
-ne 0
]]
;
then
echo
"build st-1.9 failed, ret=
$ret
"
;
exit
$ret
;
fi
if
[
! -f
${
GLOBAL_DIR_OBJS
}
/st-1.9/obj/libst.a
]
;
then
echo
"build st-1.9 failed."
;
exit
-1;
fi
if
[
! -f
${
GLOBAL_DIR_OBJS
}
/st-1.9/obj/libst.so
]
;
then
echo
"build st-1.9 failed."
;
exit
-1;
fi
# http-parser-2.1
if
[[
-f
${
GLOBAL_DIR_OBJS
}
/http-parser-2.1/http_parser.h
&&
-f
${
GLOBAL_DIR_OBJS
}
/http-parser-2.1/libhttp_parser.a
]]
;
then
echo
"http-parser-2.1 is ok."
;
else
echo
"build http-parser-2.1"
;
(
rm -rf
${
GLOBAL_DIR_OBJS
}
/http-parser-2.1
&&
cd
${
GLOBAL_DIR_OBJS
}
&&
unzip -q ../3rdparty/http-parser-2.1.zip
&&
cd
http-parser-2.1
&&
sed -i
"s/CPPFLAGS_FAST +=.*
$/
CPPFLAGS_FAST =
\$\(
CPPFLAGS_DEBUG
\)
/g"
Makefile
&&
sed -i
"s/CFLAGS_FAST =.*
$/
CFLAGS_FAST =
\$\(
CFLAGS_DEBUG
\)
/g"
Makefile
&&
make package
&&
cd
..
&&
rm -f hp
&&
ln -sf http-parser-2.1 hp
)
fi
# check status
ret
=
$?
;
if
[[
$ret
-ne 0
]]
;
then
echo
"build http-parser-2.1 failed, ret=
$ret
"
;
exit
$ret
;
fi
if
[[
! -f
${
GLOBAL_DIR_OBJS
}
/http-parser-2.1/http_parser.h
]]
;
then
echo
"build http-parser-2.1 failed"
;
exit
-1;
fi
if
[[
! -f
${
GLOBAL_DIR_OBJS
}
/http-parser-2.1/libhttp_parser.a
]]
;
then
echo
"build http-parser-2.1 failed"
;
exit
-1;
fi
#####################################################################################
# generate Makefile.
#####################################################################################
...
...
@@ -53,18 +76,16 @@ END
echo
'generate Makefile ok!'
# the performance analysis, uncomments the following when use gperf to analysis the performance. see third-party/readme.txt
#Performance="-pg"
#PerformanceLink="-pg"
Performance
=
"-pg"
# enable gdb debug
GDBDebug
=
"-g -O0"
# the warning level.
WarnLevel
=
"-Wall
-Wextra
"
WarnLevel
=
"-Wall"
# the compile standard.
CppStd
=
"-std=c++98"
# other macros defined
UserMacros
=
""
CppStd
=
"-ansi"
# the cxx flag generated.
CXXFLAGS
=
"
${
CppStd
}
${
WarnLevel
}
${
GDBDebug
}
${
Performance
}
${
UserMacros
}
"
CXXFLAGS
=
"
${
CppStd
}
${
WarnLevel
}
${
GDBDebug
}
"
#CXXFLAGS="${CppStd} ${WarnLevel} ${GDBDebug} ${Performance}"
cat
<< END > ${GLOBAL_DIR_OBJS}/${GLOBAL_FILE_MAKEFILE}
CXXFLAGS = ${CXXFLAGS}
GCC = g++
...
...
@@ -78,19 +99,21 @@ default:
END
# Libraries
LibSTRoot
=
"
${
GLOBAL_DIR_OBJS
}
/st
-1.9/obj
"
LibSTRoot
=
"
${
GLOBAL_DIR_OBJS
}
/st"
LibSTfile
=
"
${
LibSTRoot
}
/libst.a"
LibHttpParserRoot
=
"
${
GLOBAL_DIR_OBJS
}
/hp"
LibHttpParserfile
=
"
${
LibHttpParserRoot
}
/libhttp_parser.a"
#Core Module
MODULE_ID
=
"CORE"
MODULE_DEPENDS
=()
ModuleLibIncs
=(
${
LibSTRoot
}
)
ModuleLibIncs
=(
${
LibSTRoot
}
${
LibHttpParserRoot
}
)
MODULE_FILES
=(
"srs_core"
"srs_core_log"
"srs_core_server"
"srs_core_error"
"srs_core_conn"
"srs_core_client"
"srs_core_rtmp"
"srs_core_socket"
"srs_core_buffer"
"srs_core_auto
_
free"
"srs_core_protocol"
"srs_core_amf0"
"srs_core_autofree"
"srs_core_protocol"
"srs_core_amf0"
"srs_core_stream"
"srs_core_source"
"srs_core_codec"
"srs_core_
complex_
handshake"
"srs_core_pithy_print"
"srs_core_handshake"
"srs_core_pithy_print"
"srs_core_config"
"srs_core_refer"
"srs_core_reload"
)
MODULE_DIR
=
"src/core"
. auto/modules.sh
CORE_OBJS
=
"
${
MODULE_OBJS
[@]
}
"
...
...
@@ -107,7 +130,7 @@ MAIN_OBJS="${MODULE_OBJS[@].o}"
MAIN_ENTRANCES
=(
"srs_main_server"
)
# srs(simple rtmp server) over st(state-threads)
ModuleLibFiles
=(
${
LibSTfile
}
)
ModuleLibFiles
=(
${
LibSTfile
}
${
LibHttpParserfile
}
)
MODULE_OBJS
=
"
${
CORE_OBJS
[@]
}
${
CONFIG_OBJS
[@]
}
${
PROTOCOL_OBJS
[@]
}
${
MAIN_OBJS
[@]
}
"
BUILD_KEY
=
"simple_rtmp_server"
APP_MAIN
=
"srs_main_server"
APP_NAME
=
"simple_rtmp_server"
LINK_OPTIONS
=
"-ldl -lssl"
SO_PATH
=
""
. auto/apps.sh
...
...
trunk/src/core/srs_core_auto
_
free.cpp → trunk/src/core/srs_core_autofree.cpp
查看文件 @
3669419
...
...
@@ -21,4 +21,4 @@ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <srs_core_auto
_
free.hpp>
#include <srs_core_autofree.hpp>
...
...
trunk/src/core/srs_core_auto
_
free.hpp → trunk/src/core/srs_core_autofree.hpp
查看文件 @
3669419
...
...
@@ -25,7 +25,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define SRS_CORE_AUTO_FREE_HPP
/*
#include <srs_core_auto
_
free.hpp>
#include <srs_core_autofree.hpp>
*/
#include <srs_core.hpp>
...
...
trunk/src/core/srs_core_client.cpp
查看文件 @
3669419
...
...
@@ -30,7 +30,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_core_log.hpp>
#include <srs_core_rtmp.hpp>
#include <srs_core_protocol.hpp>
#include <srs_core_auto
_
free.hpp>
#include <srs_core_autofree.hpp>
#include <srs_core_source.hpp>
#include <srs_core_server.hpp>
#include <srs_core_pithy_print.hpp>
...
...
trunk/src/core/srs_core_config.cpp
查看文件 @
3669419
...
...
@@ -38,7 +38,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_core_error.hpp>
#include <srs_core_log.hpp>
#include <srs_core_auto
_
free.hpp>
#include <srs_core_autofree.hpp>
#define FILE_OFFSET(fd) lseek(fd, 0, SEEK_CUR)
...
...
@@ -455,6 +455,18 @@ int SrsConfig::reload()
return
ret
;
}
}
srs_trace
(
"reload listen success."
);
}
// merge config: pithy_print
if
(
!
srs_directive_equals
(
root
->
get
(
"pithy_print"
),
old_root
->
get
(
"pithy_print"
)))
{
for
(
it
=
subscribes
.
begin
();
it
!=
subscribes
.
end
();
++
it
)
{
SrsReloadHandler
*
subscribe
=
*
it
;
if
((
ret
=
subscribe
->
on_reload_pithy_print
())
!=
ERROR_SUCCESS
)
{
srs_error
(
"notify subscribes pithy_print listen failed. ret=%d"
,
ret
);
return
ret
;
}
}
srs_trace
(
"reload pithy_print success."
);
}
return
ret
;
...
...
@@ -593,6 +605,26 @@ SrsConfDirective* SrsConfig::get_chunk_size()
return
root
->
get
(
"chunk_size"
);
}
SrsConfDirective
*
SrsConfig
::
get_pithy_print_publish
()
{
SrsConfDirective
*
pithy
=
root
->
get
(
"pithy_print"
);
if
(
!
pithy
)
{
return
NULL
;
}
return
pithy
->
get
(
"publish"
);
}
SrsConfDirective
*
SrsConfig
::
get_pithy_print_play
()
{
SrsConfDirective
*
pithy
=
root
->
get
(
"pithy_print"
);
if
(
!
pithy
)
{
return
NULL
;
}
return
pithy
->
get
(
"play"
);
}
int
SrsConfig
::
parse_file
(
const
char
*
filename
)
{
int
ret
=
ERROR_SUCCESS
;
...
...
trunk/src/core/srs_core_config.hpp
查看文件 @
3669419
...
...
@@ -114,6 +114,8 @@ public:
virtual
SrsConfDirective
*
get_refer_publish
(
std
::
string
vhost
);
virtual
SrsConfDirective
*
get_listen
();
virtual
SrsConfDirective
*
get_chunk_size
();
virtual
SrsConfDirective
*
get_pithy_print_publish
();
virtual
SrsConfDirective
*
get_pithy_print_play
();
private
:
virtual
int
parse_file
(
const
char
*
filename
);
virtual
int
parse_argv
(
int
&
i
,
char
**
argv
);
...
...
trunk/src/core/srs_core_
complex_
handshake.cpp → trunk/src/core/srs_core_handshake.cpp
查看文件 @
3669419
...
...
@@ -21,14 +21,14 @@ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <srs_core_
complex_
handshake.hpp>
#include <srs_core_handshake.hpp>
#include <time.h>
#include <stdlib.h>
#include <srs_core_error.hpp>
#include <srs_core_log.hpp>
#include <srs_core_auto
_
free.hpp>
#include <srs_core_autofree.hpp>
#include <srs_core_socket.hpp>
// 68bytes FMS key which is used to sign the sever packet.
...
...
@@ -1058,6 +1058,72 @@ void c1s1::destroy_blocks()
}
}
SrsSimpleHandshake
::
SrsSimpleHandshake
()
{
}
SrsSimpleHandshake
::~
SrsSimpleHandshake
()
{
}
int
SrsSimpleHandshake
::
handshake
(
SrsSocket
&
skt
)
{
int
ret
=
ERROR_SUCCESS
;
ssize_t
nsize
;
char
*
c0c1
=
new
char
[
1537
];
SrsAutoFree
(
char
,
c0c1
,
true
);
if
((
ret
=
skt
.
read_fully
(
c0c1
,
1537
,
&
nsize
))
!=
ERROR_SUCCESS
)
{
srs_warn
(
"read c0c1 failed. ret=%d"
,
ret
);
return
ret
;
}
srs_verbose
(
"read c0c1 success."
);
// plain text required.
if
(
c0c1
[
0
]
!=
0x03
)
{
ret
=
ERROR_RTMP_PLAIN_REQUIRED
;
srs_warn
(
"only support rtmp plain text. ret=%d"
,
ret
);
return
ret
;
}
srs_verbose
(
"check c0 success, required plain text."
);
// try complex handshake
SrsComplexHandshake
complex_handshake
;
ret
=
complex_handshake
.
handshake
(
skt
,
c0c1
+
1
);
if
(
ret
==
ERROR_SUCCESS
)
{
srs_trace
(
"complex handshake success."
);
return
ret
;
}
if
(
ret
!=
ERROR_RTMP_TRY_SIMPLE_HS
)
{
srs_error
(
"complex handshake failed. ret=%d"
,
ret
);
return
ret
;
}
srs_info
(
"complex handhskae failed, try simple. ret=%d"
,
ret
);
char
*
s0s1s2
=
new
char
[
3073
];
SrsAutoFree
(
char
,
s0s1s2
,
true
);
// plain text required.
s0s1s2
[
0
]
=
0x03
;
if
((
ret
=
skt
.
write
(
s0s1s2
,
3073
,
&
nsize
))
!=
ERROR_SUCCESS
)
{
srs_warn
(
"simple handshake send s0s1s2 failed. ret=%d"
,
ret
);
return
ret
;
}
srs_verbose
(
"simple handshake send s0s1s2 success."
);
char
*
c2
=
new
char
[
1536
];
SrsAutoFree
(
char
,
c2
,
true
);
if
((
ret
=
skt
.
read_fully
(
c2
,
1536
,
&
nsize
))
!=
ERROR_SUCCESS
)
{
srs_warn
(
"simple handshake read c2 failed. ret=%d"
,
ret
);
return
ret
;
}
srs_verbose
(
"simple handshake read c2 success."
);
srs_trace
(
"simple handshake success."
);
return
ret
;
}
SrsComplexHandshake
::
SrsComplexHandshake
()
{
}
...
...
trunk/src/core/srs_core_
complex_
handshake.hpp → trunk/src/core/srs_core_handshake.hpp
查看文件 @
3669419
...
...
@@ -21,8 +21,8 @@ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef SRS_CORE_COMPLEX_HANDSHKAE_HPP
#define SRS_CORE_COMPLEX_HANDSHKAE_HPP
#ifndef SRS_CORE_HANDSHKAE_HPP
#define SRS_CORE_HANDSHKAE_HPP
/*
#include <srs_core_complex_handshake.hpp>
...
...
@@ -33,6 +33,21 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
class
SrsSocket
;
/**
* try complex handshake, if failed, fallback to simple handshake.
*/
class
SrsSimpleHandshake
{
public
:
SrsSimpleHandshake
();
virtual
~
SrsSimpleHandshake
();
public
:
/**
* simple handshake.
*/
virtual
int
handshake
(
SrsSocket
&
skt
);
};
/**
* rtmp complex handshake,
* @see also crtmp(crtmpserver) or librtmp,
* @see also: http://blog.csdn.net/win_lin/article/details/13006803
...
...
trunk/src/core/srs_core_pithy_print.cpp
查看文件 @
3669419
...
...
@@ -23,15 +23,19 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_core_pithy_print.hpp>
#include <stdlib.h>
#include <map>
#include <srs_core_log.hpp>
#include <srs_core_config.hpp>
#include <srs_core_reload.hpp>
#include <srs_core_error.hpp>
#define SRS_STAGE_DEFAULT_INTERVAL_MS 1200
#define SRS_STAGE_PLAY_USER_INTERVAL_MS 1300
#define SRS_STAGE_PUBLISH_USER_INTERVAL_MS 1100
struct
SrsStageInfo
struct
SrsStageInfo
:
public
SrsReloadHandler
{
int
stage_id
;
int
pithy_print_time_ms
;
...
...
@@ -40,19 +44,46 @@ struct SrsStageInfo
SrsStageInfo
(
int
_stage_id
)
{
stage_id
=
_stage_id
;
switch
(
_stage_id
)
{
case
SRS_STAGE_PLAY_USER
:
nb_clients
=
0
;
update_print_time
();
config
->
subscribe
(
this
);
}
virtual
~
SrsStageInfo
()
{
config
->
unsubscribe
(
this
);
}
void
update_print_time
()
{
switch
(
stage_id
)
{
case
SRS_STAGE_PLAY_USER
:
{
pithy_print_time_ms
=
SRS_STAGE_PLAY_USER_INTERVAL_MS
;
case
SRS_STAGE_PUBLISH_USER
:
SrsConfDirective
*
conf
=
config
->
get_pithy_print_play
();
if
(
conf
&&
!
conf
->
arg0
().
empty
())
{
pithy_print_time_ms
=
::
atoi
(
conf
->
arg0
().
c_str
());
}
break
;
}
case
SRS_STAGE_PUBLISH_USER
:
{
pithy_print_time_ms
=
SRS_STAGE_PUBLISH_USER_INTERVAL_MS
;
SrsConfDirective
*
conf
=
config
->
get_pithy_print_publish
();
if
(
conf
&&
!
conf
->
arg0
().
empty
())
{
pithy_print_time_ms
=
::
atoi
(
conf
->
arg0
().
c_str
());
}
break
;
default
:
}
default
:
{
pithy_print_time_ms
=
SRS_STAGE_DEFAULT_INTERVAL_MS
;
break
;
}
}
nb_clients
=
0
;
}
public
:
virtual
int
on_reload_pithy_print
()
{
update_print_time
();
return
ERROR_SUCCESS
;
}
};
static
std
::
map
<
int
,
SrsStageInfo
*>
_srs_stages
;
...
...
trunk/src/core/srs_core_protocol.cpp
查看文件 @
3669419
...
...
@@ -29,7 +29,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_core_socket.hpp>
#include <srs_core_buffer.hpp>
#include <srs_core_stream.hpp>
#include <srs_core_auto
_
free.hpp>
#include <srs_core_autofree.hpp>
/****************************************************************************
*****************************************************************************
...
...
trunk/src/core/srs_core_reload.cpp
查看文件 @
3669419
...
...
@@ -35,7 +35,11 @@ SrsReloadHandler::~SrsReloadHandler()
int
SrsReloadHandler
::
on_reload_listen
()
{
int
ret
=
ERROR_SUCCESS
;
return
ret
;
return
ERROR_SUCCESS
;
}
int
SrsReloadHandler
::
on_reload_pithy_print
()
{
return
ERROR_SUCCESS
;
}
...
...
trunk/src/core/srs_core_reload.hpp
查看文件 @
3669419
...
...
@@ -39,6 +39,7 @@ public:
virtual
~
SrsReloadHandler
();
public
:
virtual
int
on_reload_listen
();
virtual
int
on_reload_pithy_print
();
};
#endif
\ No newline at end of file
...
...
trunk/src/core/srs_core_rtmp.cpp
查看文件 @
3669419
...
...
@@ -27,9 +27,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_core_error.hpp>
#include <srs_core_socket.hpp>
#include <srs_core_protocol.hpp>
#include <srs_core_auto
_
free.hpp>
#include <srs_core_autofree.hpp>
#include <srs_core_amf0.hpp>
#include <srs_core_
complex_
handshake.hpp>
#include <srs_core_handshake.hpp>
/**
* the signature for packets to client.
...
...
@@ -167,13 +167,11 @@ SrsRtmp::SrsRtmp(st_netfd_t client_stfd)
{
protocol
=
new
SrsProtocol
(
client_stfd
);
stfd
=
client_stfd
;
complex_handshake
=
new
SrsComplexHandshake
();
}
SrsRtmp
::~
SrsRtmp
()
{
srs_freep
(
protocol
);
srs_freep
(
complex_handshake
);
}
void
SrsRtmp
::
set_recv_timeout
(
int64_t
timeout_us
)
...
...
@@ -225,58 +223,14 @@ int SrsRtmp::handshake()
{
int
ret
=
ERROR_SUCCESS
;
ssize_t
nsize
;
SrsSocket
skt
(
stfd
);
char
*
c0c1
=
new
char
[
1537
];
SrsAutoFree
(
char
,
c0c1
,
true
);
if
((
ret
=
skt
.
read_fully
(
c0c1
,
1537
,
&
nsize
))
!=
ERROR_SUCCESS
)
{
srs_warn
(
"read c0c1 failed. ret=%d"
,
ret
);
SrsSimpleHandshake
hs
;
if
((
ret
=
hs
.
handshake
(
skt
))
!=
ERROR_SUCCESS
)
{
return
ret
;
}
srs_verbose
(
"read c0c1 success."
);
// plain text required.
if
(
c0c1
[
0
]
!=
0x03
)
{
ret
=
ERROR_RTMP_PLAIN_REQUIRED
;
srs_warn
(
"only support rtmp plain text. ret=%d"
,
ret
);
return
ret
;
}
srs_verbose
(
"check c0 success, required plain text."
);
// try complex handshake
ret
=
complex_handshake
->
handshake
(
skt
,
c0c1
+
1
);
if
(
ret
==
ERROR_SUCCESS
)
{
srs_trace
(
"complex handshake success."
);
return
ret
;
}
if
(
ret
!=
ERROR_RTMP_TRY_SIMPLE_HS
)
{
srs_error
(
"complex handshake failed. ret=%d"
,
ret
);
return
ret
;
}
srs_info
(
"complex handhskae failed, try simple. ret=%d"
,
ret
);
char
*
s0s1s2
=
new
char
[
3073
];
SrsAutoFree
(
char
,
s0s1s2
,
true
);
// plain text required.
s0s1s2
[
0
]
=
0x03
;
if
((
ret
=
skt
.
write
(
s0s1s2
,
3073
,
&
nsize
))
!=
ERROR_SUCCESS
)
{
srs_warn
(
"simple handshake send s0s1s2 failed. ret=%d"
,
ret
);
return
ret
;
}
srs_verbose
(
"simple handshake send s0s1s2 success."
);
char
*
c2
=
new
char
[
1536
];
SrsAutoFree
(
char
,
c2
,
true
);
if
((
ret
=
skt
.
read_fully
(
c2
,
1536
,
&
nsize
))
!=
ERROR_SUCCESS
)
{
srs_warn
(
"simple handshake read c2 failed. ret=%d"
,
ret
);
return
ret
;
}
srs_verbose
(
"simple handshake read c2 success."
);
srs_trace
(
"simple handshake success."
);
return
ret
;
return
ret
;
}
int
SrsRtmp
::
connect_app
(
SrsRequest
*
req
)
...
...
trunk/src/core/srs_core_rtmp.hpp
查看文件 @
3669419
...
...
@@ -39,7 +39,6 @@ class ISrsMessage;
class
SrsCommonMessage
;
class
SrsCreateStreamPacket
;
class
SrsFMLEStartPacket
;
class
SrsComplexHandshake
;
class
SrsPublishPacket
;
/**
...
...
@@ -101,7 +100,6 @@ enum SrsClientType
class
SrsRtmp
{
private
:
SrsComplexHandshake
*
complex_handshake
;
SrsProtocol
*
protocol
;
st_netfd_t
stfd
;
public
:
...
...
trunk/src/core/srs_core_source.cpp
查看文件 @
3669419
...
...
@@ -27,7 +27,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_core_log.hpp>
#include <srs_core_protocol.hpp>
#include <srs_core_auto
_
free.hpp>
#include <srs_core_autofree.hpp>
#include <srs_core_amf0.hpp>
#include <srs_core_codec.hpp>
...
...
trunk/src/srs/srs.upp
查看文件 @
3669419
...
...
@@ -6,8 +6,8 @@ file
..\core\srs_core.cpp,
..\core\srs_core_error.hpp,
..\core\srs_core_error.cpp,
..\core\srs_core_auto_free.hpp,
..\core\srs_core_auto_free.cpp,
..\core\srs_core_autofree.hpp,
..\core\srs_core_autofree.cpp,
..\core\srs_core_server.hpp,
..\core\srs_core_server.cpp,
..\core\srs_core_reload.hpp,
...
...
@@ -26,8 +26,8 @@ file
..\core\srs_core_codec.cpp,
..\core\srs_core_rtmp.hpp,
..\core\srs_core_rtmp.cpp,
..\core\srs_core_complex_handshake.hpp,
..\core\srs_core_complex_handshake.cpp,
..\core\srs_core_handshake.hpp,
..\core\srs_core_handshake.cpp,
..\core\srs_core_protocol.hpp,
..\core\srs_core_protocol.cpp,
..\core\srs_core_amf0.hpp,
...
...
请
注册
或
登录
后发表评论