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-11-22 17:58:02 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
58136ec178e3d47db6c90a59875d7e40946936e5
58136ec1
1 parent
622218c4
fix #217, remove timeout recv, support 7.5k+ 250kbps clients. 2.0.30.
显示空白字符变更
内嵌
并排对比
正在显示
8 个修改的文件
包含
177 行增加
和
77 行删除
README.md
trunk/configure
trunk/src/app/srs_app_recv_thread.cpp
trunk/src/app/srs_app_recv_thread.hpp
trunk/src/app/srs_app_rtmp_conn.cpp
trunk/src/app/srs_app_rtmp_conn.hpp
trunk/src/core/srs_core.hpp
trunk/src/srs/srs.upp
README.md
查看文件 @
58136ec
...
...
@@ -445,11 +445,12 @@ Supported operating systems and hardware:
[
CN
](
https://github.com/winlinvip/simple-rtmp-server/wiki/v2_CN_SrsLibrtmp#publish-h264-raw-data
)
,
[
EN
](
https://github.com/winlinvip/simple-rtmp-server/wiki/v2_EN_SrsLibrtmp#publish-h264-raw-data
)
) by srs-librtmp.
1.
Support
[
6k+ clients
](
https://github.com/winlinvip/simple-rtmp-server/issues/194
)
,
4
Gbps per process.
1.
Support
[
6k+ clients
](
https://github.com/winlinvip/simple-rtmp-server/issues/194
)
,
3
Gbps per process.
1.
Suppport
[
English wiki
](
https://github.com/winlinvip/simple-rtmp-server/wiki/v1_EN_Home
)
.
1.
Research and simplify st,
[
bug #182
](
https://github.com/winlinvip/simple-rtmp-server/issues/182
)
.
1.
Support compile
[
srs-librtmp on windows
](
https://github.com/winlinvip/srs.librtmp
)
,
[
bug #213
](
https://github.com/winlinvip/simple-rtmp-server/issues/213
)
.
1.
Support
[
7.5k+ clients
](
https://github.com/winlinvip/simple-rtmp-server/issues/217
)
, 4Gbps per process.
1.
[
no-plan
]
Support <500ms latency, FRSC(Fast RTMP-compatible Stream Channel tech).
1.
[
no-plan
]
Support RTMP 302 redirect
[
#92
](
https://github.com/winlinvip/simple-rtmp-server/issues/92
)
.
1.
[
no-plan
]
Support multiple processes, for both origin and edge
...
...
@@ -482,6 +483,7 @@ Supported operating systems and hardware:
*
2013-10-17, Created.
<br/>
## History
*
v2.0, 2014-11-22, fix
[
#217
](
https://github.com/winlinvip/simple-rtmp-server/issues/217
)
, remove timeout recv, support 7.5k+ 250kbps clients. 2.0.30.
*
v2.0, 2014-11-21, srs-librtmp add rtmp prefix for rtmp/utils/human apis. 2.0.29.
*
v2.0, 2014-11-21, refine examples of srs-librtmp, add srs_print_rtmp_packet. 2.0.28.
*
v2.0, 2014-11-20, fix
[
#212
](
https://github.com/winlinvip/simple-rtmp-server/issues/212
)
, support publish audio raw frames. 2.0.27
...
...
@@ -700,6 +702,7 @@ Performance benchmark history, on virtual box:
*
2014-11-12, SRS 2.0.14, 2700clients, 69%CPU, 59MB.
*
2014-11-12, SRS 2.0.14, 3500clients, 95%CPU, 78MB.
*
2014-11-13, SRS 2.0.15, 6000clients, 82%CPU, 203MB. (500 publishers).
*
2014-11-22, SRS 2.0.30, 7500clients, 87%CPU, 320MB.
Latest benchmark(2014-07-12):
...
...
trunk/configure
查看文件 @
58136ec
...
...
@@ -388,7 +388,8 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
"srs_app_thread"
"srs_app_bandwidth"
"srs_app_st"
"srs_app_log"
"srs_app_config"
"srs_app_pithy_print"
"srs_app_reload"
"srs_app_http_api"
"srs_app_http_conn"
"srs_app_http_hooks"
"srs_app_json"
"srs_app_ingest"
"srs_app_ffmpeg"
"srs_app_utility"
"srs_app_dvr"
"srs_app_edge"
"srs_app_kbps"
"srs_app_heartbeat"
"srs_app_empty"
"srs_app_http_client"
"srs_app_avc_aac"
)
"srs_app_kbps"
"srs_app_heartbeat"
"srs_app_empty"
"srs_app_http_client"
"srs_app_avc_aac"
"srs_app_recv_thread"
)
APP_INCS
=
"src/app"
;
MODULE_DIR
=
${
APP_INCS
}
. auto/modules.sh
APP_OBJS
=
"
${
MODULE_OBJS
[@]
}
"
fi
...
...
trunk/src/app/srs_app_recv_thread.cpp
0 → 100644
查看文件 @
58136ec
/*
The MIT License (MIT)
Copyright (c) 2013-2014 winlin
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
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_app_recv_thread.hpp>
#include <srs_protocol_rtmp.hpp>
#include <srs_protocol_stack.hpp>
SrsRecvThread
::
SrsRecvThread
(
SrsRtmpServer
*
rtmp_sdk
)
{
rtmp
=
rtmp_sdk
;
trd
=
new
SrsThread
(
this
,
0
,
true
);
}
SrsRecvThread
::~
SrsRecvThread
()
{
// stop recv thread.
stop
();
// destroy the thread.
srs_freep
(
trd
);
// clear all messages.
std
::
vector
<
SrsMessage
*>::
iterator
it
;
for
(
it
=
queue
.
begin
();
it
!=
queue
.
end
();
++
it
)
{
SrsMessage
*
msg
=
*
it
;
srs_freep
(
msg
);
}
queue
.
clear
();
}
bool
SrsRecvThread
::
empty
()
{
return
queue
.
empty
();
}
SrsMessage
*
SrsRecvThread
::
pump
()
{
srs_assert
(
!
queue
.
empty
());
SrsMessage
*
msg
=
*
queue
.
begin
();
queue
.
erase
(
queue
.
begin
());
return
msg
;
}
int
SrsRecvThread
::
start
()
{
return
trd
->
start
();
}
void
SrsRecvThread
::
stop
()
{
trd
->
stop
();
}
int
SrsRecvThread
::
cycle
()
{
int
ret
=
ERROR_SUCCESS
;
SrsMessage
*
msg
=
NULL
;
if
((
ret
=
rtmp
->
recv_message
(
&
msg
))
!=
ERROR_SUCCESS
)
{
if
(
!
srs_is_client_gracefully_close
(
ret
))
{
srs_error
(
"recv client control message failed. ret=%d"
,
ret
);
}
// we use no timeout to recv, should never got any error.
trd
->
stop_loop
();
return
ret
;
}
srs_verbose
(
"play loop recv message. ret=%d"
,
ret
);
return
ret
;
}
...
...
trunk/src/app/srs_app_recv_thread.hpp
0 → 100644
查看文件 @
58136ec
/*
The MIT License (MIT)
Copyright (c) 2013-2014 winlin
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
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_APP_RECV_THREAD_HPP
#define SRS_APP_RECV_THREAD_HPP
/*
#include <srs_app_recv_thread.hpp>
*/
#include <srs_core.hpp>
#include <vector>
#include <srs_app_thread.hpp>
class
SrsRtmpServer
;
class
SrsMessage
;
/**
* the recv thread used to replace the timeout recv,
* which hurt performance for the epoll_ctrl is frequently used.
* @see: SrsRtmpConn::playing
* @see: https://github.com/winlinvip/simple-rtmp-server/issues/217
*/
class
SrsRecvThread
:
public
ISrsThreadHandler
{
private
:
SrsThread
*
trd
;
SrsRtmpServer
*
rtmp
;
std
::
vector
<
SrsMessage
*>
queue
;
public
:
SrsRecvThread
(
SrsRtmpServer
*
rtmp_sdk
);
virtual
~
SrsRecvThread
();
public
:
virtual
bool
empty
();
virtual
SrsMessage
*
pump
();
public
:
virtual
int
start
();
virtual
void
stop
();
virtual
int
cycle
();
};
#endif
...
...
trunk/src/app/srs_app_rtmp_conn.cpp
查看文件 @
58136ec
...
...
@@ -48,6 +48,7 @@ using namespace std;
#include <srs_app_utility.hpp>
#include <srs_protocol_msg_array.hpp>
#include <srs_protocol_amf0.hpp>
#include <srs_app_recv_thread.hpp>
// when stream is busy, for example, streaming is already
// publishing, when a new client to request to publish,
...
...
@@ -493,76 +494,6 @@ int SrsRtmpConn::check_vhost()
return
ret
;
}
class
IsolateRecvThread
:
public
ISrsThreadHandler
{
private
:
SrsThread
*
trd
;
SrsRtmpServer
*
rtmp
;
std
::
vector
<
SrsMessage
*>
queue
;
public
:
IsolateRecvThread
(
SrsRtmpServer
*
rtmp_sdk
)
{
rtmp
=
rtmp_sdk
;
trd
=
new
SrsThread
(
this
,
0
,
true
);
}
virtual
~
IsolateRecvThread
()
{
// stop recv thread.
stop
();
// destroy the thread.
srs_freep
(
trd
);
// clear all messages.
std
::
vector
<
SrsMessage
*>::
iterator
it
;
for
(
it
=
queue
.
begin
();
it
!=
queue
.
end
();
++
it
)
{
SrsMessage
*
msg
=
*
it
;
srs_freep
(
msg
);
}
queue
.
clear
();
}
public
:
virtual
bool
empty
()
{
return
queue
.
empty
();
}
virtual
SrsMessage
*
pump
()
{
SrsMessage
*
msg
=
*
queue
.
begin
();
queue
.
erase
(
queue
.
begin
());
return
msg
;
}
public
:
virtual
int
start
()
{
return
trd
->
start
();
}
virtual
void
stop
()
{
trd
->
stop
();
}
virtual
int
cycle
()
{
int
ret
=
ERROR_SUCCESS
;
SrsMessage
*
msg
=
NULL
;
if
((
ret
=
rtmp
->
recv_message
(
&
msg
))
!=
ERROR_SUCCESS
)
{
if
(
!
srs_is_client_gracefully_close
(
ret
))
{
srs_error
(
"recv client control message failed. ret=%d"
,
ret
);
}
// we use no timeout to recv, should never got any error.
trd
->
stop_loop
();
return
ret
;
}
srs_verbose
(
"play loop recv message. ret=%d"
,
ret
);
return
ret
;
}
};
int
SrsRtmpConn
::
playing
(
SrsSource
*
source
)
{
int
ret
=
ERROR_SUCCESS
;
...
...
@@ -581,7 +512,7 @@ int SrsRtmpConn::playing(SrsSource* source)
// use isolate thread to recv,
// start isolate recv thread.
Isolate
RecvThread
trd
(
rtmp
);
Srs
RecvThread
trd
(
rtmp
);
if
((
ret
=
trd
.
start
())
!=
ERROR_SUCCESS
)
{
srs_error
(
"start isolate recv thread failed. ret=%d"
,
ret
);
return
ret
;
...
...
@@ -600,7 +531,7 @@ int SrsRtmpConn::playing(SrsSource* source)
return
ret
;
}
int
SrsRtmpConn
::
do_playing
(
SrsSource
*
source
,
Isolate
RecvThread
*
trd
)
int
SrsRtmpConn
::
do_playing
(
SrsSource
*
source
,
Srs
RecvThread
*
trd
)
{
int
ret
=
ERROR_SUCCESS
;
...
...
trunk/src/app/srs_app_rtmp_conn.hpp
查看文件 @
58136ec
...
...
@@ -49,7 +49,7 @@ class SrsBandwidth;
class
SrsKbps
;
class
SrsRtmpClient
;
class
SrsSharedPtrMessage
;
class
Isolate
RecvThread
;
class
Srs
RecvThread
;
/**
* the client provides the main logic control for RTMP clients.
...
...
@@ -89,7 +89,7 @@ private:
virtual
int
stream_service_cycle
();
virtual
int
check_vhost
();
virtual
int
playing
(
SrsSource
*
source
);
virtual
int
do_playing
(
SrsSource
*
source
,
Isolate
RecvThread
*
trd
);
virtual
int
do_playing
(
SrsSource
*
source
,
Srs
RecvThread
*
trd
);
virtual
int
fmle_publishing
(
SrsSource
*
source
);
virtual
int
do_fmle_publishing
(
SrsSource
*
source
);
virtual
int
flash_publishing
(
SrsSource
*
source
);
...
...
trunk/src/core/srs_core.hpp
查看文件 @
58136ec
...
...
@@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// current release version
#define VERSION_MAJOR 2
#define VERSION_MINOR 0
#define VERSION_REVISION
29
#define VERSION_REVISION
30
// server info.
#define RTMP_SIG_SRS_KEY "SRS"
#define RTMP_SIG_SRS_ROLE "origin/edge server"
...
...
trunk/src/srs/srs.upp
查看文件 @
58136ec
...
...
@@ -92,6 +92,8 @@ file
..\app\srs_app_kbps.cpp,
..\app\srs_app_log.hpp,
..\app\srs_app_log.cpp,
..\app\srs_app_recv_thread.hpp,
..\app\srs_app_recv_thread.cpp,
..\app\srs_app_refer.hpp,
..\app\srs_app_refer.cpp,
..\app\srs_app_reload.hpp,
...
...
请
注册
或
登录
后发表评论