Clone
13
v3_EN_Dev_HttpServer
winlin edited this page 2022-01-06 11:57:15 +08:00
This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

HOME > EN > HTTP Server

HttpServer

本文描述了SRS的HTTP模块的结构和原理侧重介绍了如何使用和定制SRS的HTTP模块。

HTTP Arch

本节介绍了SRS的HTTP涉及的主要结构类和函数以及启动的流程连接处理的流程HTTP请求的解析和处理过程。

HTTP Stream Arch

本节介绍了SRS的HTTP Stream涉及的主要结构类和函数HTTP的hijack动态mount。

Example

本节以一个实例介绍如何在SRS基础上新增一个HTTP服务这个服务侦听端口9000将服务器的__defaultVhost__/live/livestream的流,分发给所有客户端(VLC)流格式是HTTP FLV和TS。

服务器配置实例没有新增配置都是写死的譬如端口9000实时转的流地址流的封装

listen              1935;
max_connections     1000;
daemon              off;
srs_log_tank        console;
vhost __defaultVhost__ {
}

譬如,推流到服务器:

ffmpeg -re -i doc/source.*.flv -c copy -f flv -y rtmp://127.0.0.1/live/livestream

客户端VLC可以播放下面两个流(播放地址是固定的stream.flv和stream.ts)

http://server:9000/stream.flv
http://server:9000/stream.ts

FlyBird, 2015.8