From b52a051d8086975c400cd36194360af756e045fb Mon Sep 17 00:00:00 2001 From: winlin Date: Tue, 18 Mar 2014 15:38:34 +0800 Subject: [PATCH] refine readme, confs --- README.md | 320 +++++++++++------------ trunk/conf/demo.19350.conf | 4 + trunk/conf/demo.conf | 4 + trunk/conf/ffmpeg.conf | 4 + trunk/conf/forward.master.conf | 4 + trunk/conf/forward.slave.conf | 4 + trunk/conf/full.conf | 2 + trunk/conf/hls.conf | 4 + trunk/conf/realtime.conf | 4 + trunk/conf/rtmp.conf | 4 + trunk/conf/srs.conf | 4 +- trunk/conf/transcode2hls.audio.only.conf | 4 + 12 files changed, 201 insertions(+), 161 deletions(-) diff --git a/README.md b/README.md index e469d455a..6c394b3d4 100755 --- a/README.md +++ b/README.md @@ -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)
[Usage: Who is using SRS?](https://github.com/winlinvip/simple-rtmp-server/wiki/Sample)
-### Architecture -System Architecture: -
-+------------------------------------------------------+
-|             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...)         |
-+------------------------------------------------------+
-
-Modularity Architecture: -
-+------------------------------------------------------+
-|             Main(srs/bandwidth/librtmp)              |
-+------------------------------------------------------+
-|           App(Server/Client application)             |
-+------------------------------------------------------+
-|               RTMP(Protocol stack)                   |
-+------------------------------------------------------+
-|      Kernel(depends on Core, provides error/log)     |
-+------------------------------------------------------+
-|         Core(depends only on system apis)            |
-+------------------------------------------------------+
-
-Stream Architecture: -
-               +---------+              +----------+
-               + 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.
-
-(plan) RTMP cluster(origin/edge) Architecture:
-Remark: cluster over forward, see [Cluster](https://github.com/winlinvip/simple-rtmp-server/wiki/Cluster) -
-+---------+       +-----------------+     +-----------------------+ 
-+ 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.
-
-(plan) SRS Multiple processes Architecture(design by wenjie):
-
-                 +---------------+              +--------+
-                 | 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.
-
-CLI Architecture: -
-                       +---------+
-                    +--+ 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.
-
-Bandwidth Test Workflow: -
-   +------------+                    +----------+
-   |  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.
-
- ### 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: +
++------------------------------------------------------+
+|             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...)         |
++------------------------------------------------------+
+
+Modularity Architecture: +
++------------------------------------------------------+
+|             Main(srs/bandwidth/librtmp)              |
++------------------------------------------------------+
+|           App(Server/Client application)             |
++------------------------------------------------------+
+|               RTMP(Protocol stack)                   |
++------------------------------------------------------+
+|      Kernel(depends on Core, provides error/log)     |
++------------------------------------------------------+
+|         Core(depends only on system apis)            |
++------------------------------------------------------+
+
+Stream Architecture: +
+               +---------+              +----------+
+               + 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.
+
+(plan) RTMP cluster(origin/edge) Architecture:
+Remark: cluster over forward, see [Cluster](https://github.com/winlinvip/simple-rtmp-server/wiki/Cluster) +
++---------+       +-----------------+     +-----------------------+ 
++ 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.
+
+(plan) SRS Multiple processes Architecture(design by wenjie):
+
+                 +---------------+              +--------+
+                 | 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.
+
+CLI Architecture: +
+                       +---------+
+                    +--+ 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.
+
+Bandwidth Test Workflow: +
+   +------------+                    +----------+
+   |  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.
+
+ Beijing, 2013
Winlin diff --git a/trunk/conf/demo.19350.conf b/trunk/conf/demo.19350.conf index 13d32fbba..9a898fbef 100644 --- a/trunk/conf/demo.19350.conf +++ b/trunk/conf/demo.19350.conf @@ -1,3 +1,7 @@ +# 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__ { diff --git a/trunk/conf/demo.conf b/trunk/conf/demo.conf index d02491ae3..b3c21a9af 100644 --- a/trunk/conf/demo.conf +++ b/trunk/conf/demo.conf @@ -1,3 +1,7 @@ +# 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; diff --git a/trunk/conf/ffmpeg.conf b/trunk/conf/ffmpeg.conf index a9f4fd429..789dcd0aa 100644 --- a/trunk/conf/ffmpeg.conf +++ b/trunk/conf/ffmpeg.conf @@ -1,3 +1,7 @@ +# 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 { diff --git a/trunk/conf/forward.master.conf b/trunk/conf/forward.master.conf index 92b96ccda..2c88282e5 100644 --- a/trunk/conf/forward.master.conf +++ b/trunk/conf/forward.master.conf @@ -1,3 +1,7 @@ +# 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; diff --git a/trunk/conf/forward.slave.conf b/trunk/conf/forward.slave.conf index 1e225ad65..6ccc9a159 100644 --- a/trunk/conf/forward.slave.conf +++ b/trunk/conf/forward.slave.conf @@ -1,3 +1,7 @@ +# 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__ { } diff --git a/trunk/conf/full.conf b/trunk/conf/full.conf index daf2d2fe6..dbd22386f 100644 --- a/trunk/conf/full.conf +++ b/trunk/conf/full.conf @@ -1,3 +1,5 @@ +# all config for srs + # the listen ports, split by space. listen 1935; # the default chunk size is 128, max is 65536, diff --git a/trunk/conf/hls.conf b/trunk/conf/hls.conf index c2fc819ce..397918b81 100644 --- a/trunk/conf/hls.conf +++ b/trunk/conf/hls.conf @@ -1,3 +1,7 @@ +# 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 { diff --git a/trunk/conf/realtime.conf b/trunk/conf/realtime.conf index fc99750d2..55d4e4b60 100644 --- a/trunk/conf/realtime.conf +++ b/trunk/conf/realtime.conf @@ -1,3 +1,7 @@ +# 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; diff --git a/trunk/conf/rtmp.conf b/trunk/conf/rtmp.conf index 7d97f914c..76dbfec00 100644 --- a/trunk/conf/rtmp.conf +++ b/trunk/conf/rtmp.conf @@ -1,3 +1,7 @@ +# 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__ { } diff --git a/trunk/conf/srs.conf b/trunk/conf/srs.conf index 7a1ba7e0f..0e4140af3 100644 --- a/trunk/conf/srs.conf +++ b/trunk/conf/srs.conf @@ -1,4 +1,6 @@ +# main config for srs. +# @see full.conf for detail config. + listen 1935; -# see full.conf for each config. vhost __defaultVhost__ { } diff --git a/trunk/conf/transcode2hls.audio.only.conf b/trunk/conf/transcode2hls.audio.only.conf index 6d13a5fa6..8e24cbff8 100644 --- a/trunk/conf/transcode2hls.audio.only.conf +++ b/trunk/conf/transcode2hls.audio.only.conf @@ -1,3 +1,7 @@ +# 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 {