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-18 15:38:34 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
b52a051d8086975c400cd36194360af756e045fb
b52a051d
1 parent
a0b74762
refine readme, confs
隐藏空白字符变更
内嵌
并排对比
正在显示
12 个修改的文件
包含
201 行增加
和
161 行删除
README.md
trunk/conf/demo.19350.conf
trunk/conf/demo.conf
trunk/conf/ffmpeg.conf
trunk/conf/forward.master.conf
trunk/conf/forward.slave.conf
trunk/conf/full.conf
trunk/conf/hls.conf
trunk/conf/realtime.conf
trunk/conf/rtmp.conf
trunk/conf/srs.conf
trunk/conf/transcode2hls.audio.only.conf
README.md
查看文件 @
b52a051
...
...
@@ -69,166 +69,6 @@ cd simple-rtmp-server/trunk
[
Usage: How to show the demo of SRS?
](
https://github.com/winlinvip/simple-rtmp-server/wiki/SampleDemo
)
<br/>
[
Usage: Who is using SRS?
](
https://github.com/winlinvip/simple-rtmp-server/wiki/Sample
)
<br/>
### Architecture
System Architecture:
<pre>
+------------------------------------------------------+
| SRS(Simple RTMP Server) |
+---------------+---------------+-----------+----------+
| API/hook | Transcoder | HLS | RTMP |
| http-parser | FFMPEG/x264 | NGINX/ts | protocol |
+---------------+---------------+-----------+----------+
| Network(state-threads) |
+------------------------------------------------------+
| All Linux(RHEL,CentOS,Ubuntu,Fedora...) |
+------------------------------------------------------+
</pre>
Modularity Architecture:
<pre>
+------------------------------------------------------+
| Main(srs/bandwidth/librtmp) |
+------------------------------------------------------+
| App(Server/Client application) |
+------------------------------------------------------+
| RTMP(Protocol stack) |
+------------------------------------------------------+
| Kernel(depends on Core, provides error/log) |
+------------------------------------------------------+
| Core(depends only on system apis) |
+------------------------------------------------------+
</pre>
Stream Architecture:
<pre>
+---------+ +----------+
+
Publish + + Deliver |
+---|-----+ +----|-----+
+------------------+-------------------------+----------------+
| Input | SRS(Simple RTMP Server) | Output |
+------------------+-------------------------+----------------+
| Encoder(1) | +-> RTMP protocol ----+-> Flash Player |
| (FMLE,FFMPEG, --+->-+-> HLS/NGINX --------+-> m3u8 player |
| Flash,XSPLIT, | +-> Fowarder ---------+-> RTMP Server |
| ......) | +-> Transcoder -------+-> RTMP Server |
| | +-> DVR --------------+-> FILE |
| | +-> BandwidthTest ----+-> Flash/StLoad |
+------------------+ | |
| MediaSource(2) | | |
| (RTSP,FILE, | | |
| HTTP,HLS, --+->-- Ingester -----------+-> SRS |
| Device, | | |
| ......) | | |
+------------------+-------------------------+----------------+
Remark:
(1) Encoder: encoder must push RTMP stream to SRS server.
(2) MediaSource: any media source, which can be ingest by ffmpeg.
</pre>
(plan) RTMP cluster(origin/edge) Architecture:
<br/>
Remark: cluster over forward, see
[
Cluster
](
https://github.com/winlinvip/simple-rtmp-server/wiki/Cluster
)
<pre>
+---------+ +-----------------+ +-----------------------+
+
Encoder +--+-->-+ SRS(RTMP Edge) +--->-+ (RTMP Origin) |
+---------+ | +-----------------+ | SRS/FMS/NGINX-RTMP |
| | Red5/HELIX/CRTMP |
+-------------------------->-+ ...... |
+-----------------------+
Schema#1: Any RTMP encoder push RTMP stream to RTMP (origin/edge)server,
where SRS RTMP Edge server will forward stream to origin.
+-------------+ +-----------------+ +--------------------+
| RTMP Origin +-->-+ SRS(RTMP Edge) +--+->-+ Client(RTMP/HLS) |
+-------------+ +-----------------+ | | Flash/IOS/Android |
| +--------------------+
|
| +-----------------+
+->-+ SRS(RTMP Edge) +
+-----------------+
Schema#2: SRS RTMP Edge server pull stream from origin (or upstream SRS
RTMP Edge server), then delivery to Client.
</pre>
(plan) SRS Multiple processes Architecture(design by wenjie):
<br/>
<pre>
+---------------+ +--------+
| upnode server | + client +
+-------+-------+ +---+----+
-------------+------------network-------+---------
| |
+--------+ +----+-----------+ +----+----------+
| master +--fork->-+ back source(1) +-->-pull-+ stream 1-N(2) +
+---+----+ +----------------+ +-------+-------+
| |
+-------------------------------------fork--->-----+
| +-------------+
+-------------------fork-->-+ http/vod(3) |
+-------------+
Remark:
(1) back source process: create by master process, get stream from
upnode server if edge, create stream if origin, serve the stream
process.
(2) stream process: create by master process, get stream from back
source process, serve the client.
(3) the embeded mininum http server, also provides vod service. for
http server, it provides http api, hls(live/vod) delivery. for
vod server, it slice the file to hls(m3u8/ts).
Remark:
(a) This multiple processes architecture is design by wenjie, it's a
very simple and powerful multiple process architecture, for the
master no need to pass between stream process.
(b) The CLI architecture is similar to this, instead, cli process
will collect informations from all stream process, master process
only send signals to child processes.
</pre>
CLI Architecture:
<pre>
+---------+
+--+ stream1 +---------+
| +---------+ |
+--------+ | +---------+ | +-------+
| master +--fork->-+--+ streamN +---amf0--+>--+ cli +
+--------+ | +---------+ | +-------+
| +-------------+ |
+--+ back source +-----+
+-------------+
Remark:
(1) master listen the global api port, for example, 33330
(2) back source and stream processes listen at private api port,
for example, 33331, 33332, 33333
(3) work processes(stream and back-source), report private api
port to master global api port.
(4) cli connect to master global api port, get all other private
api ports
(5) cli connect to each stream/back-source process to get api data,
cli analysis and summary the data, return to user.
</pre>
Bandwidth Test Workflow:
<pre>
+------------+ +----------+
| Client | | Server |
+-----+------+ +-----+----+
| |
| connect vhost-------------> |
|
<
-----------result(success) |
| |
|
<
----------call(start play) |
| result(playing)----------> |
|
<
-------------data(playing) |
|
<
-----------call(stop play) |
| result(stopped)----------> |
| |
|
<
-------call(start publish) |
| result(publishing)-------> |
| data(publishing)---------> |
|
<
--------call(stop publish) |
| result(stopped)(1)-------> |
| |
|
<
--------------------report |
| final(2)-----------------> |
|
<
END> |
@See: class SrsBandwidth comments.
</pre>
### System Requirements
Supported operating systems and hardware:
*
All Linux , both 32 and 64 bits
...
...
@@ -424,6 +264,166 @@ on_connect/close/publish/unpublish/play/stop.
*
v0.1, 2013-10-18, support rtmp message2chunk protocol(send
\_
message).
*
v0.1, 2013-10-17, support rtmp chunk2message protocol(recv
\_
message).
### Architecture
System Architecture:
<pre>
+------------------------------------------------------+
| SRS(Simple RTMP Server) |
+---------------+---------------+-----------+----------+
| API/hook | Transcoder | HLS | RTMP |
| http-parser | FFMPEG/x264 | NGINX/ts | protocol |
+---------------+---------------+-----------+----------+
| Network(state-threads) |
+------------------------------------------------------+
| All Linux(RHEL,CentOS,Ubuntu,Fedora...) |
+------------------------------------------------------+
</pre>
Modularity Architecture:
<pre>
+------------------------------------------------------+
| Main(srs/bandwidth/librtmp) |
+------------------------------------------------------+
| App(Server/Client application) |
+------------------------------------------------------+
| RTMP(Protocol stack) |
+------------------------------------------------------+
| Kernel(depends on Core, provides error/log) |
+------------------------------------------------------+
| Core(depends only on system apis) |
+------------------------------------------------------+
</pre>
Stream Architecture:
<pre>
+---------+ +----------+
+
Publish + + Deliver |
+---|-----+ +----|-----+
+------------------+-------------------------+----------------+
| Input | SRS(Simple RTMP Server) | Output |
+------------------+-------------------------+----------------+
| Encoder(1) | +-> RTMP protocol ----+-> Flash Player |
| (FMLE,FFMPEG, --+->-+-> HLS/NGINX --------+-> m3u8 player |
| Flash,XSPLIT, | +-> Fowarder ---------+-> RTMP Server |
| ......) | +-> Transcoder -------+-> RTMP Server |
| | +-> DVR --------------+-> FILE |
| | +-> BandwidthTest ----+-> Flash/StLoad |
+------------------+ | |
| MediaSource(2) | | |
| (RTSP,FILE, | | |
| HTTP,HLS, --+->-- Ingester -----------+-> SRS |
| Device, | | |
| ......) | | |
+------------------+-------------------------+----------------+
Remark:
(1) Encoder: encoder must push RTMP stream to SRS server.
(2) MediaSource: any media source, which can be ingest by ffmpeg.
</pre>
(plan) RTMP cluster(origin/edge) Architecture:
<br/>
Remark: cluster over forward, see
[
Cluster
](
https://github.com/winlinvip/simple-rtmp-server/wiki/Cluster
)
<pre>
+---------+ +-----------------+ +-----------------------+
+
Encoder +--+-->-+ SRS(RTMP Edge) +--->-+ (RTMP Origin) |
+---------+ | +-----------------+ | SRS/FMS/NGINX-RTMP |
| | Red5/HELIX/CRTMP |
+-------------------------->-+ ...... |
+-----------------------+
Schema#1: Any RTMP encoder push RTMP stream to RTMP (origin/edge)server,
where SRS RTMP Edge server will forward stream to origin.
+-------------+ +-----------------+ +--------------------+
| RTMP Origin +-->-+ SRS(RTMP Edge) +--+->-+ Client(RTMP/HLS) |
+-------------+ +-----------------+ | | Flash/IOS/Android |
| +--------------------+
|
| +-----------------+
+->-+ SRS(RTMP Edge) +
+-----------------+
Schema#2: SRS RTMP Edge server pull stream from origin (or upstream SRS
RTMP Edge server), then delivery to Client.
</pre>
(plan) SRS Multiple processes Architecture(design by wenjie):
<br/>
<pre>
+---------------+ +--------+
| upnode server | + client +
+-------+-------+ +---+----+
-------------+------------network-------+---------
| |
+--------+ +----+-----------+ +----+----------+
| master +--fork->-+ back source(1) +-->-pull-+ stream 1-N(2) +
+---+----+ +----------------+ +-------+-------+
| |
+-------------------------------------fork--->-----+
| +-------------+
+-------------------fork-->-+ http/vod(3) |
+-------------+
Remark:
(1) back source process: create by master process, get stream from
upnode server if edge, create stream if origin, serve the stream
process.
(2) stream process: create by master process, get stream from back
source process, serve the client.
(3) the embeded mininum http server, also provides vod service. for
http server, it provides http api, hls(live/vod) delivery. for
vod server, it slice the file to hls(m3u8/ts).
Remark:
(a) This multiple processes architecture is design by wenjie, it's a
very simple and powerful multiple process architecture, for the
master no need to pass between stream process.
(b) The CLI architecture is similar to this, instead, cli process
will collect informations from all stream process, master process
only send signals to child processes.
</pre>
CLI Architecture:
<pre>
+---------+
+--+ stream1 +---------+
| +---------+ |
+--------+ | +---------+ | +-------+
| master +--fork->-+--+ streamN +---amf0--+>--+ cli +
+--------+ | +---------+ | +-------+
| +-------------+ |
+--+ back source +-----+
+-------------+
Remark:
(1) master listen the global api port, for example, 33330
(2) back source and stream processes listen at private api port,
for example, 33331, 33332, 33333
(3) work processes(stream and back-source), report private api
port to master global api port.
(4) cli connect to master global api port, get all other private
api ports
(5) cli connect to each stream/back-source process to get api data,
cli analysis and summary the data, return to user.
</pre>
Bandwidth Test Workflow:
<pre>
+------------+ +----------+
| Client | | Server |
+-----+------+ +-----+----+
| |
| connect vhost-------------> |
|
<
-----------result(success) |
| |
|
<
----------call(start play) |
| result(playing)----------> |
|
<
-------------data(playing) |
|
<
-----------call(stop play) |
| result(stopped)----------> |
| |
|
<
-------call(start publish) |
| result(publishing)-------> |
| data(publishing)---------> |
|
<
--------call(stop publish) |
| result(stopped)(1)-------> |
| |
|
<
--------------------report |
| final(2)-----------------> |
|
<
END> |
@See: class SrsBandwidth comments.
</pre>
Beijing, 2013
<br/>
Winlin
...
...
trunk/conf/demo.19350.conf
查看文件 @
b52a051
# the config for srs demo
# @see https://github.com/winlinvip/simple-rtmp-server/wiki/SampleDemo
# @see full.conf for detail config.
listen
19350
;
chunk_size
65000
;
vhost
__
defaultVhost__
{
...
...
trunk/conf/demo.conf
查看文件 @
b52a051
# the config for srs demo
# @see https://github.com/winlinvip/simple-rtmp-server/wiki/SampleDemo
# @see full.conf for detail config.
listen
1935
;
chunk_size
60000
;
log_dir
./
objs
/
logs
;
...
...
trunk/conf/ffmpeg.conf
查看文件 @
b52a051
# the config for srs use ffmpeg to transcode
# @see https://github.com/winlinvip/simple-rtmp-server/wiki/SampleFFMPEG
# @see full.conf for detail config.
listen
1935
;
vhost
__
defaultVhost__
{
transcode
{
...
...
trunk/conf/forward.master.conf
查看文件 @
b52a051
# the config for srs to forward
# @see https://github.com/winlinvip/simple-rtmp-server/wiki/SampleForward
# @see full.conf for detail config.
listen
1935
;
vhost
__
defaultVhost__
{
forward
127
.
0
.
0
.
1
:
19350
;
...
...
trunk/conf/forward.slave.conf
查看文件 @
b52a051
# the config for srs to forward
# @see https://github.com/winlinvip/simple-rtmp-server/wiki/SampleForward
# @see full.conf for detail config.
listen
19350
;
vhost
__
defaultVhost__
{
}
...
...
trunk/conf/full.conf
查看文件 @
b52a051
# all config for srs
# the listen ports, split by space.
listen
1935
;
# the default chunk size is 128, max is 65536,
...
...
trunk/conf/hls.conf
查看文件 @
b52a051
# the config for srs to delivery hls
# @see https://github.com/winlinvip/simple-rtmp-server/wiki/SampleHLS
# @see full.conf for detail config.
listen
1935
;
vhost
__
defaultVhost__
{
hls
{
...
...
trunk/conf/realtime.conf
查看文件 @
b52a051
# the config for srs to delivery realtime RTMP stream
# @see https://github.com/winlinvip/simple-rtmp-server/wiki/SampleRealtime
# @see full.conf for detail config.
listen
1935
;
vhost
__
defaultVhost__
{
gop_cache
off
;
...
...
trunk/conf/rtmp.conf
查看文件 @
b52a051
# the config for srs to delivery RTMP
# @see https://github.com/winlinvip/simple-rtmp-server/wiki/SampleRTMP
# @see full.conf for detail config.
listen
1935
;
vhost
__
defaultVhost__
{
}
...
...
trunk/conf/srs.conf
查看文件 @
b52a051
# main config for srs.
# @see full.conf for detail config.
listen
1935
;
# see full.conf for each config.
vhost
__
defaultVhost__
{
}
...
...
trunk/conf/transcode2hls.audio.only.conf
查看文件 @
b52a051
# the config for srs to delivery hls
# @see https://github.com/winlinvip/simple-rtmp-server/wiki/SampleHLS
# @see full.conf for detail config.
listen
1935
;
vhost
__
defaultVhost__
{
hls
{
...
...
请
注册
或
登录
后发表评论