crtmpserver的架构简介
一、层 Layers
. 机器层 Machine layer
. 操作系统层 Operating System Layer
This layer is composed of libraries with functions that make the entire Evostream ecosystem
compatible to any Operating System. OS-specific functions used in the whole solution are made
transparent to current Operating System, avoiding any unexpected errors in compiling and
running the system. With this layer, Evostream can compile and run on Linux, Windows, Mac,
Solaris, and other Operating Systems.
这一层是由库函数组成,使整个Evostream生态系统兼容任何操作系统。
对于当前的操作系统来说,用于整个解决方案中的特定的操作系统函数是透明的,
这样就能避免在编译和运行的意外错误。
有了这一层,Evostream可以编译和运行在Linux, Windows, Mac, Solaris 和其它OS上。
. 网络层 Networking layer
This layer takes care of transporting the data in and out of the server.
This layer has the Input/Output Handlers that handles the transfer of data.
The network layer implements either of the 3 socket reactors depending on the Operating System:
这一层负责服务器的数据输入和输出;
它有输入/输出句柄,用来处理数据的传输;
依据操作系统的不同,网络层有三种不同的socket交互方式
kqueue - BSD based OS
epoll - Linux based OS
select - win32 based OS
. 组件层 The components layer
二、组件 Components
1. 公用程序 Utilities
. 缓存 Buffering
. 日志 Logging
. Lua
. 内存池 Mempool
. Misc
. Tinyxml
2. 输出模块 Netio
. kqueue
. epoll
. select
3. 协议 Protocols
These are communication protocols that are interconnected with each other to form a specific
way of handling the transfer of data in and out of the server. There are Transport protocols
and Endpoint protocols. Transport protocols are those that are used to transfer data further,
and all protocol stack must end with an Endpoint protocol. Example is RTMPS with this order
of protocols in the stack: [outside_world] ←→ SSL ←→ HTTP ←→ RTMP, where SSL and HTTP
are Transport protocols and RTMP is the Endpoint protocol. There should never be another protocol
on top of the Endpoint protocol.
通信协议用来和服务器外部以特定的方式处理数据的传输;
这些协议分成传输协议和终端协议;
传输协议用来传输数据,而且,所有的协议栈必须以终端协议结束。
例如: RTMPS的协议栈的顺序为:
[outside_world] ←→ SSL ←→ HTTP ←→ RTMP.
其中,
SSL和HTTP是传输协议;
RTMP是终端协议;
且在终端协议之上不能再有任何其它协议;
Within a protocol stack are Near and Far protocols, each indicating its distance from the server.
Near means a protocol that is on the right of a protocol in a stack (means the one closer to the
server), whereas Far means the one on the left.
In the example protocol stack RTMPS - [outside_world] ←→ SSL ←→ HTTP ←→ RTMP ,
SSL is the Far protocol of HTTP, and RTMP is its Near protocol of HTTP.
The protocol that is nearest to the server is the Near-endpoint (RTMP in this case),
and the one closest to the outside world is the Far-enpoint (SSL in this case).
协议栈中的协议的远近,指示了它到服务器的距离;
近,意味着在协议在栈的右边(意即靠近服务器), 远,则在左边;
在RTMPS协议栈的例子中:
[outside_world] ←→ SSL ←→ HTTP ←→ RTMP
SSL比HTTP远,RTMP比HTTP近,
和服务器端最近的是RTMP协议,和外部世界最近的是SSL;
. Base Protocol
The BaseProtocol class is the base class on which all protocols derive from.
BaseProtocol类是基类,所有协议都是源自于它;
. Base Protocol Factory
The BaseProtocolFactory class in the base class on which all protocol factory derive from.
BaseProtocolFactory类是基类,所有的协议库都源自于它;
. Protocol Factory
Evostream has a “bank” of protocols and protocol stacks that are all available applications to use.
A BaseProtocolFactory class is used as a base class of all protocol factories.
Atomic protocols are declared and protocol chains are spawned in the factory.
Resources from the factory will then be exported for use by the applications.
Evostream有一个协议库,所有有效应用的协议栈都可以使用它;
BaseProtocolFactory类作为所有协议库的基类;
原子协议和协议链都在这个库中声明和产生;
库中的资源都将输出给应用使用;
. 协议管理 Protocol Manager
4. 应用和协议句柄 Applications and protocol handlers
5. 流 Streaming
6. 媒体格式 Media formats
. flv
. mkv
. mp3
. mp4
阅读(3497) | 评论(0) | 转发(1) |