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:
-+---------+ +-----------------+ +-----------------------+ -+ 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:
++---------+ +-----------------+ +-----------------------+ ++ 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