Merge branch 'srs.master'

pull/133/head
winlin 10 years ago
commit 610c36eaeb

26
.gitignore vendored

@ -0,0 +1,26 @@
# Compiled Object files
*.slo
*.lo
*.o
# Compiled Dynamic libraries
*.so
*.dylib
# Compiled Static libraries
*.lai
*.la
*.a
# by winlin
*.pyc
*.swp
/trunk/Makefile
/trunk/objs
/trunk/research/librtmp/objs
/trunk/3rdparty/ccache/ccache-3.1.9
/trunk/3rdparty/gprof/graphviz-2.36.0
/trunk/research/api-server/static-dir/crossdomain.xml
/trunk/research/api-server/static-dir/forward
/trunk/research/api-server/static-dir/live
/trunk/research/api-server/static-dir/players

@ -0,0 +1,14 @@
Authors ordered by first contribution.
* winlin<winlin@vip.126.com>
* wenjie.zhao<740936897@qq.com>
* xiangcheng.liu<liuxc0116@foxmail.com>
* naijia.liu<youngcow@youngcow.net>
* alcoholyi<alcoholyi@qq.com>
* byteman<wangchen2011@gmail.com>
* chad.wang<chad.wang.cn@gmail.com>
* suhetao<suhetao@gmail.com>
* Johnny<fengjihu@163.com>
* karthikeyan<keyanmca@gmail.com>
* StevenLiu<lq@chinaffmpeg.org>
* zhengfl<zhengfl_1989@126.com>

@ -0,0 +1,17 @@
Donations ordered by first donation.
* [2014-04-25 13:21] 刘连响 刘连响(492827340)
* [2014-04-25 13:25] 张瑞圣 大圣(5839109)
* [2014-04-25 13:31] 郭强 寒一冰(63395865)
* [2014-05-12 10:22] 陈晨 陈晨(undeadalpha@gmail.com)
* [2014-06-17 17:57] 陈江兵 将兵(176340267)
* [2014-07-24 08:52] 黄英才 贝奇小天狼星(303441547)
* [2014-07-30 11:29] 周凯 子陵(93632886)
* [2014-08-04 10:47] 宋志 胖胖(37210101)
* [2014-08-07 22:56] 陈亮 陈亮
* [2014-08-15 10:55] 雷健 万山奔一溪(76411408)
* [2014-08-15 13:31] ZACH ZACH(18601653557)
* [2014-08-19 20:00] Matthew Matthew(1206651693)
* [2014-08-20 20:13] 林瑞潮 甲子(459505921)
* [2014-09-05 16:13] 于冰 秋雨☆ice(3373749)

@ -0,0 +1,20 @@
The MIT License (MIT)
Copyright (c) 2013-2014 winlin
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

@ -0,0 +1,633 @@
#Simple-RTMP-Server
SRS is industrial-strength live streaming cluster,
for the best conceptual integrity and the simplest implementation,
which delivering rtmp/hls/http live on x86/x64/arm/mips linux,
supports origin/edge/vhost and transcode/ingest and dvr/forward
and http-api/http-callback/reload, with wiki and the most
simple architecture.
Download from github.io:
[Centos6-x86_64](http://winlinvip.github.io/srs.release/releases/files/SRS-CentOS6-x86_64-1.0.0.zip)
[more...](http://winlinvip.github.io/srs.release/releases/)
Download from ossrs.net:
[Centos6-x86_64](http://www.ossrs.net/srs.release/releases/files/SRS-CentOS6-x86_64-1.0.0.zip)
[more...](http://www.ossrs.net/srs.release/releases/)
## About
SRS(SIMPLE RTMP Server) over state-threads created in 2013.10.
SRS focus on small problem domain, which is the most complex for all software(see OOAD).
Because of lack of deveoper resource, SRS only provides features which is the most popular
for internet. SRS is simple for and only for problem domain is simplified.
SRS is a simple, [RTMP](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_DeliveryRTMP)/
[HLS](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_DeliveryHLS),
[high-performance](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_Performance),
single/multiple(plan) processes, edge/origin live server,
[x86/x64/arm](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_SrsLinuxArm),
compile depends on [st](http://sourceforge.net/projects/state-threads)(required),
[ssl](http://www.openssl.org/) and [http-parser](https://github.com/joyent/http-parser),
use [nginx](http://nginx.org/), [ffmpeg](http://ffmpeg.org/) and
[cherrypy](http://www.cherrypy.org/) as external tools. that is, only need st to run srs for
minimum run. see [Build](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_Build).
SRS supports [vhost](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_RtmpUrlVhost),
rtmp([encoder push](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_DeliveryRTMP),
client/[edge](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_Edge) pull),
[ingester(srs pull)](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_Ingest),
[HLS](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_DeliveryHLS),
[HLS audio only](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_DeliveryHLS#hlsaudioonly),
[transcoding](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_FFMPEG),
[forward](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_FFMPEG),
[http hooks](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_HTTPCallback),
[http api](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_HTTPApi),
[http server](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_HTTPServer),
[dvr](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_DVR).
WebSite: [http://ossrs.net](http://ossrs.net) <br/>
Release: [http://winlinvip.github.io/srs.release](http://winlinvip.github.io/srs.release) <br/>
Blog: [http://blog.csdn.net/win_lin](http://blog.csdn.net/win_lin) <br/>
CSDN mirror: [https://code.csdn.net/winlinvip/srs-csdn](https://code.csdn.net/winlinvip/srs-csdn) <br/>
See also: [https://github.com/winlinvip/simple-rtmp-server](https://github.com/winlinvip/simple-rtmp-server) <br/>
Github DEMO: [demo with your SRS](http://winlinvip.github.io/srs.release/trunk/research/players/srs_player.html?server=192.168.1.170&vhost=192.168.1.170) <br/>
Wiki: [https://github.com/winlinvip/simple-rtmp-server/wiki](https://github.com/winlinvip/simple-rtmp-server/wiki) <br/>
StreamServers[BLS](https://github.com/wenjiegit/Bull-Live-Server)/[BLE](https://github.com/wenjiegit/Bull-Live-Encoder),
[NGINX-RTMP](https://github.com/arut/nginx-rtmp-module), [CRTMPD](http://www.rtmpd.com/),
[RED5](http://www.red5.org/), [WOWZA](http://www.wowza.com/),
[FMS/AMS](http://www.adobe.com/products/adobe-media-server-standard.html)
## AUTHORS
The PRIMARY AUTHORS are (and/or have been)(Authors ordered by first contribution):
* winlin([winterserver](#)): [http://blog.csdn.net/win_lin](http://blog.csdn.net/win_lin)
* wenjie([wenjiegit](https://github.com/wenjiegit/simple-rtmp-server)): [http://blog.chinaunix.net/uid/25006789.html](http://blog.chinaunix.net/uid/25006789.html)
About the primary AUTHORS:
* Contribute important features to SRS.
* Names of all PRIMARY AUTHORS response in NetConnection.connect and metadata.
* Names of all CONTRIBUTORS response in api/v1/authors.
And here is an inevitably incomplete list of MUCH-APPRECIATED CONTRIBUTORS --
people who have submitted patches, reported bugs, added translations, helped
answer newbie questions, and generally made SRS that much better:
[AUTHORS.txt](https://github.com/winlinvip/simple-rtmp-server/blob/master/AUTHORS.txt)
A big THANK YOU goes to:
* [chnvideo](chnvideo.com) co-founders([wiseyoung](mailto:wiseyoung@chnvideo.com), [trueice](mailto:trueice@chnvideo.com), [leijian](mailto:leijian@chnvideo.com)) for [big supports](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_Product#bigthanks).
* Genes amd Mabbott for creating [st](https://github.com/winlinvip/state-threads)([state-threads](http://sourceforge.net/projects/state-threads/)).
* Michael Talyanksy for introducing us to use st.
* Roman Arutyunyan for creating [nginx-rtmp](https://github.com/arut/nginx-rtmp-module) for SRS to refer to.
* Joyent for creating [http-parser](https://github.com/joyent/http-parser) for http-api for SRS.
* Igor Sysoev for creating [nginx](http://nginx.org/) for SRS to refer to.
* [FFMPEG](http://ffmpeg.org/) and [libx264](http://www.videolan.org/) group for SRS to use to transcode.
* Guido van Rossum for creating Python for api-server for SRS.
## Usage
<strong>Step 1:</strong> get SRS
<pre>
git clone https://github.com/winlinvip/simple-rtmp-server &&
cd simple-rtmp-server/trunk
</pre>
<strong>Step 2:</strong> build SRS,
<strong>Requires Centos6.x/Ubuntu12 32/64bits, others see [Build](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_Build)</strong>
<pre>
./configure && make
</pre>
<strong>Step 3:</strong> start SRS
<pre>
./objs/srs -c conf/srs.conf
</pre>
<strong>See also:</strong>
* [Usage: How to delivery RTMP?](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_SampleRTMP)
* [Usage: How to delivery HLS?](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_SampleHLS)
* [Usage: How to delivery HLS for other codec?](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_SampleTranscode2HLS)
* [Usage: How to transode RTMP stream by SRS?](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_SampleFFMPEG)
* [Usage: How to forward stream to other server?](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_SampleForward)
* [Usage: How to deploy low lantency application?](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_SampleRealtime)
* [Usage: How to deploy SRS on ARM?](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_SampleARM)
* [Usage: How to ingest file/stream/device to SRS?](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_SampleIngest)
* [Usage: How to use SRS-HTTP-server to delivery HTTP/HLS stream?](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_SampleHTTP)
* [Usage: How to show the demo of SRS?](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_SampleDemo)
* [Usage: Solution using SRS?](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_Sample)
* [Usage: Why SRS?](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_Product)
## Wiki
Please select your language:
* [English](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_EN__Home)
* [Chinese](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_Home)
## Donation
Donation:<br/>
[http://winlinvip.github.io/srs.release/donation/index.html](http://winlinvip.github.io/srs.release/donation/index.html) OR <br/>
[http://www.ossrs.net/srs.release/donation/index.html](http://www.ossrs.net/srs.release/donation/index.html)
Donations:<br/>
[https://github.com/winlinvip/simple-rtmp-server/blob/master/DONATIONS.txt](https://github.com/winlinvip/simple-rtmp-server/blob/master/DONATIONS.txt)
## Mirrors
Github: [https://github.com/winlinvip/simple-rtmp-server](https://github.com/winlinvip/simple-rtmp-server)
[Git Usage](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_Git)
```bash
git clone https://github.com/winlinvip/simple-rtmp-server.git
```
CSDN: [https://code.csdn.net/winlinvip/srs-csdn](https://code.csdn.net/winlinvip/srs-csdn)
[Git Usage](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_Git)
```bash
git clone https://code.csdn.net/winlinvip/srs-csdn.git
```
## System Requirements
Supported operating systems and hardware:
* All Linux , both 32 and 64 bits
* All hardware.
## Summary
1. Simple, also stable enough.
1. [High-performance](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_Performance): single-thread, async socket, event/st-thread driven.
1. [High-concurrency](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_Performance), 1800 connections(500kbps), 900Mbps, CPU 90.2%, 41MB
1. Support [RTMP Origin Server](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_DeliveryRTMP).
1. Support [RTMP Edge Server](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_Edge) for CDN, push/pull stream from any RTMP server
1. Support single process; no multiple processes.
1. Support [Vhost](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_RtmpUrlVhost), support \_\_defaultVhost\_\_.
1. Support [RTMP](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_DeliveryRTMP) live streaming; no vod streaming.
1. Support Apple [HLS(m3u8)](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_DeliveryHLS) live streaming.
1. Support [HLS audio-only](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_DeliveryHLS#hlsaudioonly) live streaming.
1. Support [Reload](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_Reload) config to enable changes.
1. Support [cache last gop](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_LowLatency#gop-cache) for flash player to fast startup.
1. Support listen at multiple ports.
1. Support long time(>4.6hours) publish/play.
1. Support [Forward](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_Forward) in master-slave mode.
1. Support live stream [Transcoding](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_FFMPEG) by ffmpeg.
1. Support [ffmpeg](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_FFMPEG) filters(logo/overlay/crop), x264 params, copy/vn/an.
1. Support audio [transcode](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_FFMPEG) only, speex/mp3 to aac
1. Support [http callback api hooks](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_HTTPCallback)(for authentication and injection).
1. Support [bandwidth test](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_BandwidthTestTool) api and flash client.
1. Player, publisher(encoder), and [demo pages(jquery+bootstrap)](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_SampleDemo).
1. [Demo](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_SampleDemo) video meeting or chat(SRS+cherrypy+jquery+bootstrap).
1. Full documents in [wiki](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_Home), in Chineses.
1. Support RTMP(play-publish) library: [srs-librtmp](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_SrsLibrtmp)
1. Support ARM([debian armhf, v7cpu](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_SrsLinuxArm)) with rtmp/ssl/hls/librtmp.
1. Support [init.d](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_LinuxService) and packge script, log to file.
1. Support [RTMP ATC](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_RTMP-ATC) for HLS/HDS to support backup(failover)
1. Support [HTTP RESTful management api](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_HTTPApi).
1. Support [Ingest](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_Ingest) FILE/HTTP/RTMP/RTSP(RTP, SDP) to RTMP using external tools(e.g ffmepg).
1. Support [DVR](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_DVR), record live to flv file for vod.
1. Support [tracable log, session based log](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_SrsLog).
1. Support DRM [token traverse](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_DRM#tokentraverse) for fms origin authenticate.
1. Support system full utest on gtest.
1. [experiment] Support embeded [HTTP server](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_SampleHTTP) for hls(live/vod)
1. [experiment] Support [vod stream(http flv/hls vod stream)](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_FlvVodStream).
1. [dev] Suppport [English wiki](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_v1_ENHome).
1. [dev] Research and simplify st, [bug #182](https://github.com/winlinvip/simple-rtmp-server/issues/182).
1. [no-plan] Support <500ms latency, FRSC(Fast RTMP-compatible Stream Channel tech).
1. [no-plan] Support RTMP 302 redirect [#92](https://github.com/winlinvip/simple-rtmp-server/issues/92).
1. [no-plan] Support multiple processes, for both origin and edge
1. [no-plan] Support adobe RTMFP(flash p2p) protocol.
1. [no-plan] Support adobe flash refer/token/swf verification.
1. [no-plan] Support adobe amf3 codec.
1. [no-plan] Support encryption: RTMPE/RTMPS, HLS DRM
1. [no-plan] Support RTMPT, http to tranverse firewalls
1. [no-plan] Support file source, transcoding file to live stream
1. [no-plan] Support RTP/RTSP server.
## Releases
* 2014-10-09, [Release v1.0-beta](https://github.com/winlinvip/simple-rtmp-server/releases/tag/1.0.beta), all bug fixed, 1.0.0, 59316 lines.<br/>
* 2014-04-07, [Release v1.0-mainline](https://github.com/winlinvip/simple-rtmp-server/releases/tag/1.0.mainline), support [arm](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_SrsLinuxArm), [init.d](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_LinuxService), http [server](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_HTTPServer)/[api](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_HTTPApi), [ingest](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_SampleIngest). 30000 lines.<br/>
* 2013-12-25, [Release v0.9](https://github.com/winlinvip/simple-rtmp-server/releases/tag/0.9), support bandwidth test, player/encoder/chat [demos](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_SampleDemo). 20926 lines.<br/>
* 2013-12-08, [Release v0.8](https://github.com/winlinvip/simple-rtmp-server/releases/tag/0.8), support [http hooks callback](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_HTTPCallback), update [st_load](https://github.com/winlinvip/st-load). 19186 lines.<br/>
* 2013-12-03, [Release v0.7](https://github.com/winlinvip/simple-rtmp-server/releases/tag/0.7), support [live stream transcoding](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_FFMPEG). 17605 lines.<br/>
* 2013-11-29, [Release v0.6](https://github.com/winlinvip/simple-rtmp-server/releases/tag/0.6), support [forward](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_Forward) stream to origin/edge. 16094 lines.<br/>
* 2013-11-26, [Release v0.5](https://github.com/winlinvip/simple-rtmp-server/releases/tag/0.5), support [HLS(m3u8)](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_DeliveryHLS), fragment and window. 14449 lines.<br/>
* 2013-11-10, [Release v0.4](https://github.com/winlinvip/simple-rtmp-server/releases/tag/0.4), support [reload](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_Reload) config, pause, longtime publish/play. 12500 lines.<br/>
* 2013-11-04, [Release v0.3](https://github.com/winlinvip/simple-rtmp-server/releases/tag/0.3), support [vhost](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_RtmpUrlVhost), refer, gop cache, listen multiple ports. 11773 lines.<br/>
* 2013-10-25, [Release v0.2](https://github.com/winlinvip/simple-rtmp-server/releases/tag/0.2), support [rtmp](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_RTMPHandshake) flash publish, h264, time jitter correct. 10125 lines.<br/>
* 2013-10-23, [Release v0.1](https://github.com/winlinvip/simple-rtmp-server/releases/tag/0.1), support [rtmp FMLE/FFMPEG publish](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_DeliveryRTMP), vp6. 8287 lines.<br/>
* 2013-10-17, Created.<br/>
## History
* v2.0, 2014-10-25, fix [#185](https://github.com/winlinvip/simple-rtmp-server/issues/185), AMF0 support 0x0B the date type codec. 2.0.7.
* v2.0, 2014-10-24, fix [#186](https://github.com/winlinvip/simple-rtmp-server/issues/186), hotfix for bug #186, drop connect args when not object. 2.0.6.
* v2.0, 2014-10-24, rename wiki/xxx to wiki/v1_CN_xxx. 2.0.3.
* v2.0, 2014-10-19, fix [#184](https://github.com/winlinvip/simple-rtmp-server/issues/184), support AnnexB in RTMP body for HLS. 2.0.2
* v2.0, 2014-10-18, remove supports for OSX(darwin). 2.0.1.
* v2.0, 2014-10-16, revert github srs README to English. 2.0.0.
* <strong>v1.0, 2014-10-09, [1.0 beta(1.0.0)](https://github.com/winlinvip/simple-rtmp-server/releases/tag/1.0.beta) released. 59316 lines.</strong>
* v1.0, 2014-10-08, fix [#151](https://github.com/winlinvip/simple-rtmp-server/issues/151), always reap ts whatever audio or video packet. 0.9.223.
* v1.0, 2014-10-08, fix [#162](https://github.com/winlinvip/simple-rtmp-server/issues/162), failed if no epoll. 0.9.222.
* v1.0, 2014-09-30, fix [#180](https://github.com/winlinvip/simple-rtmp-server/issues/180), crash for multiple edge publishing the same stream. 0.9.220.
* v1.0, 2014-09-26, fix hls bug, refine config and log, according to clion of jetbrains. 0.9.216.
* v1.0, 2014-09-25, fix [#177](https://github.com/winlinvip/simple-rtmp-server/issues/177), dvr segment add config dvr_wait_keyframe. 0.9.213.
* v1.0, 2014-08-28, fix [#167](https://github.com/winlinvip/simple-rtmp-server/issues/167), add openssl includes to utest. 0.9.209.
* v1.0, 2014-08-27, max connections is 32756, for st use mmap default. 0.9.209
* v1.0, 2014-08-24, fix [#150](https://github.com/winlinvip/simple-rtmp-server/issues/150), forward should forward the sequence header when retry. 0.9.208.
* v1.0, 2014-08-22, for [#165](https://github.com/winlinvip/simple-rtmp-server/issues/165), refine dh wrapper, ensure public key is 128bytes. 0.9.206.
* v1.0, 2014-08-19, for [#160](https://github.com/winlinvip/simple-rtmp-server/issues/160), support forward/edge to flussonic, disable debug_srs_upnode to make flussonic happy. 0.9.201.
* v1.0, 2014-08-17, for [#155](https://github.com/winlinvip/simple-rtmp-server/issues/155), refine for osx, with ssl/http, disable statistics. 0.9.198.
* v1.0, 2014-08-06, fix [#148](https://github.com/winlinvip/simple-rtmp-server/issues/148), simplify the RTMP handshake key generation. 0.9.191.
* v1.0, 2014-08-06, fix [#147](https://github.com/winlinvip/simple-rtmp-server/issues/147), support identify the srs edge. 0.9.190.
* <strong>v1.0, 2014-08-03, [1.0 mainline7(0.9.189)](https://github.com/winlinvip/simple-rtmp-server/releases/tag/1.0.mainline7) released. 57432 lines.</strong>
* v1.0, 2014-08-03, fix [#79](https://github.com/winlinvip/simple-rtmp-server/issues/79), fix the reload remove edge assert bug. 0.9.189.
* v1.0, 2014-08-03, fix [#57](https://github.com/winlinvip/simple-rtmp-server/issues/57), use lock(acquire/release publish) to avoid duplicated publishing. 0.9.188.
* v1.0, 2014-08-03, fix [#85](https://github.com/winlinvip/simple-rtmp-server/issues/85), fix the segment-dvr sequence header missing. 0.9.187.
* v1.0, 2014-08-03, fix [#145](https://github.com/winlinvip/simple-rtmp-server/issues/145), refine ffmpeg log, check abitrate for libaacplus. 0.9.186.
* v1.0, 2014-08-03, fix [#143](https://github.com/winlinvip/simple-rtmp-server/issues/143), fix retrieve sys stat bug for all linux. 0.9.185.
* v1.0, 2014-08-02, fix [#138](https://github.com/winlinvip/simple-rtmp-server/issues/138), fix http hooks bug, regression bug. 0.9.184.
* v1.0, 2014-08-02, fix [#142](https://github.com/winlinvip/simple-rtmp-server/issues/142), fix tcp stat slow bug, use /proc/net/sockstat instead, refer to 'ss -s'. 0.9.183.
* v1.0, 2014-07-31, fix [#141](https://github.com/winlinvip/simple-rtmp-server/issues/141), support tun0(vpn network device) ip retrieve. 0.9.179.
* v1.0, 2014-07-27, support partially build on OSX(Darwin). 0.9.177
* v1.0, 2014-07-27, api connections add udp, add disk iops. 0.9.176
* v1.0, 2014-07-26, complete config utest. 0.9.173
* v1.0, 2014-07-26, fix [#124](https://github.com/winlinvip/simple-rtmp-server/issues/124), gop cache support disable video in publishing. 0.9.171.
* v1.0, 2014-07-23, fix [#121](https://github.com/winlinvip/simple-rtmp-server/issues/121), srs_info detail log compile failed. 0.9.168.
* v1.0, 2014-07-19, fix [#119](https://github.com/winlinvip/simple-rtmp-server/issues/119), use iformat and oformat for ffmpeg transcode. 0.9.163.
* <strong>v1.0, 2014-07-13, [1.0 mainline6(0.9.160)](https://github.com/winlinvip/simple-rtmp-server/releases/tag/1.0.mainline6) released. 50029 lines.</strong>
* v1.0, 2014-07-13, refine the bandwidth check/test, add as/js library, use srs-librtmp for linux tool. 0.9.159
* v1.0, 2014-07-12, complete rtmp stack utest. 0.9.156
* v1.0, 2014-07-06, fix [#81](https://github.com/winlinvip/simple-rtmp-server/issues/81), fix HLS codec info, IOS ok. 0.9.153.
* v1.0, 2014-07-06, fix [#103](https://github.com/winlinvip/simple-rtmp-server/issues/103), support all aac sample rate. 0.9.150.
* v1.0, 2014-07-05, complete kernel utest. 0.9.149
* v1.0, 2014-06-30, fix [#111](https://github.com/winlinvip/simple-rtmp-server/issues/111), always use 31bits timestamp. 0.9.143.
* v1.0, 2014-06-28, response the call message with null. 0.9.137
* v1.0, 2014-06-28, fix [#110](https://github.com/winlinvip/simple-rtmp-server/issues/110), thread start segment fault, thread cycle stop destroy thread. 0.9.136
* v1.0, 2014-06-27, fix [#109](https://github.com/winlinvip/simple-rtmp-server/issues/109), fix the system jump time, adjust system startup time. 0.9.135
* <strong>v1.0, 2014-06-27, [1.0 mainline5(0.9.134)](https://github.com/winlinvip/simple-rtmp-server/releases/tag/1.0.mainline5) released. 41573 lines.</strong>
* v1.0, 2014-06-27, SRS online 30days with RTMP/HLS.
* v1.0, 2014-06-25, fix [#108](https://github.com/winlinvip/simple-rtmp-server/issues/108), support config time jitter for encoder non-monotonical stream. 0.9.133
* v1.0, 2014-06-23, support report summaries in heartbeat. 0.9.132
* v1.0, 2014-06-22, performance refine, support [3k+](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_Performance#%E6%80%A7%E8%83%BD%E4%BE%8B%E8%A1%8C%E6%8A%A5%E5%91%8A4k) connections(270kbps). 0.9.130
* v1.0, 2014-06-21, support edge [token traverse](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_DRM#tokentraverse), fix [#104](https://github.com/winlinvip/simple-rtmp-server/issues/104). 0.9.129
* v1.0, 2014-06-19, add connections count to api summaries. 0.9.127
* v1.0, 2014-06-19, add srs bytes and kbps to api summaries. 0.9.126
* v1.0, 2014-06-18, add network bytes to api summaries. 0.9.125
* v1.0, 2014-06-14, fix [#98](https://github.com/winlinvip/simple-rtmp-server/issues/98), workaround for librtmp ping(fmt=1,cid=2 fresh stream). 0.9.124
* v1.0, 2014-05-29, support flv inject and flv http streaming with start=bytes. 0.9.122
* <strong>v1.0, 2014-05-28, [1.0 mainline4(0.9.120)](https://github.com/winlinvip/simple-rtmp-server/releases/tag/1.0.mainline4) released. 39200 lines.</strong>
* v1.0, 2014-05-27, fix [#87](https://github.com/winlinvip/simple-rtmp-server/issues/87), add source id for full trackable log. 0.9.120
* v1.0, 2014-05-27, fix [#84](https://github.com/winlinvip/simple-rtmp-server/issues/84), unpublish when edge disconnect. 0.9.119
* v1.0, 2014-05-27, fix [#89](https://github.com/winlinvip/simple-rtmp-server/issues/89), config to /dev/null to disable ffmpeg log. 0.9.117
* v1.0, 2014-05-25, fix [#76](https://github.com/winlinvip/simple-rtmp-server/issues/76), allow edge vhost to add or remove. 0.9.114
* v1.0, 2014-05-24, Johnny contribute [ossrs.net](http://ossrs.net). karthikeyan start to translate wiki to English.
* v1.0, 2014-05-22, fix [#78](https://github.com/winlinvip/simple-rtmp-server/issues/78), st joinable thread must be stop by other threads, 0.9.113
* v1.0, 2014-05-22, support amf0 StrictArray(0x0a). 0.9.111.
* v1.0, 2014-05-22, support flv parser, add amf0 to librtmp. 0.9.110
* v1.0, 2014-05-22, fix [#74](https://github.com/winlinvip/simple-rtmp-server/issues/74), add tcUrl for http callback on_connect, 0.9.109
* v1.0, 2014-05-19, support http heartbeat, 0.9.107
* <strong>v1.0, 2014-05-18, [1.0 mainline3(0.9.105)](https://github.com/winlinvip/simple-rtmp-server/releases/tag/1.0.mainline3) released. 37594 lines.</strong>
* v1.0, 2014-05-18, support http api json, to PUT/POST. 0.9.105
* v1.0, 2014-05-17, fix [#72](https://github.com/winlinvip/simple-rtmp-server/issues/72), also need stream_id for send_and_free_message. 0.9.101
* v1.0, 2014-05-17, rename struct to class. 0.9.100
* v1.0, 2014-05-14, fix [#67](https://github.com/winlinvip/simple-rtmp-server/issues/67) pithy print, stage must has a age. 0.9.98
* v1.0, 2014-05-13, fix mem leak for delete[] SharedPtrMessage array. 0.9.95
* v1.0, 2014-05-12, refine the kbps calc module. 0.9.93
* v1.0, 2014-05-12, fix bug [#64](https://github.com/winlinvip/simple-rtmp-server/issues/64): install_dir=DESTDIR+PREFIX
* v1.0, 2014-05-08, fix [#36](https://github.com/winlinvip/simple-rtmp-server/issues/36): never directly use \*(int32_t\*) for arm.
* v1.0, 2014-05-08, fix [#60](https://github.com/winlinvip/simple-rtmp-server/issues/60): support aggregate message
* v1.0, 2014-05-08, fix [#59](https://github.com/winlinvip/simple-rtmp-server/issues/59), edge support FMS origin server. 0.9.92
* v1.0, 2014-05-06, fix [#50](https://github.com/winlinvip/simple-rtmp-server/issues/50), ubuntu14 build error.
* v1.0, 2014-05-04, support mips linux.
* v1.0, 2014-04-30, fix bug [#34](https://github.com/winlinvip/simple-rtmp-server/issues/34): convert signal to io thread. 0.9.85
* v1.0, 2014-04-29, refine RTMP protocol completed, to 0.9.81
* <strong>v1.0, 2014-04-28, [1.0 mainline2(0.9.79)](https://github.com/winlinvip/simple-rtmp-server/releases/tag/1.0.mainline2) released. 35255 lines.</strong>
* v1.0, 2014-04-28, support full edge RTMP server. 0.9.79
* v1.0, 2014-04-27, support basic edge(play/publish) RTMP server. 0.9.78
* v1.0, 2014-04-25, add donation page. 0.9.76
* v1.0, 2014-04-21, support android app to start srs for internal edge. 0.9.72
* v1.0, 2014-04-19, support tool over srs-librtmp to ingest flv/rtmp. 0.9.71
* v1.0, 2014-04-17, support dvr(record live to flv file for vod). 0.9.69
* v1.0, 2014-04-11, add speex1.2 to transcode flash encoder stream. 0.9.58
* v1.0, 2014-04-10, support reload ingesters(add/remov/update). 0.9.57
* <strong>v1.0, 2014-04-07, [1.0 mainline(0.9.55)](https://github.com/winlinvip/simple-rtmp-server/releases/tag/1.0.mainline) released. 30000 lines.</strong>
* v1.0, 2014-04-07, support [ingest](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_SampleIngest) file/stream/device.
* v1.0, 2014-04-05, support [http api](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_HTTPApi) and [http server](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_HTTPServer).
* v1.0, 2014-04-03, implements http framework and api/v1/version.
* v1.0, 2014-03-30, fix bug for st detecting epoll failed, force st to use epoll.
* v1.0, 2014-03-29, add wiki [Performance for RaspberryPi](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_RaspberryPi).
* v1.0, 2014-03-29, add release binary package for raspberry-pi.
* v1.0, 2014-03-26, support RTMP ATC for HLS/HDS to support backup(failover).
* v1.0, 2014-03-23, support daemon, default start in daemon.
* v1.0, 2014-03-22, support make install/install-api and uninstall.
* v1.0, 2014-03-22, add ./etc/init.d/srs, refine to support make clean then make.
* v1.0, 2014-03-21, write pid to ./objs/srs.pid.
* v1.0, 2014-03-20, refine hls code, support pure audio HLS.
* v1.0, 2014-03-19, add vn/an for FFMPEG to drop video/audio for radio stream.
* v1.0, 2014-03-19, refine handshake, client support complex handshake, add utest.
* v1.0, 2014-03-16, fix bug on arm of st, the sp change from 20 to 8, for respberry-pi, @see [commit](https://github.com/winlinvip/simple-rtmp-server/commit/5a4373d4835758188b9a1f03005cea0b6ddc62aa)
* v1.0, 2014-03-16, support ARM([debian armhf, v7cpu](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_SrsLinuxArm)) with rtmp/ssl/hls/librtmp.
* v1.0, 2014-03-12, finish utest for amf0 codec.
* v1.0, 2014-03-06, add gperftools for mem leak detect, mem/cpu profile.
* v1.0, 2014-03-04, add gest framework for utest, build success.
* v1.0, 2014-03-02, add wiki [srs-librtmp](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_SrsLibrtmp), [SRS for arm](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_SrsLinuxArm), [product](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_Product)
* v1.0, 2014-03-02, srs-librtmp, client publish/play library like librtmp.
* v1.0, 2014-03-01, modularity, extract core/kernel/rtmp/app/main module.
* v1.0, 2014-02-28, support arm build(SRS/ST), add ssl to 3rdparty package.
* v1.0, 2014-02-28, add wiki [BuildArm](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_Build), [FFMPEG](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_FFMPEG), [Reload](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_Reload)
* v1.0, 2014-02-27, add wiki [LowLatency](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_LowLatency), [HTTPCallback](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_HTTPCallback), [ServerSideScript](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_ServerSideScript), [IDE](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_IDE)
* v1.0, 2014-01-19, add wiki [DeliveryHLS](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_DeliveryHLS)
* v1.0, 2014-01-12, add wiki [HowToAskQuestion](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_HowToAskQuestion), [RtmpUrlVhost](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_RtmpUrlVhost)
* v1.0, 2014-01-11, fix jw/flower player pause bug, which send closeStream actually.
* v1.0, 2014-01-05, add wiki [Build](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_Build), [Performance](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_Performance), [Forward](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_Forward)
* v1.0, 2014-01-01, change listen(512), chunk-size(60000), to improve performance.
* v1.0, 2013-12-27, merge from wenjie, the bandwidth test feature.
* <strong>v0.9, 2013-12-25, [v0.9](https://github.com/winlinvip/simple-rtmp-server/releases/tag/0.9) released. 20926 lines.</strong>
* v0.9, 2013-12-25, fix the bitrate bug(in Bps), use enhanced microphone.
* v0.9, 2013-12-22, demo video meeting or chat(SRS+cherrypy+jquery+bootstrap).
* v0.9, 2013-12-22, merge from wenjie, support banwidth test.
* v0.9, 2013-12-22, merge from wenjie: support set chunk size at vhost level
* v0.9, 2013-12-21, add [players](http://demo.srs.com/players) for play and publish.
* v0.9, 2013-12-15, ensure the HLS(ts) is continous when republish stream.
* v0.9, 2013-12-15, fix the hls reload bug, feed it the sequence header.
* v0.9, 2013-12-15, refine protocol, use int64_t timestamp for ts and jitter.
* v0.9, 2013-12-15, support set the live queue length(in seconds), drop when full.
* v0.9, 2013-12-15, fix the forwarder reconnect bug, feed it the sequence header.
* v0.9, 2013-12-15, support reload the hls/forwarder/transcoder.
* v0.9, 2013-12-14, refine the thread model for the retry threads.
* v0.9, 2013-12-10, auto install depends tools/libs on centos/ubuntu.
* <strong>v0.8, 2013-12-08, [v0.8](https://github.com/winlinvip/simple-rtmp-server/releases/tag/0.8) released. 19186 lines.</strong>
* v0.8, 2013-12-08, support [http hooks](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_HTTPCallback): on_connect/close/publish/unpublish/play/stop.
* v0.8, 2013-12-08, support multiple http hooks for a event.
* v0.8, 2013-12-07, support http callback hooks, on_connect.
* v0.8, 2013-12-07, support network based cli and json result, add CherryPy 3.2.4.
* v0.8, 2013-12-07, update http/hls/rtmp load test tool [st_load](https://github.com/winlinvip/st-load), use SRS rtmp sdk.
* v0.8, 2013-12-06, support max_connections, drop if exceed.
* v0.8, 2013-12-05, support log_dir, write ffmpeg log to file.
* v0.8, 2013-12-05, fix the forward/hls/encoder bug.
* <strong>v0.7, 2013-12-03, [v0.7](https://github.com/winlinvip/simple-rtmp-server/releases/tag/0.7) released. 17605 lines.</strong>
* v0.7, 2013-12-01, support dead-loop detect for forwarder and transcoder.
* v0.7, 2013-12-01, support all ffmpeg filters and params.
* v0.7, 2013-11-30, support live stream transcoder by ffmpeg.
* v0.7, 2013-11-30, support --with/without -ffmpeg, build ffmpeg-2.1.
* v0.7, 2013-11-30, add ffmpeg-2.1, x264-core138, lame-3.99.5, libaacplus-2.0.2.
* <strong>v0.6, 2013-11-29, [v0.6](https://github.com/winlinvip/simple-rtmp-server/releases/tag/0.6) released. 16094 lines.</strong>
* v0.6, 2013-11-29, add performance summary, 1800 clients, 900Mbps, CPU 90.2%, 41MB.
* v0.6, 2013-11-29, support forward stream to other edge server.
* v0.6, 2013-11-29, support forward stream to other origin server.
* v0.6, 2013-11-28, fix memory leak bug, aac decode bug.
* v0.6, 2013-11-27, support --with or --without -hls and -ssl options.
* v0.6, 2013-11-27, support AAC 44100HZ sample rate for iphone, adjust the timestamp.
* <strong>v0.5, 2013-11-26, [v0.5](https://github.com/winlinvip/simple-rtmp-server/releases/tag/0.5) released. 14449 lines.</strong>
* v0.5, 2013-11-24, support HLS(m3u8), fragment and window.
* v0.5, 2013-11-24, support record to ts file for HLS.
* v0.5, 2013-11-21, add ts_info tool to demux ts file.
* v0.5, 2013-11-16, add rtmp players(OSMF/jwplayer5/jwplayer6).
* <strong>v0.4, 2013-11-10, [v0.4](https://github.com/winlinvip/simple-rtmp-server/releases/tag/0.4) released. 12500 lines.</strong>
* v0.4, 2013-11-10, support config and reload the pithy print.
* v0.4, 2013-11-09, support reload config(vhost and its detail).
* v0.4, 2013-11-09, support reload config(listen and chunk_size) by SIGHUP(1).
* v0.4, 2013-11-09, support longtime(>4.6hours) publish/play.
* v0.4, 2013-11-09, support config the chunk_size.
* v0.4, 2013-11-09, support pause for live stream.
* <strong>v0.3, 2013-11-04, [v0.3](https://github.com/winlinvip/simple-rtmp-server/releases/tag/0.3) released. 11773 lines.</strong>
* v0.3, 2013-11-04, support refer/play-refer/publish-refer.
* v0.3, 2013-11-04, support vhosts specified config.
* v0.3, 2013-11-02, support listen multiple ports.
* v0.3, 2013-11-02, support config file in nginx-conf style.
* v0.3, 2013-10-29, support pithy print log message specified by stage.
* v0.3, 2013-10-28, support librtmp without extended-timestamp in 0xCX chunk packet.
* v0.3, 2013-10-27, support cache last gop for client fast startup.
* <strong>v0.2, 2013-10-25, [v0.2](https://github.com/winlinvip/simple-rtmp-server/releases/tag/0.2) released. 10125 lines.</strong>
* v0.2, 2013-10-25, support flash publish.
* v0.2, 2013-10-25, support h264/avc codec by rtmp complex handshake.
* v0.2, 2013-10-24, support time jitter detect and correct algorithm
* v0.2, 2013-10-24, support decode codec type to cache the h264/avc sequence header.
* <strong>v0.1, 2013-10-23, [v0.1](https://github.com/winlinvip/simple-rtmp-server/releases/tag/0.1) released. 8287 lines.</strong>
* v0.1, 2013-10-23, support basic amf0 codec, simplify the api using c-style api.
* v0.1, 2013-10-23, support shared ptr msg for zero memory copy.
* v0.1, 2013-10-22, support vp6 codec with rtmp protocol specified simple handshake.
* v0.1, 2013-10-20, support multiple flash client play live streaming.
* v0.1, 2013-10-20, support FMLE/FFMPEG publish live streaming.
* v0.1, 2013-10-18, support rtmp message2chunk protocol(send\_message).
* v0.1, 2013-10-17, support rtmp chunk2message protocol(recv\_message).
## Performance
Performance benchmark history, on virtual box:
* 2014-07-12, SRS 0.9.156, 2700clients, 89%CPU, 61MB. [benchmark](https://github.com/winlinvip/simple-rtmp-server/commit/6d12280b7cc54c465b1caf8b1402149e77c4c7d9)
* 2014-07-12, SRS 0.9.156, 1800clients, 68%CPU, 38MB. [benchmark](https://github.com/winlinvip/simple-rtmp-server/commit/e2d273f4939348374bf9644df9d54c4293b39c1a)
* 2013-11-28, SRS 0.5.0, 1800clients, 90%CPU, 41MB. [benchmark](https://github.com/winlinvip/simple-rtmp-server/commit/023e23bc8261bec15a70a7ae932098fb4f82b679)
Latest benchmark:
1. 300 connections, 150Mbps, 500kbps, CPU 5.7%, MEM 9208KB.
1. 600 connections, 300Mbps, 500kbps, CPU 18.3%, MEM 13MB.
1. 900 connections, 450Mbps, 500kbps, CPU 27.9%, MEM 20MB.
1. 1200 connections, 600Mbps, 500kbps, CPU 43.9%, MEM 26MB.
1. 1500 connections, 750Mbps, 500kbps, CPU 55.2%, MEM 32MB.
1. 1800 connections, 900Mbps, 500kbps, CPU 68.8%, MEM 38MB.
1. 2100 connections, 1050Mbps, 500kbps, CPU 75.7%, MEM 46MB.
1. 2400 connections, 1200Mbps, 500kbps, CPU 83.7%, MEM 54MB.
1. 2700 connections, 1350Mbps, 500kbps, CPU 89.9%, MEM 61MB.
<pre>
[winlin@dev6 srs]$ dstat
----total-cpu-usage---- -dsk/total- ---net/lo-- ---paging-- ---system--
usr sys idl wai hiq siq| read writ| recv send| in out | int csw
29 17 39 0 0 15| 0 5325B| 163M 163M| 0 0 |4331 3386
30 16 38 0 0 16| 0 5325B| 160M 160M| 0 0 |4252 3332
30 15 37 0 0 17| 0 7646B| 169M 169M| 0 0 |4015 2886
30 17 36 0 0 17| 0 1638B| 197M 197M| 0 0 |4021 3037
31 17 35 0 0 17| 0 410B| 204M 204M| 0 0 |4181 3243
33 17 32 0 0 18| 0 2185B| 191M 191M| 0 0 |4305 3592
31 15 36 0 0 18| 0 1229B| 127M 127M| 0 0 |4446 3822
34 18 30 0 0 18| 0 0 | 231M 231M| 0 0 |4461 3691
32 17 33 0 0 18| 0 410B| 169M 169M| 0 0 |4518 3788
</pre>
* See also: [Performance for x86/x64 Test Guide](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_Performance)
* See also: [Performance for RaspberryPi](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_RaspberryPi)
## Architecture
SRS always use the most simple architecture to support complex transaction.
* System arch: the system structure and arch.
* Modularity arch: the main modularity of SRS.
* Stream arch: the stream dispatch arch of SRS.
* RTMP cluster arch: the RTMP origin and edge cluster arch.
* Multiple processes arch (by wenjie): the multiple process of SRS.
* CLI arch: the cli arch for SRS, api to manage SRS.
* Bandwidth specification: the bandwidth test specification of SRS.
### 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, -rtmp-+->-+-> HLS/NGINX --------+-> m3u8 player |
| Flash,XSPLIT, | +-> Fowarder ---------+-> RTMP Server |
| ......) | +-> Transcoder -------+-> RTMP Server |
| | +-> DVR --------------+-> FILE |
| | +-> BandwidthTest ----+-> Flash/StLoad |
+----------------------+ | |
| MediaSource(2) | | |
| (RTSP,FILE, | | |
| HTTP,HLS, ------+->-- Ingester ----(rtmp)-+-> SRS |
| Device, | | |
| ......) | | |
+----------------------+-------------------------+----------------+
Remark:
(1) Encoder: encoder must push RTMP stream to SRS server.
(2) MediaSource: any media source, which can be ingest by ffmpeg.
(3) Ingester: SRS will fork a process to run ffmpeg(or your application)
to ingest any input to rtmp, push to SRS.
</pre>
### [HDS/HLS origin backup](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_RTMP-ATC)
<pre>
+----------+ +----------+
+--ATC->-+ server +--ATC->-+ packager +-+ +---------+
+----------+ | RTMP +----------+ RTMP +----------+ | | Reverse | +-------+
| encoder +->-+ +->-+ Proxy +-->-+ CDN +
+----------+ | +----------+ +----------+ | | (nginx) | +-------+
+--ATC->-+ server +--ATC->-+ packager +-+ +---------+
RTMP +----------+ RTMP +----------+
</pre>
### [RTMP cluster(origin/edge) Architecture](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_Edge)
Remark: cluster over edge, see [Edge](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_Edge)
Remark: cluster over forward, see [Forward](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_Forward)
<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)
<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.
(c) Maybe multiple thread is ok? By winlin.
</pre>
### Bandwidth Test Workflow
<pre>
+------------+ +----------+
| Client | | Server |
+-----+------+ +-----+----+
| |
| connect vhost-------------> |
| &lt;-----------result(success) |
| |
| &lt;----------call(start play) |
| result(playing)----------> |
| &lt;-------------data(playing) |
| &lt;-----------call(stop play) |
| result(stopped)----------> |
| |
| &lt;-------call(start publish) |
| result(publishing)-------> |
| data(publishing)---------> |
| &lt;--------call(stop publish) |
| result(stopped)(1)-------> |
| |
| &lt;--------------------report |
| final(2)-----------------> |
| &lt;END> |
@See: class SrsBandwidth comments.
</pre>
Beijing, 2013.10<br/>
Winlin

Binary file not shown.

Binary file not shown.

@ -0,0 +1,17 @@
#!/bin/bash
# check exists.
if [[ -f /usr/local/bin/ccache ]]; then
echo "ccache is ok";
exit 0;
fi
# check sudoer.
sudo echo "ok" > /dev/null 2>&1;
ret=$?; if [[ 0 -ne ${ret} ]]; then echo "you must be sudoer"; exit 1; fi
unzip ccache-3.1.9.zip && cd ccache-3.1.9 && ./configure && make
ret=$?; if [[ $ret -ne 0 ]]; then echo "build ccache failed."; exit $ret; fi
sudo cp ccache /usr/local/bin && sudo ln -s ccache /usr/local/bin/gcc && sudo ln -s ccache /usr/local/bin/g++ && sudo ln -s ccache /usr/local/bin/cc && sudo ln -s ccache /usr/local/bin/c++
ret=$?; if [[ $ret -ne 0 ]]; then echo "install ccache failed."; exit $ret; fi

Binary file not shown.

@ -0,0 +1,11 @@
ccache是samba组织提供的加速编译过程的工具
使用虚拟机编译可以考虑用这个工具,让编译过程飞快。
链接:
http://ccache.samba.org/
http://samba.org/ftp/ccache/ccache-3.1.9.tar.xz
http://ccache.samba.org/manual.html
安装方法:
bash build_ccache.sh
注意要求以sudoer执行要修改文件。

Binary file not shown.

Binary file not shown.

@ -0,0 +1,17 @@
#!/bin/bash
# check exists.
if [[ -d graphviz-2.18 ]]; then
echo "graphviz is ok";
exit 0;
fi
# check sudoer.
sudo echo "ok" > /dev/null 2>&1;
ret=$?; if [[ 0 -ne ${ret} ]]; then echo "you must be sudoer"; exit 1; fi
unzip -q graphviz-2.36.0.zip
cd graphviz-2.36.0 && ./configure && make && sudo make install
ret=$?; if [[ $ret -ne 0 ]]; then echo "build gprof2dot failed."; exit $ret; fi
echo "we test in Centos6.0, it's ok"

File diff suppressed because it is too large Load Diff

Binary file not shown.

@ -0,0 +1,36 @@
gprof图形化输出工具: gprof2dot.py graphviz-2.18.tar.gz build_gprof2dot.sh
dot:
http://www.graphviz.org/
http://www.graphviz.org/Download_source.php
graphviz-2.18.tar.gz 绘图工具
build_gprof2dot.sh 编译graphviz命令为dot。
要求是sudoer需要sudo make install。
gprof2dot.py:
将gprof的日志绘图。
使用方法:
0. 若需要图形化编译dot
cd 3rdparty/gprof && bash build_gprof2dot.sh
1. srs配置时:
./configure --with-gprof
脚本会加入编译参数"-pg -lc_p"gcc -g -pg -lc_p -c xxx -o xxx.o即在configure中打开 Performance="-pg -lc_p"
链接时,加入链接选项"-pg"否则无法工作gcc -pg -o srs xxxx.o即在configure中打开 PerformanceLink="-pg"
2. 编译和启动程序make && ./objs/srs -c conf/srs.conf
退出程序按CTRL+C可以看到生成了gmon.out这个就是性能的统计数据。
3. gprof生成报表
gprof -b ./objs/srs gmon.out > gprof.srs.log
4. 将报表生成图片:
./3rdparty/gprof/gprof2dot.py gprof.srs.log | dot -Tpng -o ~/winlin.png
缩写语句:
# 生成 ~/winlin.log ~/winlin.png
rm -f gmon.out; ./objs/srs -c conf/srs.conf
# 用户按CTRL+C
file="winlin";gprof -b ./objs/srs gmon.out > ~/${file}.log; ./3rdparty/gprof/gprof2dot.py ~/${file}.log | dot -Tpng -o ~/${file}.png
备注:
其实gprof生成的日志就可以看不一定要图形化。
也就是dot和gprof2dot都不用执行。
参考http://www.cs.utah.edu/dept/old/texinfo/as/gprof.html

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -0,0 +1,21 @@
Only in .: 1.st.arm.patch
diff -r -c ./md.h ../st-1.9-patch-arm/md.h
*** ./md.h 2009-10-02 02:46:43.000000000 +0800
--- ../st-1.9-patch-arm/md.h 2014-03-16 20:49:03.845344804 +0800
***************
*** 422,428 ****
#define MD_STACK_GROWS_DOWN
#if defined(__GLIBC__) && __GLIBC__ >= 2
! #define MD_GET_SP(_t) (_t)->context[0].__jmpbuf[20]
#else
#error "ARM/Linux pre-glibc2 not supported yet"
#endif /* defined(__GLIBC__) && __GLIBC__ >= 2 */
--- 422,428 ----
#define MD_STACK_GROWS_DOWN
#if defined(__GLIBC__) && __GLIBC__ >= 2
! #define MD_GET_SP(_t) (_t)->context[0].__jmpbuf[8]
#else
#error "ARM/Linux pre-glibc2 not supported yet"
#endif /* defined(__GLIBC__) && __GLIBC__ >= 2 */

@ -0,0 +1,79 @@
http-parser-2.1.zip
for srs to support http callback.
nginx-1.5.7.zip
for srs to support hls streaming.
st-1.9.zip
basic framework for srs.
openssl-1.0.1f.zip
openssl for SRS(with-ssl) RTMP complex handshake to delivery h264+aac stream.
CherryPy-3.2.4.zip
sample api server for srs.
ffmpeg-2.1.1.tar.gz
yasm-1.2.0.tar.gz
lame-3.99.5.tar.gz
libaacplus-2.0.2.tar.gz
libaacplus-patch-26410-800.zip (26410-800.zip)
speex-1.2rc1.zip
x264-snapshot-20131129-2245-stable.tar.bz2 (core.138)
for srs to support live stream transcoding.
remark: we use *.zip for all linux plantform.
tools/ccache-3.1.9.zip
to fast build.
1.st.arm.Makefile.patch
st编译脚本补丁允许用户指定cc编译器。
gtest-1.6.0.zip
google单元测试框架。
gperftools-2.1.zip
google性能分析和测试工具。
编译和使用参考压缩文件中的README和doc目录。
links:
nginx:
http://nginx.org/
http-parser:
https://github.com/joyent/http-parser
state-threads:
http://sourceforge.net/projects/state-threads
ffmpeg:
http://ffmpeg.org/
http://ffmpeg.org/releases/ffmpeg-2.1.1.tar.gz
x264:
http://www.videolan.org/
ftp://ftp.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-20131129-2245-stable.tar.bz2
lame:
http://sourceforge.net/projects/lame/
http://nchc.dl.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz
aacplus:
http://217.20.164.161/~tipok/aacplus/
http://217.20.164.161/~tipok/aacplus/libaacplus-2.0.2.tar.gz
aacplus-patch:
http://www.3gpp.org/DynaReport/26410.htm
http://www.3gpp.org/ftp/Specs/archive/26_series/26.410/26410-800.zip
yasm:
http://yasm.tortall.net/
http://www.tortall.net/projects/yasm/releases/yasm-1.2.0.tar.gz
cherrypy:
http://www.cherrypy.org/
https://pypi.python.org/pypi/CherryPy/3.2.4
openssl:
http://www.openssl.org/
http://www.openssl.org/source/openssl-1.0.1f.tar.gz
gtest:
https://code.google.com/p/googletest
https://code.google.com/p/googletest/downloads/list
gperftools:
https://code.google.com/p/gperftools/
https://code.google.com/p/gperftools/downloads/list
speex:
http://www.speex.org/downloads/
http://downloads.xiph.org/releases/speex/speex-1.2rc1.tar.gz

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -0,0 +1,51 @@
cmake_minimum_required(VERSION 2.6.4)
project(srs CXX)
INCLUDE_DIRECTORIES(objs objs/st objs/hp objs/openssl src/core src/kernel src/rtmp src/app)
set(SOURCE_FILES src/main/srs_main_server.cpp)
AUX_SOURCE_DIRECTORY(src/core SOURCE_FILES)
AUX_SOURCE_DIRECTORY(src/kernel SOURCE_FILES)
AUX_SOURCE_DIRECTORY(src/rtmp SOURCE_FILES)
AUX_SOURCE_DIRECTORY(src/app SOURCE_FILES)
ADD_EXECUTABLE(srs ${SOURCE_FILES})
TARGET_LINK_LIBRARIES(srs dl)
TARGET_LINK_LIBRARIES(srs ${PROJECT_SOURCE_DIR}/objs/st/libst.a)
TARGET_LINK_LIBRARIES(srs ${PROJECT_SOURCE_DIR}/objs/openssl/lib/libssl.a)
TARGET_LINK_LIBRARIES(srs ${PROJECT_SOURCE_DIR}/objs/openssl/lib/libcrypto.a)
TARGET_LINK_LIBRARIES(srs ${PROJECT_SOURCE_DIR}/objs/hp/libhttp_parser.a)
IF(NOT EXISTS ${PROJECT_SOURCE_DIR}/objs/st/libst.a)
MESSAGE("srs_libs not found")
EXEC_PROGRAM(./configure)
ENDIF(NOT EXISTS ${PROJECT_SOURCE_DIR}/objs/st/libst.a)
MESSAGE(STATUS "only for jetbrains IDE, @see https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_IDE#jetbrains")
MESSAGE(STATUS "only for jetbrains IDE, @see https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_IDE#jetbrains")
MESSAGE(STATUS "only for jetbrains IDE, @see https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_IDE#jetbrains")
MESSAGE(STATUS "only for jetbrains IDE, @see https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_IDE#jetbrains")
MESSAGE(STATUS "only for jetbrains IDE, @see https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_IDE#jetbrains")
MESSAGE(STATUS "only for jetbrains IDE, @see https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_IDE#jetbrains")
MESSAGE(STATUS "only for jetbrains IDE, @see https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_IDE#jetbrains")
MESSAGE(STATUS "only for jetbrains IDE, @see https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_IDE#jetbrains")
MESSAGE(STATUS "only for jetbrains IDE, @see https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_IDE#jetbrains")
MESSAGE(STATUS "only for jetbrains IDE, @see https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_IDE#jetbrains")
MESSAGE(STATUS "only for jetbrains IDE, @see https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_IDE#jetbrains")
MESSAGE(STATUS "only for jetbrains IDE, @see https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_IDE#jetbrains")
MESSAGE(STATUS "only for jetbrains IDE, @see https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_IDE#jetbrains")
MESSAGE(STATUS "only for jetbrains IDE, @see https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_IDE#jetbrains")
MESSAGE(STATUS "only for jetbrains IDE, @see https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_IDE#jetbrains")
MESSAGE(STATUS "only for jetbrains IDE, @see https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_IDE#jetbrains")
MESSAGE(STATUS "only for jetbrains IDE, @see https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_IDE#jetbrains")
MESSAGE(STATUS "only for jetbrains IDE, @see https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_IDE#jetbrains")
MESSAGE(STATUS "only for jetbrains IDE, @see https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_IDE#jetbrains")
MESSAGE(STATUS "only for jetbrains IDE, @see https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_IDE#jetbrains")
MESSAGE(STATUS "only for jetbrains IDE, @see https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_IDE#jetbrains")
MESSAGE(STATUS "only for jetbrains IDE, @see https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_IDE#jetbrains")
MESSAGE(STATUS "only for jetbrains IDE, @see https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_IDE#jetbrains")
MESSAGE(STATUS "only for jetbrains IDE, @see https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_IDE#jetbrains")
MESSAGE(STATUS "only for jetbrains IDE, @see https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_IDE#jetbrains")
MESSAGE(STATUS "only for jetbrains IDE, @see https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_IDE#jetbrains")
MESSAGE(STATUS "use ./configure && make, @see https://github.com/winlinvip/simple-rtmp-server#usage")

@ -0,0 +1,91 @@
# generate the binary
#
# params:
# $SRS_OBJS the objs directory. ie. objs
# $SRS_MAKEFILE the makefile name. ie. Makefile
#
# $MAIN_ENTRANCES array, disable all except the $APP_MAIN itself. ie. ["srs_main_server" "srs_main_bandcheck"]
# $APP_MAIN the object file that contains main function. ie. srs_main_server
# $BUILD_KEY a string indicates the build key for Makefile. ie. srs
# $APP_NAME the app name to output. ie. srs
# $MODULE_OBJS array, the objects to compile the app.
# $ModuleLibFiles array, the 3rdpart library file to link with. ie. [objs/st-1.9/obj/libst.a objs/libx264/obj/libx264.a]
# $LINK_OPTIONS the linker options. ie. -ldl
FILE=${SRS_OBJS}/${SRS_MAKEFILE}
APP_TARGET="${SRS_OBJS}/${APP_NAME}"
echo "generate app ${APP_NAME} depends...";
echo "# build ${APP_TARGET}" >> ${FILE}
# generate the binary depends, for example:
# srs: objs/srs
echo "${BUILD_KEY}: ${APP_TARGET}" >> ${FILE}
# the link commands, for example:
# objs/srs: objs/src/core/srs_core.o
echo -n "${APP_TARGET}: " >> ${FILE}
for item in ${MODULE_OBJS[*]}; do
FILE_NAME=`basename $item`
FILE_NAME=${FILE_NAME%.*}
ignored=0
for disabled_item in ${MAIN_ENTRANCES[*]}; do
if [[ ${FILE_NAME} == ${disabled_item} && ${FILE_NAME} != ${APP_MAIN} ]]; then
ignored=1
continue;
fi
done
if [ ! -f ${item} ]; then
ignored=1
fi
if [ ${ignored} == 1 ]; then
continue;
fi
OBJ_FILE=${SRS_OBJS}/$item
OBJ_FILE="${OBJ_FILE%.*}.o"
echo -n "${OBJ_FILE} " >> ${FILE}
done
echo "" >> ${FILE}
echo "generate app ${APP_NAME} link...";
# genereate the actual link command, for example:
# $(LINK) -o objs/srs objs/src/core/srs_core.o -ldl
echo -n " \$(LINK) -o ${APP_TARGET} " >> ${FILE}
for item in ${MODULE_OBJS[*]}; do
FILE_NAME=`basename $item`
FILE_NAME=${FILE_NAME%.*}
ignored=0
for disabled_item in ${MAIN_ENTRANCES[*]}; do
if [[ ${FILE_NAME} == ${disabled_item} && ${FILE_NAME} != ${APP_MAIN} ]]; then
ignored=1
continue;
fi
done
if [ ! -f ${item} ]; then
ignored=1
fi
if [ ${ignored} == 1 ]; then
continue;
fi
OBJ_FILE=${SRS_OBJS}/$item
OBJ_FILE="${OBJ_FILE%.*}.o"
echo -n "${OBJ_FILE} " >> ${FILE}
done
# 3rdpart library static link.
for item in ${ModuleLibFiles[*]}; do
echo -n "$item " >> ${FILE}
done
# link options.
echo -n "${LINK_OPTIONS}" >> ${FILE}
echo "" >> ${FILE}
echo -n "generate app ${APP_NAME} ok"; echo '!';

@ -0,0 +1,113 @@
#!/bin/bash
ff_src_dir="../../3rdparty"
# the jobs to make ffmpeg
if [[ "" -eq SRS_JOBS ]]; then
export SRS_JOBS="--jobs=1"
fi
ff_current_dir=$(pwd -P)
ff_build_dir="${ff_current_dir}/_build"
ff_release_dir="${ff_current_dir}/_release"
echo "start to build the tools for transcode system:"
echo "current_dir: ${ff_current_dir}"
echo "build_dir: ${ff_build_dir}"
echo "release_dir: ${ff_release_dir}"
echo "SRS_JOBS: ${SRS_JOBS}"
mkdir -p ${ff_build_dir}
mkdir -p ${ff_release_dir}
# yasm for libx264
ff_yasm_bin=${ff_release_dir}/bin/yasm
if [[ -f ${ff_yasm_bin} ]]; then
echo "yasm is ok"
else
echo "build yasm-1.2.0"
cd $ff_current_dir &&
rm -rf yasm-1.2.0 && unzip -q ${ff_src_dir}/yasm-1.2.0.zip &&
cd yasm-1.2.0 && ./configure --prefix=${ff_release_dir} &&
make && make install
ret=$?; if [[ 0 -ne ${ret} ]]; then echo "build yasm-1.2.0 failed"; exit 1; fi
fi
# add yasm to path, for x264 to use yasm directly.
# ffmpeg can specifies the yasm path when configure it.
export PATH=${PATH}:${ff_release_dir}/bin
# libaacplus
if [[ -f ${ff_release_dir}/lib/libaacplus.a ]]; then
echo "libaacplus is ok"
else
echo "build yasm-1.2.0"
cd $ff_current_dir &&
rm -rf libaacplus-2.0.2 && unzip -q ${ff_src_dir}/libaacplus-2.0.2.zip &&
cd libaacplus-2.0.2 && cp ../${ff_src_dir}/libaacplus-patch-26410-800.zip src/26410-800.zip &&
bash autogen.sh && ./configure --prefix=${ff_release_dir} --enable-static && make && make install
ret=$?; if [[ 0 -ne ${ret} ]]; then echo "build libaacplus-2.0.2 failed"; exit 1; fi
fi
# lame-3.99
if [[ -f ${ff_release_dir}/lib/libmp3lame.a ]]; then
echo "libmp3lame is ok"
else
echo "build lame-3.99.5"
cd $ff_current_dir &&
rm -rf lame-3.99.5 && unzip -q ${ff_src_dir}/lame-3.99.5.zip &&
cd lame-3.99.5 && ./configure --prefix=${ff_release_dir} --enable-static && make ${SRS_JOBS} && make install
ret=$?; if [[ 0 -ne ${ret} ]]; then echo "build lame-3.99.5 failed"; exit 1; fi
fi
# speex-1.2rc1
if [[ -f ${ff_release_dir}/lib/libspeex.a ]]; then
echo "libspeex is ok"
else
echo "build speex-1.2rc1"
cd $ff_current_dir &&
rm -rf speex-1.2rc1 && unzip -q ${ff_src_dir}/speex-1.2rc1.zip &&
cd speex-1.2rc1 && ./configure --prefix=${ff_release_dir} --enable-static && make ${SRS_JOBS} && make install
ret=$?; if [[ 0 -ne ${ret} ]]; then echo "build speex-1.2rc1 failed"; exit 1; fi
fi
# x264 core.138
if [[ -f ${ff_release_dir}/lib/libx264.a ]]; then
echo "x264 is ok"
else
echo "build x264"
cd $ff_current_dir &&
rm -rf x264-snapshot-20131129-2245-stable && unzip -q ${ff_src_dir}/x264-snapshot-20131129-2245-stable.zip &&
cd x264-snapshot-20131129-2245-stable &&
./configure --prefix=${ff_release_dir} --disable-opencl --bit-depth=8 \
--enable-static --disable-avs --disable-swscale --disable-lavf \
--disable-ffms --disable-gpac &&
make ${SRS_JOBS} && make install
ret=$?; if [[ 0 -ne ${ret} ]]; then echo "build x264 failed"; exit 1; fi
fi
# ffmpeg-2.1.1
if [[ -f ${ff_release_dir}/bin/ffmpeg ]]; then
echo "ffmpeg-2.1.1 is ok"
else
echo "build ffmpeg-2.1.1"
cd $ff_current_dir &&
rm -rf ffmpeg-2.1.1 && unzip -q ${ff_src_dir}/ffmpeg-2.1.1.zip &&
echo "remove all so to force the ffmpeg to build in static" &&
rm -f ${ff_release_dir}/lib/*.so* &&
echo "export the dir to enable the build command canbe use." &&
export ffmpeg_exported_release_dir=${ff_release_dir} &&
cd ffmpeg-2.1.1 &&
./configure \
--enable-gpl --enable-nonfree \
--yasmexe=${ff_yasm_bin} \
--prefix=${ff_release_dir} --cc= \
--enable-static --disable-shared --disable-debug \
--extra-cflags='-I${ffmpeg_exported_release_dir}/include' \
--extra-ldflags='-L${ffmpeg_exported_release_dir}/lib -lm -ldl' \
--disable-ffplay --disable-ffprobe --disable-ffserver --disable-doc \
--enable-postproc --enable-bzlib --enable-zlib --enable-parsers \
--enable-libx264 --enable-libmp3lame --enable-libaacplus --enable-libspeex \
--enable-pthreads --extra-libs=-lpthread \
--enable-encoders --enable-decoders --enable-avfilter --enable-muxers --enable-demuxers &&
make ${SRS_JOBS} && make install
ret=$?; if [[ 0 -ne ${ret} ]]; then echo "build ffmpeg failed"; exit 1; fi
fi

@ -0,0 +1,728 @@
#!/bin/bash
# variables, parent script must set it:
# SRS_JOBS: the build jobs.
# SrsArmMakeOptions: the arm make options for ubuntu12(armhf, v7cpu)
# SRS_AUTO_HEADERS_H: the auto generated header file.
#####################################################################################
#####################################################################################
# prepare the depends tools and libraries
# DEPENDS: options.sh, only when user options parsed, the depends tools are known.
#####################################################################################
#####################################################################################
#####################################################################################
# utilities
#####################################################################################
function require_sudoer()
{
sudo echo "" >/dev/null 2>&1
ret=$?; if [[ 0 -ne $ret ]]; then
echo "\"$1\" require sudoer failed. ret=$ret";
exit $ret;
fi
}
# TODO: check gcc/g++
echo "check gcc/g++/gdb/make"
echo "depends tools are ok"
#####################################################################################
# for Ubuntu, auto install tools by apt-get
#####################################################################################
OS_IS_UBUNTU=NO
function Ubuntu_prepare()
{
if [ $SRS_CUBIE = YES ]; then
echo "for cubieboard, use ubuntu prepare"
else
uname -v|grep Ubuntu >/dev/null 2>&1
ret=$?; if [[ 0 -ne $ret ]]; then
return 0;
fi
fi
OS_IS_UBUNTU=YES
echo "Ubuntu detected, install tools if needed"
gcc --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
echo "install gcc"
require_sudoer "sudo apt-get install -y --force-yes gcc"
sudo apt-get install -y --force-yes gcc; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
echo "install gcc success"
fi
g++ --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
echo "install g++"
require_sudoer "sudo apt-get install -y --force-yes g++"
sudo apt-get install -y --force-yes g++; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
echo "install g++ success"
fi
make --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
echo "install make"
require_sudoer "sudo apt-get install -y --force-yes make"
sudo apt-get install -y --force-yes make; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
echo "install make success"
fi
patch --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
echo "install patch"
require_sudoer "sudo apt-get install -y --force-yes patch"
sudo apt-get install -y --force-yes patch; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
echo "install patch success"
fi
if [ $SRS_FFMPEG_TOOL = YES ]; then
autoconf --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
echo "install autoconf"
require_sudoer "sudo apt-get install -y --force-yes autoconf"
sudo apt-get install -y --force-yes autoconf; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
echo "install autoconf success"
fi
libtool --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
echo "install libtool"
require_sudoer "sudo apt-get install -y --force-yes libtool"
sudo apt-get install -y --force-yes libtool; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
echo "install libtool success"
fi
if [[ ! -f /usr/include/pcre.h ]]; then
echo "install libpcre3-dev"
require_sudoer "sudo apt-get install -y --force-yes libpcre3-dev"
sudo apt-get install -y --force-yes libpcre3-dev; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
echo "install libpcre3-dev success"
fi
if [[ ! -f /usr/include/zlib.h ]]; then
echo "install zlib1g-dev"
require_sudoer "sudo apt-get install -y --force-yes zlib1g-dev"
sudo apt-get install -y --force-yes zlib1g-dev; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
echo "install zlib1g-dev success"
fi
fi
# for arm, install the cross build tool chain.
if [ $SRS_ARM_UBUNTU12 = YES ]; then
$SrsArmCC --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
echo "install gcc-arm-linux-gnueabi g++-arm-linux-gnueabi"
require_sudoer "sudo apt-get install -y --force-yes gcc-arm-linux-gnueabi g++-arm-linux-gnueabi"
sudo apt-get install -y --force-yes gcc-arm-linux-gnueabi g++-arm-linux-gnueabi; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
echo "install gcc-arm-linux-gnueabi g++-arm-linux-gnueabi success"
fi
fi
# for mips, user must installed the tool chain.
if [ $SRS_MIPS_UBUNTU12 = YES ]; then
$SrsArmCC --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
echo "user must install the tool chain: $SrsArmCC"
return 2
fi
fi
echo "Ubuntu install tools success"
return 0
}
Ubuntu_prepare; ret=$?; if [[ 0 -ne $ret ]]; then echo "Ubuntu prepare failed, ret=$ret"; exit $ret; fi
#####################################################################################
# for Centos, auto install tools by yum
#####################################################################################
OS_IS_CENTOS=NO
function Centos_prepare()
{
if [[ ! -f /etc/redhat-release ]]; then
return 0;
fi
OS_IS_CENTOS=YES
echo "Centos detected, install tools if needed"
gcc --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
echo "install gcc"
require_sudoer "sudo yum install -y gcc"
sudo yum install -y gcc; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
echo "install gcc success"
fi
g++ --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
echo "install gcc-c++"
require_sudoer "sudo yum install -y gcc-c++"
sudo yum install -y gcc-c++; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
echo "install gcc-c++ success"
fi
make --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
echo "install make"
require_sudoer "sudo yum install -y make"
sudo yum install -y make; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
echo "install make success"
fi
patch --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
echo "install patch"
require_sudoer "sudo yum install -y patch"
sudo yum install -y patch; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
echo "install patch success"
fi
if [ $SRS_FFMPEG_TOOL = YES ]; then
automake --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
echo "install automake"
require_sudoer "sudo yum install -y automake"
sudo yum install -y automake; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
echo "install automake success"
fi
autoconf --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
echo "install autoconf"
require_sudoer "sudo yum install -y autoconf"
sudo yum install -y autoconf; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
echo "install autoconf success"
fi
libtool --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
echo "install libtool"
require_sudoer "sudo yum install -y libtool"
sudo yum install -y libtool; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
echo "install libtool success"
fi
if [[ ! -f /usr/include/pcre.h ]]; then
echo "install pcre-devel"
require_sudoer "sudo yum install -y pcre-devel"
sudo yum install -y pcre-devel; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
echo "install pcre-devel success"
fi
if [[ ! -f /usr/include/zlib.h ]]; then
echo "install zlib-devel"
require_sudoer "sudo yum install -y zlib-devel"
sudo yum install -y zlib-devel; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
echo "install zlib-devel success"
fi
fi
# for arm, install the cross build tool chain.
if [ $SRS_EMBEDED_CPU = YES ]; then
echo "embeded(arm/mips) is invalid for CentOS"
return 1
fi
echo "Centos install tools success"
return 0
}
Centos_prepare; ret=$?; if [[ 0 -ne $ret ]]; then echo "CentOS prepare failed, ret=$ret"; exit $ret; fi
#####################################################################################
# st-1.9
#####################################################################################
# check the arm flag file, if flag changed, need to rebuild the st.
_ST_MAKE=linux-debug
if [ $SRS_EMBEDED_CPU = YES ]; then
# ok, arm specified, if the flag filed does not exists, need to rebuild.
if [[ -f ${SRS_OBJS}/_flag.st.arm.tmp && -f ${SRS_OBJS}/st/libst.a ]]; then
echo "st-1.9t for arm is ok.";
else
# TODO: FIXME: patch the bug.
# patch st for arm, @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_SrsLinuxArm#st-arm-bug-fix
echo "build st-1.9t for arm";
(
rm -rf ${SRS_OBJS}/st-1.9 && cd ${SRS_OBJS} &&
unzip -q ../3rdparty/st-1.9.zip && cd st-1.9 &&
patch -p0 < ../../3rdparty/patches/1.st.arm.patch &&
make CC=${SrsArmCC} AR=${SrsArmAR} LD=${SrsArmLD} RANDLIB=${SrsArmRANDLIB} EXTRA_CFLAGS="-DMD_HAVE_EPOLL" ${_ST_MAKE} &&
cd .. && rm -rf st && ln -sf st-1.9/obj st &&
cd .. && touch ${SRS_OBJS}/_flag.st.arm.tmp
)
fi
else
if [[ ! -f ${SRS_OBJS}/_flag.st.arm.tmp && -f ${SRS_OBJS}/st/libst.a ]]; then
echo "st-1.9t is ok.";
else
echo "build st-1.9t";
(
rm -rf ${SRS_OBJS}/st-1.9 && cd ${SRS_OBJS} &&
unzip -q ../3rdparty/st-1.9.zip && cd st-1.9 &&
echo "we alaways patch the st, for we may build srs under arm directly" &&
echo "the 1.st.arm.patch is ok for x86 because it's only modify code under macro linux arm" &&
patch -p0 < ../../3rdparty/patches/1.st.arm.patch &&
make ${_ST_MAKE} &&
cd .. && rm -rf st && ln -sf st-1.9/obj st &&
cd .. && rm -f ${SRS_OBJS}/_flag.st.arm.tmp
)
fi
fi
# check status
ret=$?; if [[ $ret -ne 0 ]]; then echo "build st-1.9 failed, ret=$ret"; exit $ret; fi
if [ ! -f ${SRS_OBJS}/st/libst.a ]; then echo "build st-1.9 static lib failed."; exit -1; fi
#####################################################################################
# http-parser-2.1
#####################################################################################
# check the arm flag file, if flag changed, need to rebuild the st.
if [ $SRS_HTTP_PARSER = YES ]; then
# ok, arm specified, if the flag filed does not exists, need to rebuild.
if [ $SRS_EMBEDED_CPU = YES ]; then
if [[ -f ${SRS_OBJS}/_flag.st.hp.tmp && -f ${SRS_OBJS}/hp/http_parser.h && -f ${SRS_OBJS}/hp/libhttp_parser.a ]]; then
echo "http-parser-2.1 for arm is ok.";
else
echo "build http-parser-2.1 for arm";
(
rm -rf ${SRS_OBJS}/http-parser-2.1 && cd ${SRS_OBJS} && unzip -q ../3rdparty/http-parser-2.1.zip &&
cd http-parser-2.1 &&
sed -i "s/CPPFLAGS_FAST +=.*$/CPPFLAGS_FAST = \$\(CPPFLAGS_DEBUG\)/g" Makefile &&
sed -i "s/CFLAGS_FAST =.*$/CFLAGS_FAST = \$\(CFLAGS_DEBUG\)/g" Makefile &&
make CC=${SrsArmCC} AR=${SrsArmAR} package &&
cd .. && rm -rf hp && ln -sf http-parser-2.1 hp &&
cd .. && touch ${SRS_OBJS}/_flag.st.hp.tmp
)
fi
else
# arm not specified, if exists flag, need to rebuild for no-arm platform.
if [[ ! -f ${SRS_OBJS}/_flag.st.hp.tmp && -f ${SRS_OBJS}/hp/http_parser.h && -f ${SRS_OBJS}/hp/libhttp_parser.a ]]; then
echo "http-parser-2.1 is ok.";
else
echo "build http-parser-2.1";
(
rm -rf ${SRS_OBJS}/http-parser-2.1 && cd ${SRS_OBJS} && unzip -q ../3rdparty/http-parser-2.1.zip &&
cd http-parser-2.1 &&
sed -i "s/CPPFLAGS_FAST +=.*$/CPPFLAGS_FAST = \$\(CPPFLAGS_DEBUG\)/g" Makefile &&
sed -i "s/CFLAGS_FAST =.*$/CFLAGS_FAST = \$\(CFLAGS_DEBUG\)/g" Makefile &&
make package &&
cd .. && rm -rf hp && ln -sf http-parser-2.1 hp &&
cd .. && rm -f ${SRS_OBJS}/_flag.st.hp.tmp
)
fi
fi
# check status
ret=$?; if [[ $ret -ne 0 ]]; then echo "build http-parser-2.1 failed, ret=$ret"; exit $ret; fi
if [[ ! -f ${SRS_OBJS}/hp/http_parser.h ]]; then echo "build http-parser-2.1 failed"; exit -1; fi
if [[ ! -f ${SRS_OBJS}/hp/libhttp_parser.a ]]; then echo "build http-parser-2.1 failed"; exit -1; fi
fi
if [ $SRS_HTTP_PARSER = YES ]; then
echo "#define SRS_AUTO_HTTP_PARSER" >> $SRS_AUTO_HEADERS_H
else
echo "#undef SRS_AUTO_HTTP_PARSER" >> $SRS_AUTO_HEADERS_H
fi
if [ $SRS_HTTP_SERVER = YES ]; then
echo "#define SRS_AUTO_HTTP_SERVER" >> $SRS_AUTO_HEADERS_H
else
echo "#undef SRS_AUTO_HTTP_SERVER" >> $SRS_AUTO_HEADERS_H
fi
if [ $SRS_HTTP_API = YES ]; then
echo "#define SRS_AUTO_HTTP_API" >> $SRS_AUTO_HEADERS_H
else
echo "#undef SRS_AUTO_HTTP_API" >> $SRS_AUTO_HEADERS_H
fi
#####################################################################################
# nginx for HLS, nginx-1.5.0
#####################################################################################
function write_nginx_html5()
{
cat<<END > ${html_file}
<video width="640" height="360"
autoplay controls autobuffer
src="${hls_stream}"
type="application/vnd.apple.mpegurl">
</video>
END
}
# create the nginx dir, for http-server if not build nginx
mkdir -p ${SRS_OBJS}/nginx
# make nginx
__SRS_BUILD_NGINX=NO; if [ $SRS_EMBEDED_CPU = NO ]; then if [ $SRS_NGINX = YES ]; then __SRS_BUILD_NGINX=YES; fi fi
if [ $__SRS_BUILD_NGINX = YES ]; then
if [[ -f ${SRS_OBJS}/nginx/sbin/nginx ]]; then
echo "nginx-1.5.7 is ok.";
else
echo "build nginx-1.5.7";
(
rm -rf ${SRS_OBJS}/nginx-1.5.7 && cd ${SRS_OBJS} &&
unzip -q ../3rdparty/nginx-1.5.7.zip && cd nginx-1.5.7 &&
./configure --prefix=`pwd`/_release && make ${SRS_JOBS} && make install &&
cd .. && rm -rf nginx && ln -sf nginx-1.5.7/_release nginx
)
fi
# check status
ret=$?; if [[ $ret -ne 0 ]]; then echo "build nginx-1.5.7 failed, ret=$ret"; exit $ret; fi
if [ ! -f ${SRS_OBJS}/nginx/sbin/nginx ]; then echo "build nginx-1.5.7 failed."; exit -1; fi
# use current user to config nginx,
# srs will write ts/m3u8 file use current user,
# nginx default use nobody, so cannot read the ts/m3u8 created by srs.
cp ${SRS_OBJS}/nginx/conf/nginx.conf ${SRS_OBJS}/nginx/conf/nginx.conf.bk
sed -i "s/^.user nobody;/user `whoami`;/g" ${SRS_OBJS}/nginx/conf/nginx.conf
fi
# create forward dir
mkdir -p ${SRS_OBJS}/nginx/html/live &&
mkdir -p ${SRS_OBJS}/nginx/html/forward/live
# generate default html pages for android.
html_file=${SRS_OBJS}/nginx/html/live/demo.html && hls_stream=demo.m3u8 && write_nginx_html5
html_file=${SRS_OBJS}/nginx/html/live/livestream.html && hls_stream=livestream.m3u8 && write_nginx_html5
html_file=${SRS_OBJS}/nginx/html/live/livestream_ld.html && hls_stream=livestream_ld.m3u8 && write_nginx_html5
html_file=${SRS_OBJS}/nginx/html/live/livestream_sd.html && hls_stream=livestream_sd.m3u8 && write_nginx_html5
html_file=${SRS_OBJS}/nginx/html/forward/live/livestream.html && hls_stream=livestream.m3u8 && write_nginx_html5
html_file=${SRS_OBJS}/nginx/html/forward/live/livestream_ld.html && hls_stream=livestream_ld.m3u8 && write_nginx_html5
html_file=${SRS_OBJS}/nginx/html/forward/live/livestream_sd.html && hls_stream=livestream_sd.m3u8 && write_nginx_html5
# copy players to nginx html dir.
rm -rf ${SRS_OBJS}/nginx/html/players &&
ln -sf `pwd`/research/players ${SRS_OBJS}/nginx/html/players &&
rm -f ${SRS_OBJS}/nginx/crossdomain.xml &&
ln -sf `pwd`/research/players/crossdomain.xml ${SRS_OBJS}/nginx/html/crossdomain.xml
# for favicon.ico
rm -rf ${SRS_OBJS}/nginx/html/favicon.ico &&
ln -sf `pwd`/research/api-server/static-dir/favicon.ico ${SRS_OBJS}/nginx/html/favicon.ico
# nginx.html to detect whether nginx is alive
echo "nginx is ok" > ${SRS_OBJS}/nginx/html/nginx.html
if [ $SRS_NGINX = YES ]; then
echo "#define SRS_AUTO_NGINX" >> $SRS_AUTO_HEADERS_H
else
echo "#undef SRS_AUTO_NGINX" >> $SRS_AUTO_HEADERS_H
fi
if [ $SRS_DVR = YES ]; then
echo "#define SRS_AUTO_DVR" >> $SRS_AUTO_HEADERS_H
else
echo "#undef SRS_AUTO_DVR" >> $SRS_AUTO_HEADERS_H
fi
if [ $SRS_HLS = YES ]; then
echo "#define SRS_AUTO_HLS" >> $SRS_AUTO_HEADERS_H
else
echo "#undef SRS_AUTO_HLS" >> $SRS_AUTO_HEADERS_H
fi
#####################################################################################
# cherrypy for http hooks callback, CherryPy-3.2.4
#####################################################################################
if [ $SRS_HTTP_CALLBACK = YES ]; then
if [[ -f ${SRS_OBJS}/CherryPy-3.2.4/setup.py ]]; then
echo "CherryPy-3.2.4 is ok.";
else
require_sudoer "configure --with-http-callback"
echo "install CherryPy-3.2.4";
(
sudo rm -rf ${SRS_OBJS}/CherryPy-3.2.4 && cd ${SRS_OBJS} &&
unzip -q ../3rdparty/CherryPy-3.2.4.zip && cd CherryPy-3.2.4 &&
sudo python setup.py install
)
fi
# check status
ret=$?; if [[ $ret -ne 0 ]]; then echo "build CherryPy-3.2.4 failed, ret=$ret"; exit $ret; fi
if [ ! -f ${SRS_OBJS}/CherryPy-3.2.4/setup.py ]; then echo "build CherryPy-3.2.4 failed."; exit -1; fi
fi
if [ $SRS_HTTP_CALLBACK = YES ]; then
echo "#define SRS_AUTO_HTTP_CALLBACK" >> $SRS_AUTO_HEADERS_H
else
echo "#undef SRS_AUTO_HTTP_CALLBACK" >> $SRS_AUTO_HEADERS_H
fi
echo "link players to cherrypy static-dir"
rm -rf research/api-server/static-dir/players &&
ln -sf `pwd`/research/players research/api-server/static-dir/players &&
rm -f research/api-server/static-dir/crossdomain.xml &&
ln -sf `pwd`/research/players/crossdomain.xml research/api-server/static-dir/crossdomain.xml &&
rm -rf research/api-server/static-dir/live &&
mkdir -p `pwd`/${SRS_OBJS}/nginx/html/live &&
ln -sf `pwd`/${SRS_OBJS}/nginx/html/live research/api-server/static-dir/live &&
rm -rf research/api-server/static-dir/forward &&
mkdir -p `pwd`/${SRS_OBJS}/nginx/html/forward &&
ln -sf `pwd`/${SRS_OBJS}/nginx/html/forward research/api-server/static-dir/forward
ret=$?; if [[ $ret -ne 0 ]]; then echo "link players to cherrypy static-dir failed, ret=$ret"; exit $ret; fi
#####################################################################################
# generate demo index.html
#####################################################################################
# if nginx enalbed, generate nginx index file.
if [ $__SRS_BUILD_NGINX = YES ]; then
rm -f ${SRS_OBJS}/nginx/html/index.html &&
ln -sf `pwd`/research/players/nginx_index.html ${SRS_OBJS}/nginx/html/index.html
fi
# if http-server enalbed, use srs embeded http-server
if [ $SRS_HTTP_SERVER = YES ]; then
rm -f ${SRS_OBJS}/nginx/html/index.html &&
ln -sf `pwd`/research/players/srs-http-server_index.html ${SRS_OBJS}/nginx/html/index.html
fi
# if api-server enabled, generate for api server.
if [ $SRS_HTTP_CALLBACK = YES ]; then
rm -f ${SRS_OBJS}/nginx/html/index.html &&
ln -sf `pwd`/research/players/api-server_index.html ${SRS_OBJS}/nginx/html/index.html
fi
#####################################################################################
# openssl, for rtmp complex handshake
#####################################################################################
# extra configure options
CONFIGURE_TOOL="./config"
EXTRA_CONFIGURE=""
if [ $SRS_EMBEDED_CPU = YES ]; then
CONFIGURE_TOOL="./Configure"
fi
# @see http://www.openssl.org/news/secadv_20140407.txt
# Affected users should upgrade to OpenSSL 1.0.1g. Users unable to immediately
# upgrade can alternatively recompile OpenSSL with -DOPENSSL_NO_HEARTBEATS.
if [ $SRS_SSL = YES ]; then
if [ $SRS_USE_SYS_SSL = YES ]; then
echo "warning: donot compile ssl, use system ssl"
else
# check the arm flag file, if flag changed, need to rebuild the st.
if [ $SRS_EMBEDED_CPU = YES ]; then
# ok, arm specified, if the flag filed does not exists, need to rebuild.
if [[ -f ${SRS_OBJS}/_flag.ssl.arm.tmp && -f ${SRS_OBJS}/openssl/lib/libssl.a ]]; then
echo "openssl-1.0.1f for arm is ok.";
else
echo "build openssl-1.0.1f for arm";
(
rm -rf ${SRS_OBJS}/openssl-1.0.1f && cd ${SRS_OBJS} &&
unzip -q ../3rdparty/openssl-1.0.1f.zip && cd openssl-1.0.1f &&
$CONFIGURE_TOOL --prefix=`pwd`/_release -no-shared no-asm linux-armv4 -DOPENSSL_NO_HEARTBEATS ${EXTRA_CONFIGURE} &&
make CC=${SrsArmCC} GCC=${SrsArmGCC} AR="${SrsArmAR} r" \
LD=${SrsArmLD} LINK=${SrsArmGCC} RANDLIB=${SrsArmRANDLIB} &&
make install_sw &&
cd .. && rm -rf openssl && ln -sf openssl-1.0.1f/_release openssl &&
cd .. && touch ${SRS_OBJS}/_flag.ssl.arm.tmp
)
fi
else
# arm not specified, if exists flag, need to rebuild for no-arm platform.
if [[ ! -f ${SRS_OBJS}/_flag.ssl.arm.tmp && -f ${SRS_OBJS}/openssl/lib/libssl.a ]]; then
echo "openssl-1.0.1f is ok.";
else
echo "build openssl-1.0.1f";
(
rm -rf ${SRS_OBJS}/openssl-1.0.1f && cd ${SRS_OBJS} &&
unzip -q ../3rdparty/openssl-1.0.1f.zip && cd openssl-1.0.1f &&
$CONFIGURE_TOOL --prefix=`pwd`/_release -no-shared -DOPENSSL_NO_HEARTBEATS ${EXTRA_CONFIGURE} &&
make && make install_sw &&
cd .. && rm -rf openssl && ln -sf openssl-1.0.1f/_release openssl &&
cd .. && rm -f ${SRS_OBJS}/_flag.ssl.arm.tmp
)
fi
fi
# check status
ret=$?; if [[ $ret -ne 0 ]]; then echo "build openssl-1.0.1f failed, ret=$ret"; exit $ret; fi
if [ ! -f ${SRS_OBJS}/openssl/lib/libssl.a ]; then echo "build openssl-1.0.1f failed."; exit -1; fi
fi
fi
if [ $SRS_SSL = YES ]; then
echo "#define SRS_AUTO_SSL" >> $SRS_AUTO_HEADERS_H
else
echo "#undef SRS_AUTO_SSL" >> $SRS_AUTO_HEADERS_H
fi
#####################################################################################
# live transcoding, ffmpeg-2.1, x264-core138, lame-3.99.5, libaacplus-2.0.2.
#####################################################################################
if [ $SRS_FFMPEG_TOOL = YES ]; then
if [[ -f ${SRS_OBJS}/ffmpeg/bin/ffmpeg ]]; then
echo "ffmpeg-2.1 is ok.";
else
echo "build ffmpeg-2.1";
(
cd ${SRS_OBJS} && pwd_dir=`pwd` &&
rm -rf ffmepg.src && mkdir -p ffmpeg.src && cd ffmpeg.src &&
rm -f build_ffmpeg.sh && ln -sf ../../auto/build_ffmpeg.sh && . build_ffmpeg.sh &&
cd ${pwd_dir} && rm -rf ffmpeg && ln -sf ffmpeg.src/_release ffmpeg
)
fi
# check status
ret=$?; if [[ $ret -ne 0 ]]; then echo "build ffmpeg-2.1 failed, ret=$ret"; exit $ret; fi
if [ ! -f ${SRS_OBJS}/ffmpeg/bin/ffmpeg ]; then echo "build ffmpeg-2.1 failed."; exit -1; fi
fi
# whether compile ffmpeg tool
if [ $SRS_FFMPEG_TOOL = YES ]; then
echo "#define SRS_AUTO_FFMPEG_TOOL" >> $SRS_AUTO_HEADERS_H
else
echo "#undef SRS_AUTO_FFMPEG_TOOL" >> $SRS_AUTO_HEADERS_H
fi
# whatever the FFMPEG tools, if transcode and ingest specified,
# srs always compile the FFMPEG tool stub which used to start the FFMPEG process.
if [ $SRS_FFMPEG_STUB = YES ]; then
echo "#define SRS_AUTO_FFMPEG_STUB" >> $SRS_AUTO_HEADERS_H
else
echo "#undef SRS_AUTO_FFMPEG_STUB" >> $SRS_AUTO_HEADERS_H
fi
if [ $SRS_TRANSCODE = YES ]; then
echo "#define SRS_AUTO_TRANSCODE" >> $SRS_AUTO_HEADERS_H
else
echo "#undef SRS_AUTO_TRANSCODE" >> $SRS_AUTO_HEADERS_H
fi
if [ $SRS_INGEST = YES ]; then
echo "#define SRS_AUTO_INGEST" >> $SRS_AUTO_HEADERS_H
else
echo "#undef SRS_AUTO_INGEST" >> $SRS_AUTO_HEADERS_H
fi
# for statistic.
if [ $SRS_STAT = YES ]; then
echo "#define SRS_AUTO_STAT" >> $SRS_AUTO_HEADERS_H
else
echo "#undef SRS_AUTO_STAT" >> $SRS_AUTO_HEADERS_H
fi
#####################################################################################
# build research code, librtmp
#####################################################################################
if [ $SRS_RESEARCH = YES ]; then
mkdir -p ${SRS_OBJS}/research
(cd research/hls && make ${SRS_JOBS} && mv ts_info ../../${SRS_OBJS}/research)
ret=$?; if [[ $ret -ne 0 ]]; then echo "build research/hls failed, ret=$ret"; exit $ret; fi
(cd research/ffempty && make ${SRS_JOBS} && mv ffempty ../../${SRS_OBJS}/research)
ret=$?; if [[ $ret -ne 0 ]]; then echo "build research/ffempty failed, ret=$ret"; exit $ret; fi
fi
if [ $SRS_LIBRTMP = YES ]; then
mkdir -p ${SRS_OBJS}/research
# librtmp
(cd research/librtmp && mkdir -p objs && ln -sf `pwd`/objs ../../${SRS_OBJS}/research/librtmp)
ret=$?; if [[ $ret -ne 0 ]]; then echo "link research/librtmp failed, ret=$ret"; exit $ret; fi
fi
#####################################################################################
# build utest code
#####################################################################################
if [ $SRS_UTEST = YES ]; then
if [[ -f ${SRS_OBJS}/gtest/include/gtest/gtest.h ]]; then
echo "gtest-1.6.0 is ok.";
else
echo "build gtest-1.6.0";
(
rm -rf ${SRS_OBJS}/gtest-1.6.0 && cd ${SRS_OBJS} &&
unzip -q ../3rdparty/gtest-1.6.0.zip &&
rm -rf gtest && ln -sf gtest-1.6.0 gtest
)
fi
# check status
ret=$?; if [[ $ret -ne 0 ]]; then echo "build gtest-1.6.0 failed, ret=$ret"; exit $ret; fi
if [ ! -f ${SRS_OBJS}/gtest/include/gtest/gtest.h ]; then echo "build gtest-1.6.0 failed."; exit -1; fi
fi
#####################################################################################
# build gperf code
#####################################################################################
if [ $SRS_GPERF = YES ]; then
if [[ -f ${SRS_OBJS}/gperf/bin/pprof ]]; then
echo "gperftools-2.1 is ok.";
else
echo "build gperftools-2.1";
(
rm -rf ${SRS_OBJS}/gperftools-2.1 && cd ${SRS_OBJS} &&
unzip -q ../3rdparty/gperftools-2.1.zip && cd gperftools-2.1 &&
./configure --prefix=`pwd`/_release --enable-frame-pointers && make ${SRS_JOBS} && make install &&
cd .. && rm -rf gperf && ln -sf gperftools-2.1/_release gperf &&
rm -rf pprof && ln -sf gperf/bin/pprof pprof
)
fi
# check status
ret=$?; if [[ $ret -ne 0 ]]; then echo "build gperftools-2.1 failed, ret=$ret"; exit $ret; fi
if [ ! -f ${SRS_OBJS}/gperf/bin/pprof ]; then echo "build gperftools-2.1 failed."; exit -1; fi
fi
if [ $SRS_GPERF = YES ]; then
echo "#define SRS_AUTO_GPERF" >> $SRS_AUTO_HEADERS_H
else
echo "#undef SRS_AUTO_GPERF" >> $SRS_AUTO_HEADERS_H
fi
if [ $SRS_GPERF_MC = YES ]; then
echo "#define SRS_AUTO_GPERF_MC" >> $SRS_AUTO_HEADERS_H
else
echo "#undef SRS_AUTO_GPERF_MC" >> $SRS_AUTO_HEADERS_H
fi
if [ $SRS_GPERF_MP = YES ]; then
echo "#define SRS_AUTO_GPERF_MP" >> $SRS_AUTO_HEADERS_H
else
echo "#undef SRS_AUTO_GPERF_MP" >> $SRS_AUTO_HEADERS_H
fi
if [ $SRS_GPERF_CP = YES ]; then
echo "#define SRS_AUTO_GPERF_CP" >> $SRS_AUTO_HEADERS_H
else
echo "#undef SRS_AUTO_GPERF_CP" >> $SRS_AUTO_HEADERS_H
fi
#####################################################################################
# for embeded.
#####################################################################################
if [ $SRS_EMBEDED_CPU = YES ]; then
echo "#define SRS_AUTO_EMBEDED_CPU" >> $SRS_AUTO_HEADERS_H
else
echo "#undef SRS_AUTO_EMBEDED_CPU" >> $SRS_AUTO_HEADERS_H
fi
# arm
if [ $SRS_ARM_UBUNTU12 = YES ]; then
echo "#define SRS_AUTO_ARM_UBUNTU12" >> $SRS_AUTO_HEADERS_H
else
echo "#undef SRS_AUTO_ARM_UBUNTU12" >> $SRS_AUTO_HEADERS_H
fi
# mips
if [ $SRS_MIPS_UBUNTU12 = YES ]; then
echo "#define SRS_AUTO_MIPS_UBUNTU12" >> $SRS_AUTO_HEADERS_H
else
echo "#undef SRS_AUTO_MIPS_UBUNTU12" >> $SRS_AUTO_HEADERS_H
fi
echo "" >> $SRS_AUTO_HEADERS_H
# for log level compile settings
if [ $SRS_LOG_VERBOSE = YES ]; then
echo "#define SRS_AUTO_VERBOSE" >> $SRS_AUTO_HEADERS_H
else
echo "#undef SRS_AUTO_VERBOSE" >> $SRS_AUTO_HEADERS_H
fi
if [ $SRS_LOG_INFO = YES ]; then
echo "#define SRS_AUTO_INFO" >> $SRS_AUTO_HEADERS_H
else
echo "#undef SRS_AUTO_INFO" >> $SRS_AUTO_HEADERS_H
fi
if [ $SRS_LOG_TRACE = YES ]; then
echo "#define SRS_AUTO_TRACE" >> $SRS_AUTO_HEADERS_H
else
echo "#undef SRS_AUTO_TRACE" >> $SRS_AUTO_HEADERS_H
fi
# prefix
echo "" >> $SRS_AUTO_HEADERS_H
echo "#define SRS_AUTO_PREFIX \"${SRS_PREFIX}\"" >> $SRS_AUTO_HEADERS_H
echo "" >> $SRS_AUTO_HEADERS_H
#####################################################################################
# generated the contributors from AUTHORS.txt
#####################################################################################
SRS_CONSTRIBUTORS=`cat ../AUTHORS.txt|grep "*"|awk '{print $2}'`
echo "#define SRS_AUTO_CONSTRIBUTORS \"\\" >> $SRS_AUTO_HEADERS_H
for CONTRIBUTOR in $SRS_CONSTRIBUTORS; do
echo "${CONTRIBUTOR} \\" >> $SRS_AUTO_HEADERS_H
done
echo "\"" >> $SRS_AUTO_HEADERS_H
# new empty line to auto headers file.
echo "" >> $SRS_AUTO_HEADERS_H
#####################################################################################
# generated the test script
#####################################################################################
rm -rf ${SRS_OBJS}/srs.test && ln -sf `pwd`/scripts/srs.test objs/srs.test

@ -0,0 +1,8 @@
#!/bin/bash
# genereate the library header file.
objs=$1
rm -f $objs/include/srs_librtmp.h &&
cp $objs/../src/libs/srs_librtmp.hpp $objs/include/srs_librtmp.h
echo "genereate srs-librtmp headers success"

@ -0,0 +1,62 @@
# generate the library for static link.
#
# params:
# $SRS_OBJS the objs directory. ie. objs
# $SRS_MAKEFILE the makefile name. ie. Makefile
#
# $BUILD_KEY a string indicates the build key for Makefile. ie. dump
# $LIB_NAME the app name to output. ie. smart_server
# $MODULE_OBJS array, the objects to compile the app.
FILE=${SRS_OBJS}/${SRS_MAKEFILE}
LIB_TARGET="${SRS_OBJS}/${LIB_NAME}"
LIB_TAGET_STATIC="${LIB_TARGET}.a"
echo "generate lib ${LIB_NAME} depends..."
echo "" >> ${FILE}
echo "# archive library ${LIB_TAGET_STATIC}" >> ${FILE}
echo "${BUILD_KEY}: ${LIB_TAGET_STATIC}" >> ${FILE}
# build depends
echo -n "${LIB_TAGET_STATIC}: " >> ${FILE}
for item in ${MODULE_OBJS[*]}; do
FILE_NAME=`basename $item`
FILE_NAME=${FILE_NAME%.*}
if [ ! -f ${item} ]; then
continue;
fi
OBJ_FILE=${SRS_OBJS}/$item
OBJ_FILE="${OBJ_FILE%.*}.o"
echo -n "${OBJ_FILE} " >> ${FILE}
done
echo "" >> ${FILE}
# build header file
echo -n " @bash auto/generate_header.sh ${SRS_OBJS}" >> ${FILE}
echo "" >> ${FILE}
# archive librtmp.a
echo -n " \$(AR) -rs ${LIB_TAGET_STATIC} " >> ${FILE}
for item in ${MODULE_OBJS[*]}; do
FILE_NAME=`basename $item`
FILE_NAME=${FILE_NAME%.*}
if [ ! -f ${item} ]; then
continue;
fi
OBJ_FILE=${SRS_OBJS}/$item
OBJ_FILE="${OBJ_FILE%.*}.o"
echo -n "${OBJ_FILE} " >> ${FILE}
done
echo "" >> ${FILE}
# parent Makefile, to create module output dir before compile it.
echo " mkdir -p ${SRS_OBJS}/include" >> ${SRS_MAKEFILE}
echo " mkdir -p ${SRS_OBJS}/lib" >> ${SRS_MAKEFILE}
echo -n "generate lib ${LIB_NAME} ok"; echo '!';

@ -0,0 +1,6 @@
ip=`ifconfig 2>&1|grep 'inet addr'|grep -v '127.0.0.1'|awk 'NR==1 {print $2}'|awk -F ':' '{print $2}'`
if [[ -z $ip ]]; then
echo "127.0.0.1"
else
echo $ip
fi

@ -0,0 +1,89 @@
# generate the module info to Makefile
#
# params:
# $SRS_OBJS the objs directory. ie. objs
# $SRS_MAKEFILE the makefile name. ie. Makefile
#
# $MODULE_DIR the module dir. ie. src/os/linux
# $MODULE_ID the id of module. ie. CORE
# $MODULE_DEPENDS array, the denpend MODULEs id. ie. (CORE OS)
# $ModuleLibIncs array, the depend 3rdpart library includes. ie. (objs/st-1.9/obj objs/libx264/obj)
# $MODULE_FILES array, the head/cpp files of modules. ie. (public log)
#
# returns:
# $MODULE_OBJS array, the objects of the modules, used for link the binary
FILE=${SRS_OBJS}/${SRS_MAKEFILE}
echo "#####################################################################################" >> ${FILE}
echo "# the ${MODULE_ID} module." >> ${FILE}
echo "#####################################################################################" >> ${FILE}
echo >> ${FILE}
# INCS
echo "# INCS for ${MODULE_ID}, headers of module and its depends to compile" >> ${FILE}
#
# the public include files, for example:
# CORE_MODULE_INCS = -Isrc/core
echo "${MODULE_ID}_MODULE_INCS = -I${MODULE_DIR} " >> ${FILE}
#
# the private include files, for example:
# CORE_INCS = -Isrc/core -Iobjs/st -Iobjs -Iobjs/hp -Iobjs
# MAIN_INCS = -Isrc/main $(CORE_MODULE_INCS) -Iobjs/st -Iobjs
# where the public will be used for other modules which depends on it.
INCS_NAME="${MODULE_ID}_INCS"
#
# current module header files
echo -n "${INCS_NAME} = -I${MODULE_DIR} " >> ${FILE}
#
# depends module header files
for item in ${MODULE_DEPENDS[*]}; do
DEP_INCS_NAME="${item}_INCS"do
DEP_INCS_NAME="${item}_MODULE_INCS"
echo -n "\$(${DEP_INCS_NAME}) " >> ${FILE}
done
#
# depends library header files
for item in ${ModuleLibIncs[*]}; do
echo -n "-I${item} " >> ${FILE}
done
echo "" >> ${FILE}; echo "" >> ${FILE}
# DEPS
echo "# DEPS for ${MODULE_ID}, the depends of make schema" >> ${FILE}
# depends on headers of self module, for example:
# CORE_DEPS = src/core/srs_core.hpp
DEPS_NAME="${MODULE_ID}_DEPS"
echo -n "${DEPS_NAME} = " >> ${FILE}
for item in ${MODULE_FILES[*]}; do
HEADER_FILE="${MODULE_DIR}/${item}.hpp"
if [ -f ${HEADER_FILE} ]; then
echo -n " ${HEADER_FILE}" >> ${FILE}
fi
done
# depends on other modules, for example:
# MAIN_DEPS = $(CORE_DEPS)
for item in ${MODULE_DEPENDS[*]}; do
DEP_DEPS_NAME="${item}_DEPS"
echo -n " \$(${DEP_DEPS_NAME}) " >> ${FILE}
done
echo "" >> ${FILE}; echo "" >> ${FILE}
# OBJ
echo "# OBJ for ${MODULE_ID}, each object file" >> ${FILE}
MODULE_OBJS=()
for item in ${MODULE_FILES[*]}; do
CPP_FILE="${MODULE_DIR}/${item}.cpp"
OBJ_FILE="${SRS_OBJS}/${MODULE_DIR}/${item}.o"
MODULE_OBJS="${MODULE_OBJS[@]} ${CPP_FILE}"
if [ -f ${CPP_FILE} ]; then
echo "${OBJ_FILE}: \$(${DEPS_NAME}) ${CPP_FILE} " >> ${FILE}
echo " \$(CXX) -c \$(CXXFLAGS) \$(${INCS_NAME})\\" >> ${FILE}
echo " -o ${OBJ_FILE} ${CPP_FILE}" >> ${FILE}
fi
done
echo "" >> ${FILE}
# parent Makefile, to create module output dir before compile it.
echo " mkdir -p ${SRS_OBJS}/${MODULE_DIR}" >> ${SRS_MAKEFILE}
echo -n "generate module ${MODULE_ID} ok"; echo '!';

@ -0,0 +1,809 @@
#!/bin/bash
# variables, parent script must set it:
#####################################################################################
#####################################################################################
# parse user options, do this at first
#####################################################################################
#####################################################################################
#####################################################################################
# output variables
#####################################################################################
help=no
################################################################
# feature options
SRS_HLS=RESERVED
SRS_DVR=RESERVED
SRS_NGINX=RESERVED
SRS_SSL=RESERVED
SRS_FFMPEG_TOOL=RESERVED
SRS_TRANSCODE=RESERVED
SRS_INGEST=RESERVED
SRS_STAT=RESERVED
SRS_HTTP_CALLBACK=RESERVED
SRS_HTTP_SERVER=RESERVED
SRS_HTTP_API=RESERVED
SRS_LIBRTMP=RESERVED
SRS_RESEARCH=RESERVED
SRS_UTEST=RESERVED
# tcmalloc
SRS_GPERF=RESERVED
# gperf memory check
SRS_GPERF_MC=RESERVED
# gperf memory profile
SRS_GPERF_MP=RESERVED
# gperf cpu profile
SRS_GPERF_CP=RESERVED
# gprof
SRS_GPROF=RESERVED
#
################################################################
# libraries
SRS_FFMPEG_STUB=RESERVED
SRS_HTTP_PARSER=RESERVED
# arguments
SRS_PREFIX=/usr/local/srs
SRS_JOBS=1
SRS_STATIC=RESERVED
# whether enable the log verbose/info/trace level.
# always enable the warn/error level.
SRS_LOG_VERBOSE=RESERVED
SRS_LOG_INFO=RESERVED
SRS_LOG_TRACE=RESERVED
#
################################################################
# experts
# donot compile ssl, use system ssl(-lssl) if required.
SRS_USE_SYS_SSL=NO
#
################################################################
# presets
# for x86/x64 pc/servers
SRS_X86_X64=NO
# armhf(v7cpu) built on ubuntu12
SRS_ARM_UBUNTU12=NO
# mips built on ubuntu12
SRS_MIPS_UBUNTU12=NO
# dev, open all features for dev, no gperf/prof/arm.
SRS_DEV=NO
# dev, open main server feature for dev, no utest/research/librtmp
SRS_FAST_DEV=NO
# demo, for the demo of srs, @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_SampleDemo
SRS_DEMO=NO
# raspberry-pi, open hls/ssl/static
SRS_PI=NO
# cubieboard, donot open ffmpeg/nginx.
SRS_CUBIE=NO
# the most fast compile, nothing, only support vp6 RTMP.
SRS_FAST=NO
# only support RTMP with ssl.
SRS_PURE_RTMP=NO
# only support RTMP+HLS with ssl.
SRS_RTMP_HLS=NO
# the most fast compile, nothing, only support vp6 RTMP.
SRS_DISABLE_ALL=NO
# all features is on
SRS_ENABLE_ALL=NO
#
################################################################
# calc
# whether embed cpu, arm/mips
SRS_EMBEDED_CPU=NO
#####################################################################################
# menu
#####################################################################################
function show_help() {
cat << END
Options:
-h, --help print this message
--with-ssl enable rtmp complex handshake, requires openssl-devel installed.
to delivery h264 video and aac audio to flash player.
--with-hls enable hls streaming, mux RTMP to m3u8/ts files.
--with-dvr enable dvr, mux RTMP to flv files.
--with-nginx enable delivery HTTP stream with nginx.
build nginx at: ./objs/nginx/sbin/nginx
--with-http-callback enable http hooks, build cherrypy as demo api server.
--with-http-server enable http server to delivery http stream.
--with-http-api enable http api, to manage SRS by http api.
--with-ffmpeg enable transcoding tool ffmpeg.
build ffmpeg at: ./objs/ffmpeg/bin/ffmpeg
--with-transcode enable transcoding features.
user must specifies the transcode tools in conf.
--with-ingest enable ingest features.
user must specifies the ingest tools in conf.
--with-stat enable the data statistic, for http api.
--with-librtmp enable srs-librtmp, library for client.
--with-research build the research tools.
--with-utest build the utest for SRS.
--with-gperf build SRS with gperf tools(no gmc/gmp/gcp, with tcmalloc only).
--with-gmc build memory check for SRS with gperf tools.
--with-gmp build memory profile for SRS with gperf tools.
--with-gcp build cpu profile for SRS with gperf tools.
--with-gprof build SRS with gprof(GNU profile tool).
--with-arm-ubuntu12 build SRS on ubuntu12 for armhf(v7cpu).
--without-ssl disable rtmp complex handshake.
--without-hls disable hls, rtmp streaming only.
--without-dvr disable dvr, donot support record RTMP stream to flv.
--without-nginx disable delivery HTTP stream with nginx.
--without-http-callback disable http, http hooks callback.
--without-http-server disable http server, use external server to delivery http stream.
--without-http-api disable http api, only use console to manage SRS process.
--without-ffmpeg disable the ffmpeg transcode tool feature.
--without-transcode disable the transcoding feature.
--without-ingest disable the ingest feature.
--without-stat disable the data statistic feature.
--without-librtmp disable srs-librtmp, library for client.
--without-research do not build the research tools.
--without-utest do not build the utest for SRS.
--without-gperf do not build SRS with gperf tools(without tcmalloc and gmc/gmp/gcp).
--without-gmc do not build memory check for SRS with gperf tools.
--without-gmp do not build memory profile for SRS with gperf tools.
--without-gcp do not build cpu profile for SRS with gperf tools.
--without-gprof do not build srs with gprof(GNU profile tool).
--without-arm-ubuntu12 do not build srs on ubuntu12 for armhf(v7cpu).
--prefix=<path> the absolute install path for srs.
--static whether add '-static' to link options.
--jobs[=N] Allow N jobs at once; infinite jobs with no arg.
used for make in the configure, for example, to make ffmpeg.
--log-verbose whether enable the log verbose level. default: no.
--log-info whether enable the log info level. default: no.
--log-trace whether enable the log trace level. default: yes.
Presets:
--x86-x64 [default] for x86/x64 cpu, common pc and servers.
--pi for raspberry-pi(directly build), open features hls/ssl/static.
--cubie for cubieboard(directly build), open features except ffmpeg/nginx.
--arm alias for --with-arm-ubuntu12, for ubuntu12, arm crossbuild
--mips alias for --with-mips-ubuntu12, for ubuntu12, mips crossbuild
--fast the most fast compile, nothing, only support vp6 RTMP.
--pure-rtmp only support RTMP with ssl.
--rtmp-hls only support RTMP+HLS with ssl.
--disable-all disable all features, only support vp6 RTMP.
--dev for dev, open all features, no nginx/gperf/gprof/arm.
--fast-dev for dev fast compile, the RTMP server, without librtmp/utest/research.
--demo for srs demo, @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_SampleDemo
--full enable all features, no gperf/gprof/arm.
Conflicts:
1. --with-gmc vs --with-gmp:
@see: http://google-perftools.googlecode.com/svn/trunk/doc/heap_checker.html
2. --with-gperf/gmc/gmp vs --with-gprof:
gperftools not compatible with gprof.
3. --arm vs --with-ffmpeg/gperf/gmc/gmp/gprof:
the complex tools not available for arm.
Experts:
--use-sys-ssl donot compile ssl, use system ssl(-lssl) if required.
Workflow:
1. apply "Presets". if not specified, use default preset.
2. apply "Options". user specified option will override the preset.
3. check conflicts. @see Conflicts section.
4. generate detail features.
END
}
function parse_user_option() {
case "$option" in
-h) help=yes ;;
--help) help=yes ;;
--with-ssl) SRS_SSL=YES ;;
--with-hls) SRS_HLS=YES ;;
--with-dvr) SRS_DVR=YES ;;
--with-nginx) SRS_NGINX=YES ;;
--with-ffmpeg) SRS_FFMPEG_TOOL=YES ;;
--with-transcode) SRS_TRANSCODE=YES ;;
--with-ingest) SRS_INGEST=YES ;;
--with-stat) SRS_STAT=YES ;;
--with-http-callback) SRS_HTTP_CALLBACK=YES ;;
--with-http-server) SRS_HTTP_SERVER=YES ;;
--with-http-api) SRS_HTTP_API=YES ;;
--with-librtmp) SRS_LIBRTMP=YES ;;
--with-research) SRS_RESEARCH=YES ;;
--with-utest) SRS_UTEST=YES ;;
--with-gperf) SRS_GPERF=YES ;;
--with-gmc) SRS_GPERF_MC=YES ;;
--with-gmp) SRS_GPERF_MP=YES ;;
--with-gcp) SRS_GPERF_CP=YES ;;
--with-gprof) SRS_GPROF=YES ;;
--with-arm-ubuntu12) SRS_ARM_UBUNTU12=YES ;;
--with-mips-ubuntu12) SRS_MIPS_UBUNTU12=YES ;;
--without-ssl) SRS_SSL=NO ;;
--without-hls) SRS_HLS=NO ;;
--without-dvr) SRS_DVR=NO ;;
--without-nginx) SRS_NGINX=NO ;;
--without-ffmpeg) SRS_FFMPEG_TOOL=NO ;;
--without-transcode) SRS_TRANSCODE=NO ;;
--without-ingest) SRS_INGEST=NO ;;
--without-stat) SRS_STAT=NO ;;
--without-http-callback) SRS_HTTP_CALLBACK=NO ;;
--without-http-server) SRS_HTTP_SERVER=NO ;;
--without-http-api) SRS_HTTP_API=NO ;;
--without-librtmp) SRS_LIBRTMP=NO ;;
--without-research) SRS_RESEARCH=NO ;;
--without-utest) SRS_UTEST=NO ;;
--without-gperf) SRS_GPERF=NO ;;
--without-gmc) SRS_GPERF_MC=NO ;;
--without-gmp) SRS_GPERF_MP=NO ;;
--without-gcp) SRS_GPERF_CP=NO ;;
--without-gprof) SRS_GPROF=NO ;;
--without-arm-ubuntu12) SRS_ARM_UBUNTU12=NO ;;
--without-mips-ubuntu12) SRS_MIPS_UBUNTU12=NO ;;
--jobs) SRS_JOBS=${value} ;;
--prefix) SRS_PREFIX=${value} ;;
--static) SRS_STATIC=YES ;;
--log-verbose) SRS_LOG_VERBOSE=YES ;;
--log-info) SRS_LOG_INFO=YES ;;
--log-trace) SRS_LOG_TRACE=YES ;;
--x86-x64) SRS_X86_X64=YES ;;
--arm) SRS_ARM_UBUNTU12=YES ;;
--mips) SRS_MIPS_UBUNTU12=YES ;;
--pi) SRS_PI=YES ;;
--cubie) SRS_CUBIE=YES ;;
--dev) SRS_DEV=YES ;;
--fast-dev) SRS_FAST_DEV=YES ;;
--demo) SRS_DEMO=YES ;;
--fast) SRS_FAST=YES ;;
--disable-all) SRS_DISABLE_ALL=YES ;;
--pure-rtmp) SRS_PURE_RTMP=YES ;;
--rtmp-hls) SRS_RTMP_HLS=YES ;;
--full) SRS_ENABLE_ALL=YES ;;
--use-sys-ssl) SRS_USE_SYS_SSL=YES ;;
*)
echo "$0: error: invalid option \"$option\""
exit 1
;;
esac
}
function parse_user_option_to_value_and_option() {
case "$option" in
-*=*)
value=`echo "$option" | sed -e 's|[-_a-zA-Z0-9/]*=||'`
option=`echo "$option" | sed -e 's|=[-_a-zA-Z0-9/.]*||'`
;;
*) value="" ;;
esac
}
#####################################################################################
# parse preset options
#####################################################################################
opt=
for option
do
opt="$opt `echo $option | sed -e \"s/\(--[^=]*=\)\(.* .*\)/\1'\2'/\"`"
parse_user_option_to_value_and_option
parse_user_option
done
if [ $help = yes ]; then
show_help
exit 0
fi
function apply_user_presets() {
# always set the log level for all presets.
SRS_LOG_VERBOSE=NO
SRS_LOG_INFO=NO
SRS_LOG_TRACE=YES
# set default preset if not specifies
if [ $SRS_RTMP_HLS = NO ]; then
if [ $SRS_PURE_RTMP = NO ]; then
if [ $SRS_FAST = NO ]; then
if [ $SRS_DISABLE_ALL = NO ]; then
if [ $SRS_ENABLE_ALL = NO ]; then
if [ $SRS_DEV = NO ]; then
if [ $SRS_FAST_DEV = NO ]; then
if [ $SRS_DEMO = NO ]; then
if [ $SRS_ARM_UBUNTU12 = NO ]; then
if [ $SRS_MIPS_UBUNTU12 = NO ]; then
if [ $SRS_PI = NO ]; then
if [ $SRS_CUBIE = NO ]; then
if [ $SRS_X86_X64 = NO ]; then
SRS_X86_X64=YES; opt="--x86-x64 $opt";
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
# whether embeded cpu.
if [ $SRS_ARM_UBUNTU12 = YES ]; then
SRS_EMBEDED_CPU=YES
fi
if [ $SRS_MIPS_UBUNTU12 = YES ]; then
SRS_EMBEDED_CPU=YES
fi
# all disabled.
if [ $SRS_DISABLE_ALL = YES ]; then
SRS_HLS=NO
SRS_DVR=NO
SRS_NGINX=NO
SRS_SSL=NO
SRS_FFMPEG_TOOL=NO
SRS_TRANSCODE=NO
SRS_INGEST=NO
SRS_STAT=NO
SRS_HTTP_PARSER=NO
SRS_HTTP_CALLBACK=NO
SRS_HTTP_SERVER=NO
SRS_HTTP_API=NO
SRS_LIBRTMP=NO
SRS_RESEARCH=NO
SRS_UTEST=NO
SRS_GPERF=NO
SRS_GPERF_MC=NO
SRS_GPERF_MP=NO
SRS_GPERF_CP=NO
SRS_GPROF=NO
SRS_STATIC=NO
fi
# all enabled.
if [ $SRS_ENABLE_ALL = YES ]; then
SRS_HLS=YES
SRS_DVR=YES
SRS_NGINX=YES
SRS_SSL=YES
SRS_FFMPEG_TOOL=YES
SRS_TRANSCODE=YES
SRS_INGEST=YES
SRS_STAT=YES
SRS_HTTP_PARSER=YES
SRS_HTTP_CALLBACK=YES
SRS_HTTP_SERVER=YES
SRS_HTTP_API=YES
SRS_LIBRTMP=YES
SRS_RESEARCH=YES
SRS_UTEST=YES
SRS_GPERF=NO
SRS_GPERF_MC=NO
SRS_GPERF_MP=NO
SRS_GPERF_CP=NO
SRS_GPROF=NO
SRS_STATIC=NO
fi
# only rtmp vp6
if [ $SRS_FAST = YES ]; then
SRS_HLS=NO
SRS_DVR=NO
SRS_NGINX=NO
SRS_SSL=NO
SRS_FFMPEG_TOOL=NO
SRS_TRANSCODE=NO
SRS_INGEST=NO
SRS_STAT=NO
SRS_HTTP_PARSER=NO
SRS_HTTP_CALLBACK=NO
SRS_HTTP_SERVER=NO
SRS_HTTP_API=NO
SRS_LIBRTMP=NO
SRS_RESEARCH=NO
SRS_UTEST=NO
SRS_GPERF=NO
SRS_GPERF_MC=NO
SRS_GPERF_MP=NO
SRS_GPERF_CP=NO
SRS_GPROF=NO
SRS_STATIC=NO
fi
# all disabled.
if [ $SRS_RTMP_HLS = YES ]; then
SRS_HLS=YES
SRS_DVR=NO
SRS_NGINX=NO
SRS_SSL=YES
SRS_FFMPEG_TOOL=NO
SRS_TRANSCODE=NO
SRS_INGEST=NO
SRS_STAT=NO
SRS_HTTP_PARSER=NO
SRS_HTTP_CALLBACK=NO
SRS_HTTP_SERVER=NO
SRS_HTTP_API=NO
SRS_LIBRTMP=NO
SRS_RESEARCH=NO
SRS_UTEST=NO
SRS_GPERF=NO
SRS_GPERF_MC=NO
SRS_GPERF_MP=NO
SRS_GPERF_CP=NO
SRS_GPROF=NO
SRS_STATIC=NO
fi
# only ssl for RTMP with complex handshake.
if [ $SRS_PURE_RTMP = YES ]; then
SRS_HLS=NO
SRS_DVR=NO
SRS_NGINX=NO
SRS_SSL=YES
SRS_FFMPEG_TOOL=NO
SRS_TRANSCODE=NO
SRS_INGEST=NO
SRS_STAT=NO
SRS_HTTP_PARSER=NO
SRS_HTTP_CALLBACK=NO
SRS_HTTP_SERVER=NO
SRS_HTTP_API=NO
SRS_LIBRTMP=NO
SRS_RESEARCH=NO
SRS_UTEST=NO
SRS_GPERF=NO
SRS_GPERF_MC=NO
SRS_GPERF_MP=NO
SRS_GPERF_CP=NO
SRS_GPROF=NO
SRS_STATIC=NO
fi
# if arm specified, set some default to disabled.
if [ $SRS_ARM_UBUNTU12 = YES ]; then
SRS_HLS=YES
SRS_DVR=YES
SRS_NGINX=NO
SRS_SSL=YES
SRS_FFMPEG_TOOL=NO
SRS_TRANSCODE=YES
SRS_INGEST=YES
SRS_STAT=YES
SRS_HTTP_PARSER=YES
SRS_HTTP_CALLBACK=YES
SRS_HTTP_SERVER=YES
SRS_HTTP_API=YES
SRS_LIBRTMP=YES
SRS_RESEARCH=NO
SRS_UTEST=NO
SRS_GPERF=NO
SRS_GPERF_MC=NO
SRS_GPERF_MP=NO
SRS_GPERF_CP=NO
SRS_GPROF=NO
# TODO: FIXME: need static? maybe donot.
SRS_STATIC=YES
fi
# if mips specified, set some default to disabled.
if [ $SRS_MIPS_UBUNTU12 = YES ]; then
SRS_HLS=YES
SRS_DVR=YES
SRS_NGINX=NO
SRS_SSL=YES
SRS_FFMPEG_TOOL=NO
SRS_TRANSCODE=YES
SRS_INGEST=YES
SRS_STAT=YES
SRS_HTTP_PARSER=YES
SRS_HTTP_CALLBACK=YES
SRS_HTTP_SERVER=YES
SRS_HTTP_API=YES
SRS_LIBRTMP=YES
SRS_RESEARCH=NO
SRS_UTEST=NO
SRS_GPERF=NO
SRS_GPERF_MC=NO
SRS_GPERF_MP=NO
SRS_GPERF_CP=NO
SRS_GPROF=NO
SRS_STATIC=NO
fi
# defaults for x86/x64
if [ $SRS_X86_X64 = YES ]; then
SRS_HLS=YES
SRS_DVR=YES
SRS_NGINX=NO
SRS_SSL=YES
SRS_FFMPEG_TOOL=NO
SRS_TRANSCODE=YES
SRS_INGEST=YES
SRS_STAT=YES
SRS_HTTP_PARSER=YES
SRS_HTTP_CALLBACK=YES
SRS_HTTP_SERVER=YES
SRS_HTTP_API=YES
SRS_LIBRTMP=YES
SRS_RESEARCH=NO
SRS_UTEST=YES
SRS_GPERF=NO
SRS_GPERF_MC=NO
SRS_GPERF_MP=NO
SRS_GPERF_CP=NO
SRS_GPROF=NO
SRS_STATIC=NO
fi
# if dev specified, open features if possible.
if [ $SRS_DEV = YES ]; then
SRS_HLS=YES
SRS_DVR=YES
SRS_NGINX=NO
SRS_SSL=YES
SRS_FFMPEG_TOOL=YES
SRS_TRANSCODE=YES
SRS_INGEST=YES
SRS_STAT=YES
SRS_HTTP_PARSER=YES
SRS_HTTP_CALLBACK=YES
SRS_HTTP_SERVER=YES
SRS_HTTP_API=YES
SRS_LIBRTMP=YES
SRS_RESEARCH=YES
SRS_UTEST=YES
SRS_GPERF=NO
SRS_GPERF_MC=NO
SRS_GPERF_MP=NO
SRS_GPERF_CP=NO
SRS_GPROF=NO
SRS_STATIC=NO
fi
# if fast dev specified, open main server features.
if [ $SRS_FAST_DEV = YES ]; then
SRS_HLS=YES
SRS_DVR=YES
SRS_NGINX=NO
SRS_SSL=YES
SRS_FFMPEG_TOOL=NO
SRS_TRANSCODE=YES
SRS_INGEST=YES
SRS_STAT=YES
SRS_HTTP_PARSER=YES
SRS_HTTP_CALLBACK=YES
SRS_HTTP_SERVER=YES
SRS_HTTP_API=YES
SRS_LIBRTMP=NO
SRS_RESEARCH=NO
SRS_UTEST=NO
SRS_GPERF=NO
SRS_GPERF_MC=NO
SRS_GPERF_MP=NO
SRS_GPERF_CP=NO
SRS_GPROF=NO
SRS_STATIC=NO
fi
# for srs demo
if [ $SRS_DEMO = YES ]; then
SRS_HLS=YES
SRS_DVR=YES
SRS_NGINX=NO
SRS_SSL=YES
SRS_FFMPEG_TOOL=YES
SRS_TRANSCODE=YES
SRS_INGEST=YES
SRS_STAT=YES
SRS_HTTP_PARSER=YES
SRS_HTTP_CALLBACK=YES
SRS_HTTP_SERVER=YES
SRS_HTTP_API=YES
SRS_LIBRTMP=YES
SRS_RESEARCH=NO
SRS_UTEST=YES
SRS_GPERF=NO
SRS_GPERF_MC=NO
SRS_GPERF_MP=NO
SRS_GPERF_CP=NO
SRS_GPROF=NO
SRS_STATIC=NO
fi
# if raspberry-pi specified, open ssl/hls/static features
if [ $SRS_PI = YES ]; then
SRS_HLS=YES
SRS_DVR=YES
SRS_NGINX=NO
SRS_SSL=YES
SRS_FFMPEG_TOOL=NO
SRS_TRANSCODE=YES
SRS_INGEST=YES
SRS_STAT=YES
SRS_HTTP_PARSER=YES
SRS_HTTP_CALLBACK=YES
SRS_HTTP_SERVER=YES
SRS_HTTP_API=YES
SRS_LIBRTMP=YES
SRS_RESEARCH=NO
SRS_UTEST=NO
SRS_GPERF=NO
SRS_GPERF_MC=NO
SRS_GPERF_MP=NO
SRS_GPERF_CP=NO
SRS_GPROF=NO
SRS_STATIC=NO
fi
# if cubieboard specified, open features except ffmpeg/nginx.
if [ $SRS_CUBIE = YES ]; then
SRS_HLS=YES
SRS_DVR=YES
SRS_NGINX=NO
SRS_SSL=YES
SRS_FFMPEG_TOOL=YES
SRS_TRANSCODE=YES
SRS_INGEST=YES
SRS_STAT=YES
SRS_HTTP_PARSER=YES
SRS_HTTP_CALLBACK=YES
SRS_HTTP_SERVER=YES
SRS_HTTP_API=YES
SRS_LIBRTMP=YES
SRS_RESEARCH=NO
SRS_UTEST=NO
SRS_GPERF=NO
SRS_GPERF_MC=NO
SRS_GPERF_MP=NO
SRS_GPERF_CP=NO
SRS_GPROF=NO
SRS_STATIC=NO
fi
}
apply_user_presets
#####################################################################################
# parse detail feature options
#####################################################################################
for option
do
parse_user_option_to_value_and_option
parse_user_option
done
function apply_user_detail_options() {
# if transcode/ingest specified, requires the ffmpeg stub classes.
SRS_FFMPEG_STUB=NO
if [ $SRS_TRANSCODE = YES ]; then SRS_FFMPEG_STUB=YES; fi
if [ $SRS_INGEST = YES ]; then SRS_FFMPEG_STUB=YES; fi
# if http-xxxx specified, open the SRS_HTTP_PARSER
SRS_HTTP_PARSER=NO
if [ $SRS_HTTP_CALLBACK = YES ]; then SRS_HTTP_PARSER=YES; fi
if [ $SRS_HTTP_SERVER = YES ]; then SRS_HTTP_PARSER=YES; fi
if [ $SRS_HTTP_API = YES ]; then SRS_HTTP_PARSER=YES; fi
# parse the jobs for make
if [[ "" -eq SRS_JOBS ]]; then
export SRS_JOBS="--jobs=1"
else
export SRS_JOBS="--jobs=${SRS_JOBS}"
fi
}
apply_user_detail_options
function regenerate_options() {
# save all config options to macro to write to auto headers file
SRS_AUTO_USER_CONFIGURE="$opt"
# regenerate the options for default values.
SRS_AUTO_CONFIGURE="--prefix=${SRS_PREFIX}"
if [ $SRS_HLS = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-hls"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-hls"; fi
if [ $SRS_DVR = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-dvr"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-dvr"; fi
if [ $SRS_NGINX = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-nginx"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-nginx"; fi
if [ $SRS_SSL = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-ssl"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-ssl"; fi
if [ $SRS_FFMPEG_TOOL = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-ffmpeg"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-ffmpeg"; fi
if [ $SRS_TRANSCODE = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-transcode"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-transcode"; fi
if [ $SRS_INGEST = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-ingest"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-ingest"; fi
if [ $SRS_STAT = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-stat"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-stat"; fi
if [ $SRS_HTTP_CALLBACK = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-http-callback"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-http-callback"; fi
if [ $SRS_HTTP_SERVER = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-http-server"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-http-server"; fi
if [ $SRS_HTTP_API = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-http-api"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-http-api"; fi
if [ $SRS_LIBRTMP = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-librtmp"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-librtmp"; fi
if [ $SRS_RESEARCH = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-research"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-research"; fi
if [ $SRS_UTEST = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-utest"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-utest"; fi
if [ $SRS_GPERF = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-gperf"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-gperf"; fi
if [ $SRS_GPERF_MC = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-gmc"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-gmc"; fi
if [ $SRS_GPERF_MP = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-gmp"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-gmp"; fi
if [ $SRS_GPERF_CP = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-gcp"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-gcp"; fi
if [ $SRS_GPROF = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-gprof"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-gprof"; fi
if [ $SRS_ARM_UBUNTU12 = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-arm-ubuntu12"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-arm-ubuntu12"; fi
if [ $SRS_MIPS_UBUNTU12 = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-mips-ubuntu12"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-mips-ubuntu12"; fi
if [ $SRS_STATIC = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --static"; fi
if [ $SRS_LOG_VERBOSE = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --log-verbose"; fi
if [ $SRS_LOG_INFO = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --log-info"; fi
if [ $SRS_LOG_TRACE = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --log-trace"; fi
echo "regenerate config: ${SRS_AUTO_CONFIGURE}"
}
regenerate_options
#####################################################################################
# check user options
#####################################################################################
function check_option_conflicts() {
__check_ok=YES
# check conflict
if [ $SRS_GPERF = NO ]; then
if [ $SRS_GPERF_MC = YES ]; then echo "gperf-mc depends on gperf, see: ./configure --help"; __check_ok=NO; fi
if [ $SRS_GPERF_MP = YES ]; then echo "gperf-mp depends on gperf, see: ./configure --help"; __check_ok=NO; fi
if [ $SRS_GPERF_CP = YES ]; then echo "gperf-cp depends on gperf, see: ./configure --help"; __check_ok=NO; fi
fi
if [ $SRS_GPERF_MC = YES ]; then
if [ $SRS_GPERF_MP = YES ]; then
echo "gperf-mc not compatible with gperf-mp, see: ./configure --help";
echo "@see: http://google-perftools.googlecode.com/svn/trunk/doc/heap_checker.html";
echo "Note that since the heap-checker uses the heap-profiling framework internally, it is not possible to run both the heap-checker and heap profiler at the same time";
__check_ok=NO
fi
fi
# generate the group option: SRS_GPERF
__gperf_slow=NO
if [ $SRS_GPERF_MC = YES ]; then SRS_GPERF=YES; __gperf_slow=YES; fi
if [ $SRS_GPERF_MP = YES ]; then SRS_GPERF=YES; __gperf_slow=YES; fi
if [ $SRS_GPERF_CP = YES ]; then SRS_GPERF=YES; __gperf_slow=YES; fi
if [ $__gperf_slow = YES ]; then if [ $SRS_GPROF = YES ]; then
echo "gmc/gmp/gcp not compatible with gprof, see: ./configure --help"; __check_ok=NO;
fi fi
# check embeded(arm/mips), if embeded enabled, only allow st/ssl/librtmp,
# user should disable all other features
if [ $SRS_EMBEDED_CPU = YES ]; then
if [ $SRS_FFMPEG_TOOL = YES ]; then echo "ffmpeg for arm is not available, see: ./configure --help"; __check_ok=NO; fi
if [ $SRS_RESEARCH = YES ]; then echo "research for arm is not available, see: ./configure --help"; __check_ok=NO; fi
if [ $SRS_GPERF = YES ]; then echo "gperf for arm is not available, see: ./configure --help"; __check_ok=NO; fi
if [ $SRS_GPERF_MC = YES ]; then echo "gmc for arm is not available, see: ./configure --help"; __check_ok=NO; fi
if [ $SRS_GPERF_MP = YES ]; then echo "gmp for arm is not available, see: ./configure --help"; __check_ok=NO; fi
if [ $SRS_GPERF_CP = YES ]; then echo "gcp for arm is not available, see: ./configure --help"; __check_ok=NO; fi
if [ $SRS_GPROF = YES ]; then echo "gprof for arm is not available, see: ./configure --help"; __check_ok=NO; fi
fi
# if x86/x64 or directly build, never use static
if [ $SRS_X86_X64 = YES ]; then
if [ $SRS_STATIC = YES ]; then
echo "x86/x64 should never use static, see: ./configure --help"; __check_ok=NO;
fi
fi
# TODO: FIXME: check more os.
# check variable neccessary
if [ $SRS_HLS = RESERVED ]; then echo "you must specifies the hls, see: ./configure --help"; __check_ok=NO; fi
if [ $SRS_DVR = RESERVED ]; then echo "you must specifies the dvr, see: ./configure --help"; __check_ok=NO; fi
if [ $SRS_NGINX = RESERVED ]; then echo "you must specifies the nginx, see: ./configure --help"; __check_ok=NO; fi
if [ $SRS_SSL = RESERVED ]; then echo "you must specifies the ssl, see: ./configure --help"; __check_ok=NO; fi
if [ $SRS_FFMPEG_TOOL = RESERVED ]; then echo "you must specifies the ffmpeg, see: ./configure --help"; __check_ok=NO; fi
if [ $SRS_HTTP_CALLBACK = RESERVED ]; then echo "you must specifies the http-callback, see: ./configure --help"; __check_ok=NO; fi
if [ $SRS_HTTP_SERVER = RESERVED ]; then echo "you must specifies the http-server, see: ./configure --help"; __check_ok=NO; fi
if [ $SRS_HTTP_API = RESERVED ]; then echo "you must specifies the http-api, see: ./configure --help"; __check_ok=NO; fi
if [ $SRS_LIBRTMP = RESERVED ]; then echo "you must specifies the librtmp, see: ./configure --help"; __check_ok=NO; fi
if [ $SRS_RESEARCH = RESERVED ]; then echo "you must specifies the research, see: ./configure --help"; __check_ok=NO; fi
if [ $SRS_UTEST = RESERVED ]; then echo "you must specifies the utest, see: ./configure --help"; __check_ok=NO; fi
if [ $SRS_GPERF = RESERVED ]; then echo "you must specifies the gperf, see: ./configure --help"; __check_ok=NO; fi
if [ $SRS_GPERF_MC = RESERVED ]; then echo "you must specifies the gperf-mc, see: ./configure --help"; __check_ok=NO; fi
if [ $SRS_GPERF_MP = RESERVED ]; then echo "you must specifies the gperf-mp, see: ./configure --help"; __check_ok=NO; fi
if [ $SRS_GPERF_CP = RESERVED ]; then echo "you must specifies the gperf-cp, see: ./configure --help"; __check_ok=NO; fi
if [ $SRS_GPROF = RESERVED ]; then echo "you must specifies the gprof, see: ./configure --help"; __check_ok=NO; fi
if [ $SRS_ARM_UBUNTU12 = RESERVED ]; then echo "you must specifies the arm-ubuntu12, see: ./configure --help"; __check_ok=NO; fi
if [ $SRS_MIPS_UBUNTU12 = RESERVED ]; then echo "you must specifies the mips-ubuntu12, see: ./configure --help"; __check_ok=NO; fi
if [[ -z $SRS_PREFIX ]]; then echo "you must specifies the prefix, see: ./configure --prefix"; __check_ok=NO; fi
if [ $__check_ok = NO ]; then
exit 1;
fi
}
check_option_conflicts

@ -0,0 +1,180 @@
# generate utest Makefile
#
# params:
# $SRS_OBJS the objs directory. ie. objs
# $SRS_MAKEFILE the makefile name. ie. Makefile
#
# $APP_NAME the app name to output. ie. srs_utest
# $MODULE_DIR the src dir of utest code. ie. src/utest
# $LINK_OPTIONS the link options for utest. ie. -lpthread -ldl
FILE=${SRS_OBJS}/utest/${SRS_MAKEFILE}
# create dir for Makefile
mkdir -p ${SRS_OBJS}/utest
# the prefix to generate the objs/utest/Makefile
# dirs relative to current dir(objs/utest), it's trunk/objs/utest
# trunk of srs, which contains the src dir, relative to objs/utest, it's trunk
SRS_TRUNK_PREFIX=../..
# gest dir, relative to objs/utest, it's trunk/objs/gtest
GTEST_DIR=${SRS_TRUNK_PREFIX}/${SRS_OBJS}/gtest
cat << END > ${FILE}
# user must run make the ${SRS_OBJS}/utest dir
# at the same dir of Makefile.
# A sample Makefile for building Google Test and using it in user
# tests. Please tweak it to suit your environment and project. You
# may want to move it to your project's root directory.
#
# SYNOPSIS:
#
# make [all] - makes everything.
# make TARGET - makes the given target.
# make clean - removes all files generated by make.
# Please tweak the following variable definitions as needed by your
# project, except GTEST_HEADERS, which you can use in your own targets
# but shouldn't modify.
# Points to the root of Google Test, relative to where this file is.
# Remember to tweak this if you move this file.
GTEST_DIR = ${GTEST_DIR}
# Where to find user code.
USER_DIR = .
# Flags passed to the preprocessor.
CPPFLAGS += -I\$(GTEST_DIR)/include
# Flags passed to the C++ compiler.
CXXFLAGS += -g -Wall -Wextra -O0
# All tests produced by this Makefile. Remember to add new tests you
# created to the list.
TESTS = ${SRS_TRUNK_PREFIX}/${SRS_OBJS}/${APP_NAME}
# All Google Test headers. Usually you shouldn't change this
# definition.
GTEST_HEADERS = \$(GTEST_DIR)/include/gtest/*.h \\
\$(GTEST_DIR)/include/gtest/internal/*.h
# House-keeping build targets.
all : \$(TESTS)
clean :
rm -f \$(TESTS) gtest.a gtest_main.a *.o
# Builds gtest.a and gtest_main.a.
# Usually you shouldn't tweak such internal variables, indicated by a
# trailing _.
GTEST_SRCS_ = \$(GTEST_DIR)/src/*.cc \$(GTEST_DIR)/src/*.h \$(GTEST_HEADERS)
# For simplicity and to avoid depending on Google Test's
# implementation details, the dependencies specified below are
# conservative and not optimized. This is fine as Google Test
# compiles fast and for ordinary users its source rarely changes.
gtest-all.o : \$(GTEST_SRCS_)
\$(CXX) \$(CPPFLAGS) -I\$(GTEST_DIR) \$(CXXFLAGS) -c \\
\$(GTEST_DIR)/src/gtest-all.cc
gtest_main.o : \$(GTEST_SRCS_)
\$(CXX) \$(CPPFLAGS) -I\$(GTEST_DIR) \$(CXXFLAGS) -c \\
\$(GTEST_DIR)/src/gtest_main.cc
gtest.a : gtest-all.o
\$(AR) \$(ARFLAGS) \$@ \$^
gtest_main.a : gtest-all.o gtest_main.o
\$(AR) \$(ARFLAGS) \$@ \$^
# Builds a sample test. A test should link with either gtest.a or
# gtest_main.a, depending on whether it defines its own main()
# function.
#####################################################################################
#####################################################################################
# SRS(Simple RTMP Server) utest section
#####################################################################################
#####################################################################################
END
#####################################################################################
# Includes, the include dir.
echo "# Includes, the include dir." >> ${FILE}
#
# current module header files
echo -n "SRS_UTEST_INC = -I${SRS_TRUNK_PREFIX}/${MODULE_DIR} " >> ${FILE}
#
# depends module header files
for item in ${MODULE_DEPENDS[*]}; do
DEP_INCS_NAME="${item}_INCS"
echo -n "-I${SRS_TRUNK_PREFIX}/${!DEP_INCS_NAME} " >> ${FILE}
done
#
# depends library header files
for item in ${ModuleLibIncs[*]}; do
echo -n "-I${SRS_TRUNK_PREFIX}/${item} " >> ${FILE}
done
echo "" >> ${FILE}; echo "" >> ${FILE}
#####################################################################################
# Depends, the depends objects
echo "# Depends, the depends objects" >> ${FILE}
#
# current module header files
echo -n "SRS_UTEST_DEPS = " >> ${FILE}
for item in ${MODULE_OBJS[*]}; do
FILE_NAME=${item%.*}
echo -n "${SRS_TRUNK_PREFIX}/${SRS_OBJS}/${FILE_NAME}.o " >> ${FILE}
done
echo "" >> ${FILE}; echo "" >> ${FILE}
#
echo "# Depends, utest header files" >> ${FILE}
DEPS_NAME="UTEST_DEPS"
echo -n "${DEPS_NAME} = " >> ${FILE}
for item in ${MODULE_FILES[*]}; do
HEADER_FILE="${SRS_TRUNK_PREFIX}/${MODULE_DIR}/${item}.hpp"
echo -n " ${HEADER_FILE}" >> ${FILE}
done
echo "" >> ${FILE}; echo "" >> ${FILE}
#####################################################################################
# Objects, build each object of utest
echo "# Objects, build each object of utest" >> ${FILE}
#
MODULE_OBJS=()
for item in ${MODULE_FILES[*]}; do
MODULE_OBJS="${MODULE_OBJS[@]} ${item}.o"
cat << END >> ${FILE}
${item}.o : \$(${DEPS_NAME}) ${SRS_TRUNK_PREFIX}/${MODULE_DIR}/${item}.cpp \$(SRS_UTEST_DEPS)
\$(CXX) \$(CPPFLAGS) \$(CXXFLAGS) \$(SRS_UTEST_INC) -c ${SRS_TRUNK_PREFIX}/${MODULE_DIR}/${item}.cpp -o \$@
END
done
echo "" >> ${FILE}
#####################################################################################
# App for utest
#
# link all depends libraries
echo "# link all depends libraries" >> ${FILE}
echo -n "DEPS_LIBRARIES_FILES = " >> ${FILE}
for item in ${ModuleLibFiles[*]}; do
echo -n "${SRS_TRUNK_PREFIX}/${item} " >> ${FILE}
done
echo "" >> ${FILE}; echo "" >> ${FILE}
#
echo "# generate the utest binary" >> ${FILE}
cat << END >> ${FILE}
${SRS_TRUNK_PREFIX}/${SRS_OBJS}/${APP_NAME} : \$(SRS_UTEST_DEPS) ${MODULE_OBJS} gtest_main.a
\$(CXX) -o \$@ \$(CPPFLAGS) \$(CXXFLAGS) \$^ \$(DEPS_LIBRARIES_FILES) ${LINK_OPTIONS}
END
#####################################################################################
# parent Makefile, to create module output dir before compile it.
echo " mkdir -p ${SRS_OBJS}/utest" >> ${SRS_MAKEFILE}
echo -n "generate utest ok"; echo '!';

@ -0,0 +1,18 @@
# bandwidth test tool config for srs.
# @see full.conf for detail config.
listen 1935;
max_connections 1000;
vhost __defaultVhost__ {
}
vhost bandcheck.srs.com {
enabled on;
chunk_size 65000;
bandcheck {
enabled on;
key "35c9b402c12a7246868752e2878f7e0e";
interval 30;
limit_kbps 4000;
}
}

@ -0,0 +1,17 @@
# no-daemon and write log to console config for srs.
# @see full.conf for detail config.
listen 1935;
max_connections 1000;
daemon off;
srs_log_tank console;
http_api {
enabled on;
listen 1985;
}
http_stream {
enabled on;
listen 8080;
}
vhost __defaultVhost__ {
}

@ -0,0 +1,22 @@
# the config for srs demo
# @see https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_SampleDemo
# @see full.conf for detail config.
listen 19350;
max_connections 1000;
daemon on;
srs_log_tank file;
srs_log_file ./objs/srs.demo.19350.log;
pid ./objs/srs.demo.19350.pid;
vhost __defaultVhost__ {
enabled on;
gop_cache on;
hls {
enabled on;
hls_path ./objs/nginx/html/forward;
hls_fragment 5;
hls_window 30;
}
}

@ -0,0 +1,220 @@
# the config for srs demo
# @see https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_SampleDemo
# @see full.conf for detail config.
listen 1935;
max_connections 1000;
daemon on;
srs_log_tank file;
srs_log_file ./objs/srs.demo.log;
pid ./objs/srs.demo.pid;
chunk_size 60000;
max_connections 2000;
http_api {
enabled on;
listen 1985;
}
http_stream {
enabled on;
listen 8080;
dir ./objs/nginx/html;
}
vhost __defaultVhost__ {
enabled on;
gop_cache on;
}
vhost bandcheck.srs.com {
enabled on;
chunk_size 65000;
bandcheck {
enabled on;
key "35c9b402c12a7246868752e2878f7e0e";
interval 30;
limit_kbps 4000;
}
}
vhost demo.srs.com {
chunk_size 60000;
enabled on;
gop_cache on;
queue_length 30;
forward 127.0.0.1:19350;
bandcheck {
enabled off;
}
hls {
enabled on;
hls_path ./objs/nginx/html;
hls_fragment 5;
hls_window 30;
}
http_hooks {
enabled on;
on_connect http://127.0.0.1:8085/api/v1/clients;
on_close http://127.0.0.1:8085/api/v1/clients;
on_publish http://127.0.0.1:8085/api/v1/streams;
on_unpublish http://127.0.0.1:8085/api/v1/streams;
on_play http://127.0.0.1:8085/api/v1/sessions;
on_stop http://127.0.0.1:8085/api/v1/sessions;
}
transcode {
enabled on;
ffmpeg ./objs/ffmpeg/bin/ffmpeg;
engine ld {
enabled on;
vfilter {
i ./doc/srs-logo.png;
filter_complex 'overlay=10:10';
}
vcodec libx264;
vbitrate 300;
vfps 20;
vwidth 768;
vheight 320;
vthreads 1;
vprofile baseline;
vpreset superfast;
vparams {
}
acodec libaacplus;
abitrate 45;
asample_rate 44100;
achannels 2;
aparams {
}
output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine];
}
engine sd {
enabled on;
vfilter {
vf 'split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2';
}
vcodec libx264;
vbitrate 500;
vfps 20;
vwidth 768;
vheight 320;
vthreads 1;
vprofile main;
vpreset fast;
vparams {
}
acodec libaacplus;
abitrate 40;
asample_rate 44100;
achannels 2;
aparams {
}
output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine];
}
}
ingest {
enabled on;
input {
type file;
url ./doc/source.200kbps.768x320.flv;
}
ffmpeg ./objs/ffmpeg/bin/ffmpeg;
engine {
enabled off;
output rtmp://127.0.0.1:[port]/live?vhost=[vhost]/livestream;
}
}
}
vhost players {
enabled on;
gop_cache on;
transcode {
enabled on;
ffmpeg ./objs/ffmpeg/bin/ffmpeg;
engine hls {
enabled on;
vfilter {
i ./doc/srs-logo.png;
filter_complex 'overlay=10:10';
}
vcodec libx264;
vbitrate 300;
vfps 20;
vwidth 768;
vheight 320;
vthreads 1;
vprofile baseline;
vpreset superfast;
vparams {
g 100;
}
acodec libaacplus;
abitrate 30;
asample_rate 44100;
achannels 2;
aparams {
}
output rtmp://127.0.0.1:[port]/[app]?vhost=players_pub/[stream];
}
}
ingest {
enabled on;
input {
type file;
url ./doc/source.200kbps.768x320.flv;
}
ffmpeg ./objs/ffmpeg/bin/ffmpeg;
engine {
enabled off;
output rtmp://127.0.0.1:[port]/live?vhost=[vhost]/demo;
}
}
}
vhost players_pub {
hls {
enabled on;
hls_path ./objs/nginx/html;
hls_fragment 5;
hls_window 30;
}
}
vhost players_chat {
gop_cache off;
hls {
enabled off;
}
transcode {
enabled on;
ffmpeg ./objs/ffmpeg/bin/ffmpeg;
engine chat_hls {
enabled on;
vfilter {
}
vcodec libx264;
vbitrate 150;
vfps 15;
vwidth 576;
vheight 240;
vthreads 1;
vprofile baseline;
vpreset ultrafast;
vparams {
g 30;
}
acodec an;
output rtmp://127.0.0.1:[port]/[app]?vhost=chat_hls/[stream];
}
}
}
vhost chat_hls {
hls {
enabled on;
hls_path ./objs/nginx/html;
hls_fragment 2;
hls_window 10;
}
}

@ -0,0 +1,15 @@
# the config for srs to dvr in segment mode
# @see https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_DVR
# @see full.conf for detail config.
listen 1935;
max_connections 1000;
vhost __defaultVhost__ {
dvr {
enabled on;
dvr_path ./objs/nginx/html;
dvr_plan segment;
dvr_duration 30;
dvr_wait_keyframe on;
}
}

@ -0,0 +1,13 @@
# the config for srs to dvr in session mode
# @see https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_DVR
# @see full.conf for detail config.
listen 1935;
max_connections 1000;
vhost __defaultVhost__ {
dvr {
enabled on;
dvr_path ./objs/nginx/html;
dvr_plan session;
}
}

@ -0,0 +1,12 @@
# the config for srs origin-edge cluster
# @see https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_Edge
# @see full.conf for detail config.
listen 1935;
max_connections 1000;
pid objs/edge.pid;
srs_log_file ./objs/edge.log;
vhost __defaultVhost__ {
mode remote;
origin 127.0.0.1:19350;
}

@ -0,0 +1,11 @@
# the config for srs for token traverse authentication
# @see https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_DRM
# @see full.conf for detail config.
listen 1935
max_connections 1000;
vhost __defaultVhost__ {
mode remote;
origin 127.0.0.1:19350;
token_traverse on;
}

@ -0,0 +1,34 @@
# the config for srs use ffmpeg to transcode
# @see https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_SampleFFMPEG
# @see full.conf for detail config.
listen 1935;
max_connections 1000;
vhost __defaultVhost__ {
transcode {
enabled on;
ffmpeg ./objs/ffmpeg/bin/ffmpeg;
engine ff {
enabled on;
vfilter {
}
vcodec libx264;
vbitrate 500;
vfps 25;
vwidth 768;
vheight 320;
vthreads 12;
vprofile main;
vpreset medium;
vparams {
}
acodec libaacplus;
abitrate 70;
asample_rate 44100;
achannels 2;
aparams {
}
output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine];
}
}
}

@ -0,0 +1,12 @@
# the config for srs to forward
# @see https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_SampleForward
# @see full.conf for detail config.
listen 1935;
max_connections 1000;
pid ./objs/srs.master.pid;
srs_log_tank file;
srs_log_file ./objs/srs.master.log;
vhost __defaultVhost__ {
forward 127.0.0.1:19350;
}

@ -0,0 +1,11 @@
# the config for srs to forward
# @see https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_SampleForward
# @see full.conf for detail config.
listen 19350;
max_connections 1000;
pid ./objs/srs.slave.pid;
srs_log_tank file;
srs_log_file ./objs/srs.slave.log;
vhost __defaultVhost__ {
}

@ -0,0 +1,957 @@
# all config for srs
#############################################################################################
# RTMP sections
#############################################################################################
# the rtmp listen ports, split by space.
listen 1935;
# the pid file
# to ensure only one process can use a pid file
# and provides the current running process id, for script,
# for example, init.d script to manage the server.
# default: ./objs/srs.pid
pid ./objs/srs.pid;
# the default chunk size is 128, max is 65536,
# some client does not support chunk size change,
# however, most clients supports it and it can improve
# performance about 10%.
# default: 60000
chunk_size 60000;
# the logs dir.
# if enabled ffmpeg, each stracoding stream will create a log file.
# /dev/null to disable the log.
# default: ./objs
ff_log_dir ./objs;
# the log tank, console or file.
# if console, print log to console.
# if file, write log to file. requires srs_log_file if log to file.
# default: file.
srs_log_tank file;
# the log level, for all log tanks.
# can be: verbose, info, trace, warn, error
# default: trace
srs_log_level trace;
# when srs_log_tank is file, specifies the log file.
# default: ./objs/srs.log
srs_log_file ./objs/srs.log;
# the max connections.
# if exceed the max connections, server will drop the new connection.
# default: 1000
max_connections 1000;
# whether start as deamon
# @remark: donot support reload.
# default: on
daemon on;
#############################################################################################
# heartbeat/stats sections
#############################################################################################
# heartbeat to api server
# @remark, the ip report to server, is retrieve from system stat,
# which need the config item stats.network.
heartbeat {
# whether heartbeat is enalbed.
# default: off
enabled off;
# the interval seconds for heartbeat,
# recommend 0.3,0.6,0.9,1.2,1.5,1.8,2.1,2.4,2.7,3,...,6,9,12,....
# default: 9.9
interval 9.3;
# when startup, srs will heartbeat to this api.
# @remark: must be a restful http api url, where SRS will POST with following data:
# {
# "device_id": "my-srs-device",
# "ip": "192.168.1.100"
# }
# default: http://127.0.0.1:8085/api/v1/servers
url http://127.0.0.1:8085/api/v1/servers;
# the id of devide.
device_id "my-srs-device";
# whether report with summaries
# if true, put /api/v1/summaries to the request data:
# {
# "summaries": summaries object.
# }
# @remark: optional config.
# default: off
summaries off;
}
# system statistics section.
# the main cycle will retrieve the system stat,
# for example, the cpu/mem/network/disk-io data,
# the http api, for instance, /api/v1/summaries will show these data.
# @remark the heartbeat depends on the network,
# for example, the eth0 maybe the device which index is 0.
stats {
# the index of device ip.
# we may retrieve more than one network device.
# default: 0
network 0;
# the device name to stat the disk iops.
# ignore the device of /proc/diskstats if not configed.
disk sda sdb xvda xvdb;
}
#############################################################################################
# HTTP sections
#############################################################################################
# api of srs.
# the http api config, export for external program to manage srs.
# user can access http api of srs in browser directly, for instance, to access by:
# curl http://192.168.1.170:1985/api/v1/reload
# which will reload srs, like cmd killall -1 srs, but the js can also invoke the http api,
# where the cli can only be used in shell/terminate.
http_api {
# whether http api is enabled.
# default: off
enabled on;
# the http api port
# default: 1985
listen 1985;
}
# embeded http server in srs.
# the http streaming config, for HLS/HDS/DASH/HTTPProgressive
# global config for http streaming, user must config the http section for each vhost.
# the embed http server used to substitute nginx in ./objs/nginx,
# for example, srs runing in arm, can provides RTMP and HTTP service, only with srs installed.
# user can access the http server pages, generally:
# curl http://192.168.1.170:80/srs.html
# which will show srs version and welcome to srs.
# @remark, the http embeded stream need to config the vhost, for instance, the __defaultVhost__
# need to open the feature http of vhost.
http_stream {
# whether http streaming service is enabled.
# default: off
enabled on;
# the http streaming port
# @remark, if use lower port, for instance 80, user must start srs by root.
# default: 8080
listen 8080;
# the default dir for http root.
# default: ./objs/nginx/html
dir ./objs/nginx/html;
}
#############################################################################################
# RTMP/HTTP VHOST sections
#############################################################################################
# vhost list, the __defaultVhost__ is the default vhost
# for example, user use ip to access the stream: rtmp://192.168.1.2/live/livestream.
# for which cannot identify the required vhost.
vhost __defaultVhost__ {
}
# vhost for edge, edge and origin is the same vhost
vhost same.edge.srs.com {
# the mode of vhost, local or remote.
# local: vhost is origin vhost, which provides stream source.
# remote: vhost is edge vhost, which pull/push to origin.
# default: local
mode remote;
# for edge(remote mode), user must specifies the origin server
# format as: <server_name|ip>[:port]
# @remark user can specifies multiple origin for error backup, by space,
# for example, 192.168.1.100:1935 192.168.1.101:1935 192.168.1.102:1935
origin 127.0.0.1:1935 localhost:1935;
# for edge, whether open the token traverse mode,
# if token traverse on, all connections of edge will forward to origin to check(auth),
# it's very important for the edge to do the token auth.
# the better way is use http callback to do the token auth by the edge,
# but if user prefer origin check(auth), the token_traverse if better solution.
# default: off
token_traverse off;
}
# vhost for dvr
vhost dvr.srs.com {
# dvr RTMP stream to file,
# start to record to file when encoder publish,
# reap flv according by specified dvr_plan.
dvr {
# whether enabled dvr features
# default: off
enabled on;
# the dvr output path.
# the app dir is auto created under the dvr_path.
# for example, for rtmp stream:
# rtmp://127.0.0.1/live/livestream
# http://127.0.0.1/live/livestream.m3u8
# where dvr_path is /dvr, srs will create the following files:
# /dvr/live the app dir for all streams.
# /dvr/live/livestream.{time}.flv the dvr flv file.
# @remark, the time use system timestamp in ms, user can use http callback to rename it.
# in a word, the dvr_path is for vhost.
# default: ./objs/nginx/html
dvr_path ./objs/nginx/html;
# the dvr plan. canbe:
# session reap flv when session end(unpublish).
# segment reap flv when flv duration exceed the specified dvr_duration.
# default: session
dvr_plan session;
# the param for plan(segment), in seconds.
# default: 30
dvr_duration 30;
# the param for plan(segment),
# whether wait keyframe to reap segment,
# if off, reap segment when duration exceed the dvr_duration,
# if on, reap segment when duration exceed and got keyframe.
# default: on
dvr_wait_keyframe on;
# about the stream monotonically increasing:
# 1. video timestamp is monotonically increasing,
# 2. audio timestamp is monotonically increasing,
# 3. video and audio timestamp is interleaved monotonically increasing.
# it's specified by RTMP specification, @see 3. Byte Order, Alignment, and Time Format
# however, some encoder cannot provides this feature, please set this to off to ignore time jitter.
# the time jitter algorithm:
# 1. full, to ensure stream start at zero, and ensure stream monotonically increasing.
# 2. zero, only ensure sttream start at zero, ignore timestamp jitter.
# 3. off, disable the time jitter algorithm, like atc.
# default: full
time_jitter full;
}
}
# vhost for ingest
vhost ingest.srs.com {
# ingest file/stream/device then push to SRS over RTMP.
# the name/id used to identify the ingest, must be unique in global.
# ingest id is used in reload or http api management.
ingest livestream {
# whether enabled ingest features
# default: off
enabled on;
# input file/stream/device
# @remark only support one input.
input {
# the type of input.
# can be file/stream/device, that is,
# file: ingest file specifies by url.
# stream: ingest stream specifeis by url.
# device: not support yet.
# default: file
type file;
# the url of file/stream.
url ./doc/source.200kbps.768x320.flv;
}
# the ffmpeg
ffmpeg ./objs/ffmpeg/bin/ffmpeg;
# the transcode engine, @see all.transcode.srs.com
# @remark, the output is specified following.
engine {
# @see enabled of transcode engine.
# if disabled or vcodec/acodec not specified, use copy.
# default: off.
enabled off;
# output stream. variables:
# [vhost] current vhost which start the ingest.
# [port] system RTMP stream port.
output rtmp://127.0.0.1:[port]/live?vhost=[vhost]/livestream;
}
}
}
# vhost for http
vhost http.srs.com {
# http vhost specified config
http {
# whether enabled the http streaming service for vhost.
# default: off
enabled on;
# the virtual directory root for this vhost to mount at
# for example, if mount to /hls, user access by http://server/hls
# default: /
mount /hls;
# main dir of vhost,
# to delivery HTTP stream of this vhost.
# default: ./objs/nginx/html
dir ./objs/nginx/html/hls;
}
}
# the vhost with hls specified.
vhost with-hls.srs.com {
hls {
# whether the hls is enabled.
# if off, donot write hls(ts and m3u8) when publish.
# default: off
enabled on;
# the hls output path.
# the app dir is auto created under the hls_path.
# for example, for rtmp stream:
# rtmp://127.0.0.1/live/livestream
# http://127.0.0.1/live/livestream.m3u8
# where hls_path is /hls, srs will create the following files:
# /hls/live the app dir for all streams.
# /hls/live/livestream.m3u8 the HLS m3u8 file.
# /hls/live/livestream-1.ts the HLS media/ts file.
# in a word, the hls_path is for vhost.
# default: ./objs/nginx/html
hls_path ./objs/nginx/html;
# the hls fragment in seconds, the duration of a piece of ts.
# default: 10
hls_fragment 10;
# the hls window in seconds, the number of ts in m3u8.
# default: 60
hls_window 60;
}
}
# the vhost with hls disabled.
vhost no-hls.srs.com {
hls {
# whether the hls is enabled.
# if off, donot write hls(ts and m3u8) when publish.
# default: off
enabled off;
}
}
# the http hook callback vhost, srs will invoke the hooks for specified events.
vhost hooks.callback.srs.com {
http_hooks {
# whether the http hooks enalbe.
# default off.
enabled on;
# when client connect to vhost/app, call the hook,
# the request in the POST data string is a object encode by json:
# {
# "action": "on_connect",
# "client_id": 1985,
# "ip": "192.168.1.10", "vhost": "video.test.com", "app": "live",
# "tcUrl": "rtmp://video.test.com/live?key=d2fa801d08e3f90ed1e1670e6e52651a",
# "pageUrl": "http://www.test.com/live.html"
# }
# if valid, the hook must return HTTP code 200(Stauts OK) and response
# an int value specifies the error code(0 corresponding to success):
# 0
# support multiple api hooks, format:
# on_connect http://xxx/api0 http://xxx/api1 http://xxx/apiN
on_connect http://127.0.0.1:8085/api/v1/clients http://localhost:8085/api/v1/clients;
# when client close/disconnect to vhost/app/stream, call the hook,
# the request in the POST data string is a object encode by json:
# {
# "action": "on_close",
# "client_id": 1985,
# "ip": "192.168.1.10", "vhost": "video.test.com", "app": "live"
# }
# if valid, the hook must return HTTP code 200(Stauts OK) and response
# an int value specifies the error code(0 corresponding to success):
# 0
# support multiple api hooks, format:
# on_close http://xxx/api0 http://xxx/api1 http://xxx/apiN
on_close http://127.0.0.1:8085/api/v1/clients http://localhost:8085/api/v1/clients;
# when client(encoder) publish to vhost/app/stream, call the hook,
# the request in the POST data string is a object encode by json:
# {
# "action": "on_publish",
# "client_id": 1985,
# "ip": "192.168.1.10", "vhost": "video.test.com", "app": "live",
# "stream": "livestream"
# }
# if valid, the hook must return HTTP code 200(Stauts OK) and response
# an int value specifies the error code(0 corresponding to success):
# 0
# support multiple api hooks, format:
# on_publish http://xxx/api0 http://xxx/api1 http://xxx/apiN
on_publish http://127.0.0.1:8085/api/v1/streams http://localhost:8085/api/v1/streams;
# when client(encoder) stop publish to vhost/app/stream, call the hook,
# the request in the POST data string is a object encode by json:
# {
# "action": "on_unpublish",
# "client_id": 1985,
# "ip": "192.168.1.10", "vhost": "video.test.com", "app": "live",
# "stream": "livestream"
# }
# if valid, the hook must return HTTP code 200(Stauts OK) and response
# an int value specifies the error code(0 corresponding to success):
# 0
# support multiple api hooks, format:
# on_unpublish http://xxx/api0 http://xxx/api1 http://xxx/apiN
on_unpublish http://127.0.0.1:8085/api/v1/streams http://localhost:8085/api/v1/streams;
# when client start to play vhost/app/stream, call the hook,
# the request in the POST data string is a object encode by json:
# {
# "action": "on_play",
# "client_id": 1985,
# "ip": "192.168.1.10", "vhost": "video.test.com", "app": "live",
# "stream": "livestream"
# }
# if valid, the hook must return HTTP code 200(Stauts OK) and response
# an int value specifies the error code(0 corresponding to success):
# 0
# support multiple api hooks, format:
# on_play http://xxx/api0 http://xxx/api1 http://xxx/apiN
on_play http://127.0.0.1:8085/api/v1/sessions http://localhost:8085/api/v1/sessions;
# when client stop to play vhost/app/stream, call the hook,
# the request in the POST data string is a object encode by json:
# {
# "action": "on_stop",
# "client_id": 1985,
# "ip": "192.168.1.10", "vhost": "video.test.com", "app": "live",
# "stream": "livestream"
# }
# if valid, the hook must return HTTP code 200(Stauts OK) and response
# an int value specifies the error code(0 corresponding to success):
# 0
# support multiple api hooks, format:
# on_stop http://xxx/api0 http://xxx/api1 http://xxx/apiN
on_stop http://127.0.0.1:8085/api/v1/sessions http://localhost:8085/api/v1/sessions;
}
}
# the vhost for srs debug info, whether send args in connect(tcUrl).
vhost debug.srs.com {
# when upnode(forward to, edge push to, edge pull from) is srs,
# it's strongly recommend to open the debug_srs_upnode,
# when connect to upnode, it will take the debug info,
# for example, the id, source id, pid.
# please see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_SrsLog
# default: on
debug_srs_upnode on;
}
# the vhost for min delay, donot cache any stream.
vhost min.delay.com {
# whether cache the last gop.
# if on, cache the last gop and dispatch to client,
# to enabled fast startup for client, client play immediately.
# if off, send the latest media data to client,
# client need to wait for the next Iframe to decode and show the video.
# set to off if requires min delay;
# set to on if requires client fast startup.
# default: on
gop_cache off;
# the max live queue length in seconds.
# if the messages in the queue exceed the max length,
# drop the old whole gop.
# default: 30
queue_length 10;
}
# the vhost for antisuck.
vhost refer.anti_suck.com {
# the common refer for play and publish.
# if the page url of client not in the refer, access denied.
# if not specified this field, allow all.
# default: not specified.
refer github.com github.io;
# refer for publish clients specified.
# the common refer is not overrided by this.
# if not specified this field, allow all.
# default: not specified.
refer_publish github.com github.io;
# refer for play clients specified.
# the common refer is not overrided by this.
# if not specified this field, allow all.
# default: not specified.
refer_play github.com github.io;
}
# the vhost which forward publish streams.
vhost same.vhost.forward.srs.com {
# forward all publish stream to the specified server.
# this used to split/forward the current stream for cluster active-standby,
# active-active for cdn to build high available fault tolerance system.
# format: {ip}:{port} {ip_N}:{port_N}
# or specify the vhost by params, @see: change.vhost.forward.srs.com
# if vhost not specified, use the request vhost instead.
forward 127.0.0.1:1936 127.0.0.1:1937;
}
# the mirror filter of ffmpeg, @see: http://ffmpeg.org/ffmpeg-filters.html#Filtering-Introduction
vhost mirror.transcode.srs.com {
transcode {
enabled on;
ffmpeg ./objs/ffmpeg/bin/ffmpeg;
engine mirror {
enabled on;
vfilter {
vf 'split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2';
}
vcodec libx264;
vbitrate 300;
vfps 20;
vwidth 768;
vheight 320;
vthreads 2;
vprofile baseline;
vpreset superfast;
vparams {
}
acodec libaacplus;
abitrate 45;
asample_rate 44100;
achannels 2;
aparams {
}
output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine];
}
}
}
#
# the drawtext filter of ffmpeg, @see: http://ffmpeg.org/ffmpeg-filters.html#drawtext-1
# remark: we remove the libfreetype which always cause build failed, you must add it manual if needed.
#
#######################################################################################################
# the crop filter of ffmpeg, @see: http://ffmpeg.org/ffmpeg-filters.html#crop
vhost crop.transcode.srs.com {
transcode {
enabled on;
ffmpeg ./objs/ffmpeg/bin/ffmpeg;
engine crop {
enabled on;
vfilter {
vf 'crop=in_w-20:in_h-160:10:80';
}
vcodec libx264;
vbitrate 300;
vfps 20;
vwidth 768;
vheight 320;
vthreads 2;
vprofile baseline;
vpreset superfast;
vparams {
}
acodec libaacplus;
abitrate 45;
asample_rate 44100;
achannels 2;
aparams {
}
output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine];
}
}
}
# the logo filter of ffmpeg, @see: http://ffmpeg.org/ffmpeg-filters.html#overlay
vhost logo.transcode.srs.com {
transcode {
enabled on;
ffmpeg ./objs/ffmpeg/bin/ffmpeg;
engine logo {
enabled on;
vfilter {
i ./doc/ffmpeg-logo.png;
filter_complex 'overlay=10:10';
}
vcodec libx264;
vbitrate 300;
vfps 20;
vwidth 768;
vheight 320;
vthreads 2;
vprofile baseline;
vpreset superfast;
vparams {
}
acodec libaacplus;
abitrate 45;
asample_rate 44100;
achannels 2;
aparams {
}
output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine];
}
}
}
# audio transcode only.
# for example, FMLE publish audio codec in mp3, and donot support HLS output,
# we can transcode the audio to aac and copy video to the new stream with HLS.
vhost audio.transcode.srs.com {
transcode {
enabled on;
ffmpeg ./objs/ffmpeg/bin/ffmpeg;
engine acodec {
enabled on;
vcodec copy;
acodec libaacplus;
abitrate 45;
asample_rate 44100;
achannels 2;
aparams {
}
output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine];
}
}
}
# disable video, transcode/copy audio.
# for example, publish pure audio stream.
vhost vn.transcode.srs.com {
transcode {
enabled on;
ffmpeg ./objs/ffmpeg/bin/ffmpeg;
engine vn {
enabled on;
vcodec vn;
acodec libaacplus;
abitrate 45;
asample_rate 44100;
achannels 2;
aparams {
}
output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine];
}
}
}
# ffmpeg-copy(forward implements by ffmpeg).
# copy the video and audio to a new stream.
vhost copy.transcode.srs.com {
transcode {
enabled on;
ffmpeg ./objs/ffmpeg/bin/ffmpeg;
engine copy {
enabled on;
vcodec copy;
acodec copy;
output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine];
}
}
}
# transcode all app and stream of vhost
vhost all.transcode.srs.com {
# the streaming transcode configs.
transcode {
# whether the transcode enabled.
# if off, donot transcode.
# default: off.
enabled on;
# the ffmpeg
ffmpeg ./objs/ffmpeg/bin/ffmpeg;
# the transcode engine for matched stream.
# all matched stream will transcoded to the following stream.
# the transcode set name(ie. hd) is optional and not used.
engine ffsuper {
# whether the engine is enabled
# default: off.
enabled on;
# input format, can be:
# off, do not specifies the format, ffmpeg will guess it.
# flv, for flv or RTMP stream.
# other format, for example, mp4/aac whatever.
# default: flv
iformat flv;
# ffmpeg filters, follows the main input.
vfilter {
# the logo input file.
i ./doc/ffmpeg-logo.png;
# the ffmpeg complex filter.
# for filters, @see: http://ffmpeg.org/ffmpeg-filters.html
filter_complex 'overlay=10:10';
}
# video encoder name. can be:
# libx264: use h.264(libx264) video encoder.
# copy: donot encoder the video stream, copy it.
# vn: disable video output.
vcodec libx264;
# video bitrate, in kbps
vbitrate 1500;
# video framerate.
vfps 25;
# video width, must be even numbers.
vwidth 768;
# video height, must be even numbers.
vheight 320;
# the max threads for ffmpeg to used.
vthreads 12;
# x264 profile, @see x264 -help, can be:
# high,main,baseline
vprofile main;
# x264 preset, @see x264 -help, can be:
# ultrafast,superfast,veryfast,faster,fast
# medium,slow,slower,veryslow,placebo
vpreset medium;
# other x264 or ffmpeg video params
vparams {
# ffmpeg options, @see: http://ffmpeg.org/ffmpeg.html
t 100;
# 264 params, @see: http://ffmpeg.org/ffmpeg-codecs.html#libx264
coder 1;
b_strategy 2;
bf 3;
refs 10;
}
# audio encoder name. can be:
# libaacplus: use aac(libaacplus) audio encoder.
# copy: donot encoder the audio stream, copy it.
# an: disable audio output.
acodec libaacplus;
# audio bitrate, in kbps. [16, 72] for libaacplus.
abitrate 70;
# audio sample rate. for flv/rtmp, it must be:
# 44100,22050,11025,5512
asample_rate 44100;
# audio channel, 1 for mono, 2 for stereo.
achannels 2;
# other ffmpeg audio params
aparams {
# audio params, @see: http://ffmpeg.org/ffmpeg-codecs.html#Audio-Encoders
profile:a aac_low;
}
# output format, can be:
# off, do not specifies the format, ffmpeg will guess it.
# flv, for flv or RTMP stream.
# other format, for example, mp4/aac whatever.
# default: flv
oformat flv;
# output stream. variables:
# [vhost] the input stream vhost.
# [port] the intput stream port.
# [app] the input stream app.
# [stream] the input stream name.
# [engine] the tanscode engine name.
output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine];
}
engine ffhd {
enabled on;
vcodec libx264;
vbitrate 1200;
vfps 25;
vwidth 1382;
vheight 576;
vthreads 6;
vprofile main;
vpreset medium;
vparams {
}
acodec libaacplus;
abitrate 70;
asample_rate 44100;
achannels 2;
aparams {
}
output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine];
}
engine ffsd {
enabled on;
vcodec libx264;
vbitrate 800;
vfps 25;
vwidth 1152;
vheight 480;
vthreads 4;
vprofile main;
vpreset fast;
vparams {
}
acodec libaacplus;
abitrate 60;
asample_rate 44100;
achannels 2;
aparams {
}
output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine];
}
engine fffast {
enabled on;
vcodec libx264;
vbitrate 300;
vfps 20;
vwidth 768;
vheight 320;
vthreads 2;
vprofile baseline;
vpreset superfast;
vparams {
}
acodec libaacplus;
abitrate 45;
asample_rate 44100;
achannels 2;
aparams {
}
output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine];
}
engine vcopy {
enabled on;
vcodec copy;
acodec libaacplus;
abitrate 45;
asample_rate 44100;
achannels 2;
aparams {
}
output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine];
}
engine acopy {
enabled on;
vcodec libx264;
vbitrate 300;
vfps 20;
vwidth 768;
vheight 320;
vthreads 2;
vprofile baseline;
vpreset superfast;
vparams {
}
acodec copy;
output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine];
}
engine copy {
enabled on;
vcodec copy;
acodec copy;
output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine];
}
}
}
# transcode all stream using the empty ffmpeg demo, donothing.
vhost ffempty.transcode.srs.com {
transcode {
enabled on;
ffmpeg ./objs/research/ffempty;
engine empty {
enabled on;
vcodec libx264;
vbitrate 300;
vfps 20;
vwidth 768;
vheight 320;
vthreads 2;
vprofile baseline;
vpreset superfast;
vparams {
}
acodec libaacplus;
abitrate 45;
asample_rate 44100;
achannels 2;
aparams {
}
output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine];
}
}
}
# transcode all app and stream of app
vhost app.transcode.srs.com {
# the streaming transcode configs.
# if app specified, transcode all streams of app.
transcode live {
enabled on;
ffmpeg ./objs/ffmpeg/bin/ffmpeg;
engine {
enabled off;
}
}
}
# transcode specified stream.
vhost stream.transcode.srs.com {
# the streaming transcode configs.
# if stream specified, transcode the matched stream.
transcode live/livestream {
enabled on;
ffmpeg ./objs/ffmpeg/bin/ffmpeg;
engine {
enabled off;
}
}
}
# vhost for bandwidth check
# generally, the bandcheck vhost must be: bandcheck.srs.com,
# or need to modify the vhost of client.
vhost bandcheck.srs.com {
enabled on;
chunk_size 65000;
# bandwidth check config.
bandcheck {
# whether support bandwidth check,
# default: off.
enabled on;
# the key for server to valid,
# if invalid key, server disconnect and abort the bandwidth check.
key "35c9b402c12a7246868752e2878f7e0e";
# the interval in seconds for bandwidth check,
# server donot allow new test request.
# default: 30
interval 30;
# the max available check bandwidth in kbps.
# to avoid attack of bandwidth check.
# default: 1000
limit_kbps 4000;
}
}
# set the chunk size of vhost.
vhost chunksize.srs.com {
# the default chunk size is 128, max is 65536,
# some client does not support chunk size change,
# vhost chunk size will override the global value.
# default: global chunk size.
chunk_size 128;
}
# vhost for time jitter
vhost jitter.srs.com {
# about the stream monotonically increasing:
# 1. video timestamp is monotonically increasing,
# 2. audio timestamp is monotonically increasing,
# 3. video and audio timestamp is interleaved monotonically increasing.
# it's specified by RTMP specification, @see 3. Byte Order, Alignment, and Time Format
# however, some encoder cannot provides this feature, please set this to off to ignore time jitter.
# the time jitter algorithm:
# 1. full, to ensure stream start at zero, and ensure stream monotonically increasing.
# 2. zero, only ensure sttream start at zero, ignore timestamp jitter.
# 3. off, disable the time jitter algorithm, like atc.
# default: full
time_jitter full;
}
# vhost for atc.
vhost atc.srs.com {
# vhost for atc for hls/hds/rtmp backup.
# generally, atc default to off, server delivery rtmp stream to client(flash) timestamp from 0.
# when atc is on, server delivery rtmp stream by absolute time.
# atc is used, for instance, encoder will copy stream to master and slave server,
# server use atc to delivery stream to edge/client, where stream time from master/slave server
# is always the same, client/tools can slice RTMP stream to HLS according to the same time,
# if the time not the same, the HLS stream cannot slice to support system backup.
#
# @see http://www.adobe.com/cn/devnet/adobe-media-server/articles/varnish-sample-for-failover.html
# @see http://www.baidu.com/#wd=hds%20hls%20atc
#
# default: off
atc on;
# whether enable the auto atc,
# if enabled, detect the bravo_atc="true" in onMetaData packet,
# set atc to on if matched.
# always ignore the onMetaData if atc_auto is off.
# default: on
atc_auto on;
}
# the vhost disabled.
vhost removed.srs.com {
# whether the vhost is enabled.
# if off, all request access denied.
# default: on
enabled off;
}
# config for the pithy print,
# which always print constant message specified by interval,
# whatever the clients in concurrency.
pithy_print {
# shared print interval for all publish clients, in milliseconds.
# default: 10000
publish 10000;
# shared print interval for all play clients, in milliseconds.
# default: 10000
play 10000;
# shared print interval for all forwarders, in milliseconds.
# default: 10000
forwarder 10000;
# shared print interval for all encoders, in milliseconds.
# default: 10000
encoder 10000;
# shared print interval for all ingesters, in milliseconds.
# default: 10000
ingester 10000;
# shared print interval for all hls, in milliseconds.
# default: 10000
hls 10000;
# shared print interval for all edge, in milliseconds.
# default: 10000
edge 10000;
}

@ -0,0 +1,14 @@
# the config for srs to delivery hls
# @see https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_SampleHLS
# @see full.conf for detail config.
listen 1935;
max_connections 1000;
vhost __defaultVhost__ {
hls {
enabled on;
hls_path ./objs/nginx/html;
hls_fragment 10;
hls_window 60;
}
}

@ -0,0 +1,23 @@
# the config for srs http heartbeat, report its info to api-server
# @see full.conf for detail config.
listen 1935
max_connections 1000;
heartbeat {
enabled on;
interval 9.3;
# for python api-server
url http://127.0.0.1:8085/api/v1/servers;
device_id "my-srs-device";
# for ossrs.net monitor, device_id is the key genereated by bsm.
#url http://www.ossrs.net:1977/api/v1/robots/servers;
#device_id "35c9b402c12a7246868752e2878f7e0e";
# with detail summaries
summaries on;
}
stats {
network 0;
disk sda sdb xvda xvdb;
}
vhost __defaultVhost__ {
}

@ -0,0 +1,19 @@
# the config for srs to delivery hls
# @see https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_SampleHLS
# @see full.conf for detail config.
listen 1935;
max_connections 1000;
http_stream {
enabled on;
listen 8080;
dir ./objs/nginx/html;
}
vhost __defaultVhost__ {
hls {
enabled on;
hls_path ./objs/nginx/html;
hls_fragment 10;
hls_window 60;
}
}

@ -0,0 +1,18 @@
# http-hooks or http-callbacks config for srs.
# @see full.conf for detail config.
listen 1935;
max_connections 1000;
srs_log_tank file;
srs_log_file ./objs/srs.log;
vhost __defaultVhost__ {
http_hooks {
enabled on;
on_connect http://127.0.0.1:8085/api/v1/clients http://localhost:8085/api/v1/clients;
on_close http://127.0.0.1:8085/api/v1/clients http://localhost:8085/api/v1/clients;
on_publish http://127.0.0.1:8085/api/v1/streams http://localhost:8085/api/v1/streams;
on_unpublish http://127.0.0.1:8085/api/v1/streams http://localhost:8085/api/v1/streams;
on_play http://127.0.0.1:8085/api/v1/sessions http://localhost:8085/api/v1/sessions;
on_stop http://127.0.0.1:8085/api/v1/sessions http://localhost:8085/api/v1/sessions;
}
}

@ -0,0 +1,20 @@
# use ffmpeg to ingest file/stream/device to SRS
# @see https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_SampleIngest
# @see full.conf for detail config.
listen 1935;
max_connections 1000;
vhost __defaultVhost__ {
ingest livestream {
enabled on;
input {
type file;
url ./doc/source.200kbps.768x320.flv;
}
ffmpeg ./objs/ffmpeg/bin/ffmpeg;
engine {
enabled off;
output rtmp://127.0.0.1:[port]/live?vhost=[vhost]/livestream;
}
}
}

@ -0,0 +1,10 @@
# the config for srs origin-edge cluster
# @see https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_Edge
# @see full.conf for detail config.
listen 19350;
max_connections 1000;
pid objs/origin.pid;
srs_log_file ./objs/origin.log;
vhost __defaultVhost__ {
}

@ -0,0 +1,10 @@
# the config for srs to delivery realtime RTMP stream
# @see https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_SampleRealtime
# @see full.conf for detail config.
listen 1935;
max_connections 1000;
vhost __defaultVhost__ {
gop_cache off;
queue_length 10;
}

@ -0,0 +1,8 @@
# the config for srs to delivery RTMP
# @see https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_SampleRTMP
# @see full.conf for detail config.
listen 1935;
max_connections 1000;
vhost __defaultVhost__ {
}

@ -0,0 +1,22 @@
# main config for srs.
# @see full.conf for detail config.
listen 1935;
max_connections 1000;
srs_log_tank file;
srs_log_file ./objs/srs.log;
http_api {
enabled on;
listen 1985;
}
http_stream {
enabled on;
listen 8080;
dir ./objs/nginx/html;
}
stats {
network 0;
disk sda sdb xvda xvdb;
}
vhost __defaultVhost__ {
}

@ -0,0 +1,29 @@
# the config for srs to delivery hls
# @see https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_SampleHLS
# @see full.conf for detail config.
listen 1935;
max_connections 1000;
vhost __defaultVhost__ {
hls {
enabled on;
hls_path ./objs/nginx/html;
hls_fragment 10;
hls_window 60;
}
transcode {
enabled on;
ffmpeg ./objs/ffmpeg/bin/ffmpeg;
engine ff {
enabled on;
vcodec copy;
acodec libaacplus;
abitrate 45;
asample_rate 44100;
achannels 2;
aparams {
}
output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine];
}
}
}

635
trunk/configure vendored

@ -0,0 +1,635 @@
#!/bin/bash
#####################################################################################
# the main output dir, all configure and make output are in this dir.
#####################################################################################
# create the main objs
SRS_OBJS="objs"
mkdir -p ${SRS_OBJS}
#####################################################################################
# linux shell color support.
RED="\\e[31m"
GREEN="\\e[32m"
YELLOW="\\e[33m"
BLACK="\\e[0m"
#####################################################################################
# parse user options, set the variables like:
# srs features: SRS_SSL/SRS_HLS/SRS_NGINX/SRS_FFMPEG_TOOL/SRS_HTTP_CALLBACK/......
# build options: SRS_JOBS
#####################################################################################
SRS_AUTO_HEADERS_H="${SRS_OBJS}/srs_auto_headers.hpp"
# parse options, exit with error when parse options invalid.
. auto/options.sh
# clean the exists
# do this only when the options is ok.
if [[ -f Makefile ]]; then
make clean
fi
# write user options to headers
echo "// auto generated by configure" > $SRS_AUTO_HEADERS_H
echo "#ifndef SRS_AUTO_HEADER_HPP" >> $SRS_AUTO_HEADERS_H
echo "#define SRS_AUTO_HEADER_HPP" >> $SRS_AUTO_HEADERS_H
echo "" >> $SRS_AUTO_HEADERS_H
echo "#define SRS_AUTO_BUILD_TS \"`date +%s`\"" >> $SRS_AUTO_HEADERS_H
echo "#define SRS_AUTO_BUILD_DATE \"`date \"+%Y-%m-%d %H:%M:%S\"`\"" >> $SRS_AUTO_HEADERS_H
echo "#define SRS_AUTO_UNAME \"`uname -a`\"" >> $SRS_AUTO_HEADERS_H
echo "#define SRS_AUTO_USER_CONFIGURE \"${SRS_AUTO_USER_CONFIGURE}\"" >> $SRS_AUTO_HEADERS_H
echo "#define SRS_AUTO_CONFIGURE \"${SRS_AUTO_CONFIGURE}\"" >> $SRS_AUTO_HEADERS_H
# new empty line to auto headers file.
echo "" >> $SRS_AUTO_HEADERS_H
#####################################################################################
# generate auto headers file, depends on the finished of options.sh
#####################################################################################
if [ $SRS_ARM_UBUNTU12 = YES ]; then
__SrsArmCC="arm-linux-gnueabi-gcc";
__SrsArmGCC="arm-linux-gnueabi-gcc";
__SrsArmCXX="arm-linux-gnueabi-g++";
__SrsArmAR="arm-linux-gnueabi-ar";
__SrsArmLD="arm-linux-gnueabi-ld";
__SrsArmRANDLIB="arm-linux-gnueabi-ranlib";
fi
if [ $SRS_MIPS_UBUNTU12 = YES ]; then
__SrsArmCC="mipsel-openwrt-linux-gcc";
__SrsArmGCC="mipsel-openwrt-linux-gcc";
__SrsArmCXX="mipsel-openwrt-linux-g++";
__SrsArmAR="mipsel-openwrt-linux-ar";
__SrsArmLD="mipsel-openwrt-linux-ld";
__SrsArmRANDLIB="mipsel-openwrt-linux-ranlib";
fi
# the arm-ubuntu12 options for make for depends
if [[ -z $SrsArmCC ]]; then SrsArmCC=$__SrsArmCC; fi
if [[ -z $SrsArmGCC ]]; then SrsArmGCC=$__SrsArmGCC; fi
if [[ -z $SrsArmCXX ]]; then SrsArmCXX=$__SrsArmCXX; fi
if [[ -z $SrsArmAR ]]; then SrsArmAR=$__SrsArmAR; fi
if [[ -z $SrsArmLD ]]; then SrsArmLD=$__SrsArmLD; fi
if [[ -z $SrsArmRANDLIB ]]; then SrsArmRANDLIB=$__SrsArmRANDLIB; fi
# write to source file
if [ $SRS_EMBEDED_CPU = YES ]; then
echo "cc=$SrsArmCC gcc=$SrsArmGCC g++=$SrsArmCXX ar=$SrsArmAR ld=$SrsArmLD randlib=$SrsArmRANDLIB"
echo "#define SRS_AUTO_EMBEDED_TOOL_CHAIN \"cc=$SrsArmCC gcc=$SrsArmGCC g++=$SrsArmCXX ar=$SrsArmAR ld=$SrsArmLD randlib=$SrsArmRANDLIB\"" >> $SRS_AUTO_HEADERS_H
else
echo "#define SRS_AUTO_EMBEDED_TOOL_CHAIN \"normal x86/x64 gcc\"" >> $SRS_AUTO_HEADERS_H
fi
echo "" >> $SRS_AUTO_HEADERS_H
# apply user options.
. auto/depends.sh
# auto header EOF.
echo "#endif" >> $SRS_AUTO_HEADERS_H
echo "" >> $SRS_AUTO_HEADERS_H
#####################################################################################
# generate Makefile.
#####################################################################################
SRS_MAKEFILE="Makefile"
# ubuntu echo in Makefile cannot display color, use bash instead
SRS_BUILD_SUMMARY="_srs_build_summary.sh"
#####################################################################################
# srs-librtmp sample entry
SrsLibrtmpSampleEntry="nossl"
if [ $SRS_SSL = YES ]; then SrsLibrtmpSampleEntry="ssl";fi
# utest make entry, (cd utest; make)
SrsUtestMakeEntry="@echo -e \"ignore utest for it's disabled\""
if [ $SRS_UTEST = YES ]; then SrsUtestMakeEntry="(cd ${SRS_OBJS}/utest; \$(MAKE))"; fi
#####################################################################################
# colorful summary
SrsHlsSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_HLS = YES ]; then SrsHlsSummaryColor="\${GREEN}"; fi
SrsDvrSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_DVR = YES ]; then SrsDvrSummaryColor="\${GREEN}"; fi
SrsNginxSummaryColor="\${GREEN}{disabled} "; if [ $SRS_NGINX = YES ]; then SrsNginxSummaryColor="\${GREEN}"; fi
SrsSslSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_SSL = YES ]; then SrsSslSummaryColor="\${GREEN}"; fi
SrsFfmpegSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_FFMPEG_TOOL = YES ]; then SrsFfmpegSummaryColor="\${GREEN}"; fi
SrsTranscodeSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_TRANSCODE = YES ]; then SrsTranscodeSummaryColor="\${GREEN}"; fi
SrsIngestSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_INGEST = YES ]; then SrsIngestSummaryColor="\${GREEN}"; fi
SrsHttpCallbackSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_HTTP_CALLBACK = YES ]; then SrsHttpCallbackSummaryColor="\${GREEN}"; fi
SrsHttpServerSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_HTTP_SERVER = YES ]; then SrsHttpServerSummaryColor="\${GREEN}"; fi
SrsHttpApiSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_HTTP_API = YES ]; then SrsHttpApiSummaryColor="\${GREEN}"; fi
SrsLibrtmpSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_LIBRTMP = YES ]; then SrsLibrtmpSummaryColor="\${GREEN}"; fi
SrsLibrtmpSSLSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_LIBRTMP = YES ]; then if [ $SRS_SSL = YES ]; then SrsLibrtmpSSLSummaryColor="\${GREEN}"; fi fi
SrsResearchSummaryColor="\${GREEN}{disabled} "; if [ $SRS_RESEARCH = YES ]; then SrsResearchSummaryColor="\${GREEN}"; fi
SrsUtestSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_UTEST = YES ]; then SrsUtestSummaryColor="\${GREEN}"; fi
SrsGperfSummaryColor="\${GREEN}{disabled} "; if [ $SRS_GPERF = YES ]; then SrsGperfSummaryColor="\${GREEN}"; fi
SrsGperfMCSummaryColor="\${GREEN}{disabled} "; if [ $SRS_GPERF_MC = YES ]; then SrsGperfMCSummaryColor="\${YELLOW}"; fi
SrsGperfMPSummaryColor="\${GREEN}{disabled} "; if [ $SRS_GPERF_MP = YES ]; then SrsGperfMPSummaryColor="\${YELLOW}"; fi
SrsGperfCPSummaryColor="\${GREEN}{disabled} "; if [ $SRS_GPERF_CP = YES ]; then SrsGperfCPSummaryColor="\${YELLOW}"; fi
SrsGprofSummaryColor="\${GREEN}{disabled} "; if [ $SRS_GPROF = YES ]; then SrsGprofSummaryColor="\${YELLOW}"; fi
cat <<END > ${SRS_OBJS}/${SRS_BUILD_SUMMARY}
#!/bin/bash
#####################################################################################
# linux shell color support.
RED="\\${RED}"
GREEN="\\${GREEN}"
YELLOW="\\${YELLOW}"
BLACK="\\${BLACK}"
echo -e "\${GREEN}build summary:\${BLACK}"
echo -e " \${BLACK}+------------------------------------------------------------------------------------\${BLACK}"
echo -e " |${SrsGperfSummaryColor}gperf @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_GPERF\${BLACK}"
echo -e " | ${SrsGperfMCSummaryColor}gmc @see: http://google-perftools.googlecode.com/svn/trunk/doc/heap_checker.html\${BLACK}"
echo -e " | ${SrsGperfMCSummaryColor}gmc: gperf memory check\${BLACK}"
echo -e " | ${SrsGperfMCSummaryColor}env PPROF_PATH=./objs/pprof HEAPCHECK=normal ./objs/srs -c conf/console.conf # start gmc\${BLACK}"
echo -e " | ${SrsGperfMCSummaryColor}killall -2 srs # or CTRL+C to stop gmc\${BLACK}"
echo -e " | ${SrsGperfMPSummaryColor}gmp @see: http://google-perftools.googlecode.com/svn/trunk/doc/heapprofile.html\${BLACK}"
echo -e " | ${SrsGperfMPSummaryColor}gmp: gperf memory profile\${BLACK}"
echo -e " | ${SrsGperfMPSummaryColor}rm -f gperf.srs.gmp*; ./objs/srs -c conf/console.conf # start gmp\${BLACK}"
echo -e " | ${SrsGperfMPSummaryColor}killall -2 srs # or CTRL+C to stop gmp\${BLACK}"
echo -e " | ${SrsGperfMPSummaryColor}./objs/pprof --text objs/srs gperf.srs.gmp* # to analysis memory profile\${BLACK}"
echo -e " | ${SrsGperfCPSummaryColor}gcp @see: http://google-perftools.googlecode.com/svn/trunk/doc/cpuprofile.html\${BLACK}"
echo -e " | ${SrsGperfCPSummaryColor}gcp: gperf cpu profile\${BLACK}"
echo -e " | ${SrsGperfCPSummaryColor}rm -f gperf.srs.gcp*; ./objs/srs -c conf/console.conf # start gcp\${BLACK}"
echo -e " | ${SrsGperfCPSummaryColor}killall -2 srs # or CTRL+C to stop gcp\${BLACK}"
echo -e " | ${SrsGperfCPSummaryColor}./objs/pprof --text objs/srs gperf.srs.gcp* # to analysis cpu profile\${BLACK}"
echo -e " \${BLACK}+------------------------------------------------------------------------------------\${BLACK}"
echo -e " |${SrsGprofSummaryColor}gprof @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_GPROF\${BLACK}"
echo -e " |${SrsGprofSummaryColor}gprof: GNU profile tool, @see: http://www.cs.utah.edu/dept/old/texinfo/as/gprof.html\${BLACK}"
echo -e " | ${SrsGprofSummaryColor}rm -f gmon.out; ./objs/srs -c conf/console.conf # start gprof\${BLACK}"
echo -e " | ${SrsGprofSummaryColor}killall -2 srs # or CTRL+C to stop gprof\${BLACK}"
echo -e " | ${SrsGprofSummaryColor}gprof -b ./objs/srs gmon.out > gprof.srs.log && rm -f gmon.out # gprof report to gprof.srs.log\${BLACK}"
echo -e " \${BLACK}+------------------------------------------------------------------------------------\${BLACK}"
echo -e " |${SrsResearchSummaryColor}research: ./objs/research, api server, players, ts info, librtmp.\${BLACK}"
echo -e " \${BLACK}+------------------------------------------------------------------------------------\${BLACK}"
echo -e " |${SrsUtestSummaryColor}utest: ./objs/srs_utest, the utest for srs\${BLACK}"
echo -e " \${BLACK}+------------------------------------------------------------------------------------\${BLACK}"
echo -e " |${SrsLibrtmpSummaryColor}librtmp @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_SrsLibrtmp\${BLACK}"
echo -e " |${SrsLibrtmpSummaryColor}librtmp: ./objs/include, ./objs/lib, the srs-librtmp library\${BLACK}"
echo -e " | ${SrsLibrtmpSummaryColor}simple handshake: publish/play stream with simple handshake to server\${BLACK}"
echo -e " | ${SrsLibrtmpSSLSummaryColor}complex handshake: it's not required for client, recommend disable it\${BLACK}"
echo -e " | ${SrsLibrtmpSummaryColor}librtmp-sample: ./research/librtmp, the srs-librtmp client sample\${BLACK}"
echo -e " | ${SrsLibrtmpSummaryColor}librtmp-sample: ./research/librtmp/objs/srs_ingest_flv\${BLACK}"
echo -e " | ${SrsLibrtmpSummaryColor}librtmp-sample: ./research/librtmp/objs/srs_ingest_rtmp\${BLACK}"
echo -e " | ${SrsLibrtmpSummaryColor}librtmp-sample: ./research/librtmp/objs/srs_detect_rtmp\${BLACK}"
echo -e " | ${SrsLibrtmpSummaryColor}librtmp-sample: ./research/librtmp/objs/srs_bandwidth_check\${BLACK}"
echo -e " \${BLACK}+------------------------------------------------------------------------------------\${BLACK}"
echo -e " |\${GREEN}server: ./objs/srs -c conf/srs.conf, start the srs server\${BLACK}"
echo -e " | ${SrsHlsSummaryColor}hls @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_DeliveryHLS\${BLACK}"
echo -e " | ${SrsHlsSummaryColor}hls: generate m3u8 and ts from rtmp stream\${BLACK}"
echo -e " | ${SrsDvrSummaryColor}dvr @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_DVR\${BLACK}"
echo -e " | ${SrsDvrSummaryColor}dvr: record RTMP stream to flv files.\${BLACK}"
echo -e " | ${SrsNginxSummaryColor}nginx @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_DeliveryHLS\${BLACK}"
echo -e " | ${SrsNginxSummaryColor}nginx: delivery HLS stream by nginx\${BLACK}"
echo -e " | ${SrsNginxSummaryColor}nginx: sudo ./objs/nginx/sbin/nginx\${BLACK}"
echo -e " | ${SrsSslSummaryColor}ssl @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_RTMPHandshake\${BLACK}"
echo -e " | ${SrsSslSummaryColor}ssl: support RTMP complex handshake for client required, for instance, flash\${BLACK}"
echo -e " | ${SrsFfmpegSummaryColor}ffmpeg @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_FFMPEG\${BLACK}"
echo -e " | ${SrsFfmpegSummaryColor}ffmpeg: transcode, mux, ingest tool\${BLACK}"
echo -e " | ${SrsFfmpegSummaryColor}ffmpeg: ./objs/ffmpeg/bin/ffmpeg\${BLACK}"
echo -e " | ${SrsTranscodeSummaryColor}transcode @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_FFMPEG\${BLACK}"
echo -e " | ${SrsTranscodeSummaryColor}transcode: support transcoding RTMP stream\${BLACK}"
echo -e " | ${SrsIngestSummaryColor}ingest @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_Ingest\${BLACK}"
echo -e " | ${SrsIngestSummaryColor}ingest: support ingest file/stream/device then push to SRS by RTMP stream\${BLACK}"
echo -e " | ${SrsHttpCallbackSummaryColor}http-callback @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_HTTPCallback\${BLACK}"
echo -e " | ${SrsHttpCallbackSummaryColor}http-callback: support http callback for authentication and event injection\${BLACK}"
echo -e " | ${SrsHttpServerSummaryColor}http-server @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_HTTPServer\${BLACK}"
echo -e " | ${SrsHttpServerSummaryColor}http-server: support http server to delivery http stream\${BLACK}"
echo -e " | ${SrsHttpApiSummaryColor}http-api @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_HTTPApi\${BLACK}"
echo -e " | ${SrsHttpApiSummaryColor}http-api: support http api to manage server\${BLACK}"
echo -e " \${BLACK}+------------------------------------------------------------------------------------\${BLACK}"
echo -e "\${GREEN}binaries @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_Build\${BLACK}"
echo "you can:"
echo " ./objs/srs -c conf/srs.conf"
echo " to start the srs server, with config conf/srs.conf."
END
#####################################################################################
# makefile
echo "generate Makefile"
cat << END > ${SRS_MAKEFILE}
.PHONY: default _default install install-api help clean server librtmp utest _prepare_dir
# install prefix.
SRS_PREFIX=${SRS_PREFIX}
__REAL_INSTALL=\$(DESTDIR)\$(SRS_PREFIX)
END
# embeded, ubuntu12, use embeded tool chain.
if [ $SRS_EMBEDED_CPU = YES ]; then
cat << END >> ${SRS_MAKEFILE}
default:
\$(MAKE) GCC=${SrsArmGCC} CXX=${SrsArmCXX} AR=${SrsArmAR} LINK=${SrsArmCXX} _default
END
# x86/x64, use gnu-gcc/g++ tool chain.
else
cat << END >> ${SRS_MAKEFILE}
default:
\$(MAKE) _default
END
fi
# the real entry for all platform.
cat << END >> ${SRS_MAKEFILE}
_default: server librtmp utest
@bash objs/_srs_build_summary.sh
help:
@echo "Usage: make <help>|<clean>|<server>|<librtmp>|<utest>|<install>|<install-api>|<uninstall>"
@echo " help display this help menu"
@echo " clean cleanup project"
@echo " server build the srs(simple rtmp server) over st(state-threads)"
@echo " librtmp build the client publish/play library, and samples"
@echo " utest build the utest for srs"
@echo " install install srs to the prefix path"
@echo " install-api install srs and api-server to the prefix path"
@echo " uninstall uninstall srs from prefix path"
clean:
(cd ${SRS_OBJS}; rm -rf srs srs_utest)
(cd ${SRS_OBJS}; rm -rf src research include lib)
(cd ${SRS_OBJS}/utest; rm -rf *.o *.a)
(cd research/librtmp; make clean)
(cd research/api-server/static-dir; rm -rf crossdomain.xml forward live players)
server: _prepare_dir
@echo "build the srs(simple rtmp server) over st(state-threads)"
\$(MAKE) -f ${SRS_OBJS}/${SRS_MAKEFILE} srs
END
# install entry
cat << END >> ${SRS_MAKEFILE}
uninstall:
@echo "rmdir \$(SRS_PREFIX)"
@rm -rf \$(SRS_PREFIX)
install-api: install
@echo "mkdir \$(__REAL_INSTALL)"
@mkdir -p \$(__REAL_INSTALL)
@echo "copy binary files"
@mkdir -p \$(__REAL_INSTALL)/research/api-server
@cp research/api-server/server.py \$(__REAL_INSTALL)/research/api-server
@mkdir -p \$(__REAL_INSTALL)/objs/ffmpeg/bin
@cp objs/ffmpeg/bin/ffmpeg \$(__REAL_INSTALL)/objs/ffmpeg/bin
@echo "copy html files"
@mkdir -p \$(__REAL_INSTALL)/research/api-server/static-dir/players
@cp research/api-server/static-dir/crossdomain.xml \$(__REAL_INSTALL)/research/api-server/static-dir
@cp research/api-server/static-dir/index.html \$(__REAL_INSTALL)/research/api-server/static-dir
@cp -r research/api-server/static-dir/players/* \$(__REAL_INSTALL)/research/api-server/static-dir/players
@echo "copy init.d script files"
@mkdir -p \$(__REAL_INSTALL)/etc/init.d
@cp etc/init.d/srs-api \$(__REAL_INSTALL)/etc/init.d
@sed -i "s|^ROOT=.*|ROOT=\"\$(SRS_PREFIX)\"|g" \$(__REAL_INSTALL)/etc/init.d/srs-api
@echo ""
@echo "api installed, to link and start api:"
@echo " sudo ln -sf \$(SRS_PREFIX)/etc/init.d/srs-api /etc/init.d/srs-api"
@echo " /etc/init.d/srs-api start"
@echo " http://\$(shell bash auto/local_ip.sh):8085"
@echo "@see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_LinuxService"
install:
@echo "mkdir \$(__REAL_INSTALL)"
@mkdir -p \$(__REAL_INSTALL)
@echo "make the http root dir"
@mkdir -p \$(__REAL_INSTALL)/objs/nginx/html
@cp research/api-server/static-dir/crossdomain.xml \$(__REAL_INSTALL)/objs/nginx/html
@echo "copy binary files"
@mkdir -p \$(__REAL_INSTALL)/objs
@cp objs/srs \$(__REAL_INSTALL)/objs
@echo "copy srs conf files"
@mkdir -p \$(__REAL_INSTALL)/conf
@cp conf/*.conf \$(__REAL_INSTALL)/conf
@echo "copy init.d script files"
@mkdir -p \$(__REAL_INSTALL)/etc/init.d
@cp etc/init.d/srs \$(__REAL_INSTALL)/etc/init.d
@sed -i "s|^ROOT=.*|ROOT=\"\$(SRS_PREFIX)\"|g" \$(__REAL_INSTALL)/etc/init.d/srs
@echo ""
@echo "srs installed, to link and start srs:"
@echo " sudo ln -sf \$(SRS_PREFIX)/etc/init.d/srs /etc/init.d/srs"
@echo " /etc/init.d/srs start"
@echo "@see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_LinuxService"
END
if [ $SRS_LIBRTMP = YES ]; then
cat << END >> ${SRS_MAKEFILE}
librtmp: server
@echo "build the client publish/play library."
\$(MAKE) -f ${SRS_OBJS}/${SRS_MAKEFILE} librtmp
@echo "build the srs-librtmp sample"
(cd research/librtmp; \$(MAKE) ${SrsLibrtmpSampleEntry})
END
else
cat << END >> ${SRS_MAKEFILE}
librtmp: server
@echo "srs-librtmp is disabled, ignore."
END
fi
if [ $SRS_UTEST = YES ]; then
cat << END >> ${SRS_MAKEFILE}
utest: server
@echo "build the utest for srs"
${SrsUtestMakeEntry}
@echo "utest for srs build success"
END
else
cat << END >> ${SRS_MAKEFILE}
utest: server
@echo "utest is disabled, ignore"
END
fi
cat << END >> ${SRS_MAKEFILE}
# the ./configure will generate it.
_prepare_dir:
@mkdir -p ${SRS_OBJS}
END
#####################################################################################
# build tools or compiler args.
# enable gdb debug
GDBDebug=" -g -O0"
# the warning level.
WarnLevel=" -Wall"
# the compile standard.
CppStd="-ansi"
# for library compile
LibraryCompile=" -fPIC"
# performance of gprof
SrsGprof=""; SrsGprofLink=""; if [ $SRS_GPROF = YES ]; then SrsGprof=" -pg -lc_p"; SrsGprofLink=" -pg"; fi
# performance of gperf
SrsGperf=""; SrsGperfLink=""; if [ $SRS_GPERF = YES ]; then SrsGperfLink=" -lpthread"; fi
# the cxx flag generated.
CXXFLAGS="${CppStd}${WarnLevel}${GDBDebug}${LibraryCompile}${SrsGprof}"
if [ $SRS_GPERF = YES ]; then CXXFLAGS="${CXXFLAGS} -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free"; fi
cat << END > ${SRS_OBJS}/${SRS_MAKEFILE}
GCC = gcc
CXX = g++
AR = ar
LINK = g++
CXXFLAGS = ${CXXFLAGS}
.PHONY: default srs librtmp
default:
END
#####################################################################################
# Libraries, external library to build in srs,
# header(.h): add to ModuleLibIncs if need the specified library. for example, LibSTRoot
# library(.a): add to ModuleLibFiles if binary need the specifeid library. for example, LibSTfile
#
# st(state-threads) the basic network library for SRS.
LibSTRoot="${SRS_OBJS}/st"; LibSTfile="${LibSTRoot}/libst.a"
# hp(http-parser) the http request/url parser, for SRS to support HTTP callback.
LibHttpParserRoot=""; LibHttpParserfile=""
if [ $SRS_HTTP_PARSER = YES ]; then LibHttpParserRoot="${SRS_OBJS}/hp"; LibHttpParserfile="${LibHttpParserRoot}/libhttp_parser.a"; fi
# openssl-1.0.1f, for the RTMP complex handshake.
LibSSLRoot="";LibSSLfile=""
if [ $SRS_SSL = YES ]; then if [ $SRS_USE_SYS_SSL = NO ]; then LibSSLRoot="${SRS_OBJS}/openssl/include"; LibSSLfile="${SRS_OBJS}/openssl/lib/libssl.a ${SRS_OBJS}/openssl/lib/libcrypto.a"; fi fi
# gperftools-2.1, for mem check and mem/cpu profile
LibGperfRoot=""; LibGperfFile=""
if [ $SRS_GPERF = YES ]; then LibGperfRoot="${SRS_OBJS}/gperf/include"; LibGperfFile="${SRS_OBJS}/gperf/lib/libtcmalloc_and_profiler.a"; fi
# the link options, always use static link
SrsLinkOptions="-ldl";
if [ $SRS_SSL = YES ]; then if [ $SRS_USE_SYS_SSL = YES ]; then SrsLinkOptions="${SrsLinkOptions} -lssl"; fi fi
# if static specified, add static
# TODO: FIXME: remove static.
if [ $SRS_STATIC = YES ]; then SrsLinkOptions="${SrsLinkOptions} -static"; fi
# if mips, add -lgcc_eh, or stl compile failed.
if [ $SRS_MIPS_UBUNTU12 = YES ]; then SrsLinkOptions="${SrsLinkOptions} -lgcc_eh"; fi
#####################################################################################
# Modules, compile each module, then link to binary
#
#Core, depends only on system apis.
MODULE_ID="CORE"
MODULE_DEPENDS=()
ModuleLibIncs=(${SRS_OBJS})
MODULE_FILES=("srs_core" "srs_core_autofree")
CORE_INCS="src/core"; MODULE_DIR=${CORE_INCS} . auto/modules.sh
CORE_OBJS="${MODULE_OBJS[@]}"
#
#Kernel, depends on core, provides error/log/config, nothing about stream information.
MODULE_ID="KERNEL"
MODULE_DEPENDS=("CORE")
ModuleLibIncs=(${SRS_OBJS})
MODULE_FILES=("srs_kernel_error" "srs_kernel_log" "srs_kernel_stream" "srs_kernel_buffer"
"srs_kernel_utility" "srs_kernel_flv" "srs_kernel_codec" "srs_kernel_file"
"srs_kernel_consts")
KERNEL_INCS="src/kernel"; MODULE_DIR=${KERNEL_INCS} . auto/modules.sh
KERNEL_OBJS="${MODULE_OBJS[@]}"
#
#RTMP Protocol, depends on core/kernel, provides rtmp/htttp protocol features.
MODULE_ID="RTMP"
MODULE_DEPENDS=("CORE" "KERNEL")
ModuleLibIncs=(${SRS_OBJS} ${LibSSLRoot})
MODULE_FILES=("srs_protocol_amf0" "srs_protocol_io" "srs_protocol_stack" "srs_protocol_rtmp"
"srs_protocol_handshake" "srs_protocol_utility" "srs_protocol_msg_array")
RTMP_INCS="src/rtmp"; MODULE_DIR=${RTMP_INCS} . auto/modules.sh
RTMP_OBJS="${MODULE_OBJS[@]}"
#
#App Module
MODULE_ID="APP"
MODULE_DEPENDS=("CORE" "KERNEL" "RTMP")
ModuleLibIncs=(${LibSTRoot} ${LibHttpParserRoot} ${SRS_OBJS})
MODULE_FILES=("srs_app_server" "srs_app_conn" "srs_app_rtmp_conn" "srs_app_st_socket" "srs_app_source"
"srs_app_refer" "srs_app_hls" "srs_app_forward" "srs_app_encoder" "srs_app_http"
"srs_app_thread" "srs_app_bandwidth" "srs_app_st" "srs_app_log" "srs_app_config"
"srs_app_pithy_print" "srs_app_reload" "srs_app_http_api" "srs_app_http_conn" "srs_app_http_hooks"
"srs_app_json" "srs_app_ingest" "srs_app_ffmpeg" "srs_app_utility" "srs_app_dvr" "srs_app_edge"
"srs_app_kbps" "srs_app_heartbeat" "srs_app_empty" "srs_app_http_client" "srs_app_avc_aac")
APP_INCS="src/app"; MODULE_DIR=${APP_INCS} . auto/modules.sh
APP_OBJS="${MODULE_OBJS[@]}"
#
#LIBS Module, build libsrs.a for static link.
MODULE_ID="LIBS"
MODULE_DEPENDS=("CORE" "KERNEL" "RTMP")
ModuleLibIncs=(${SRS_OBJS})
MODULE_FILES=("srs_librtmp" "srs_lib_simple_socket" "srs_lib_bandwidth")
LIBS_INCS="src/libs"; MODULE_DIR=${LIBS_INCS} . auto/modules.sh
LIBS_OBJS="${MODULE_OBJS[@]}"
#
#Main Module
MODULE_ID="MAIN"
MODULE_DEPENDS=("CORE" "KERNEL" "RTMP" "APP")
ModuleLibIncs=(${LibSTRoot} ${SRS_OBJS} ${LibGperfRoot})
MODULE_FILES=("srs_main_server")
MAIN_INCS="src/main"; MODULE_DIR=${MAIN_INCS} . auto/modules.sh
MAIN_OBJS="${MODULE_OBJS[@]}"
#####################################################################################
# Binaries, main entrances, link the module and its depends modules,
# then link to a binary, for example, objs/srs
#
# all main entrances
MAIN_ENTRANCES=("srs_main_server")
#
# all depends libraries
ModuleLibFiles=(${LibSTfile} ${LibHttpParserfile} ${LibSSLfile} ${LibGperfFile})
# all depends objects
MODULE_OBJS="${CORE_OBJS[@]} ${KERNEL_OBJS[@]} ${RTMP_OBJS[@]} ${APP_OBJS[@]} ${MAIN_OBJS[@]}"
LINK_OPTIONS="${SrsLinkOptions}${SrsGprofLink}${SrsGperfLink}"
#
# srs:
# srs(simple rtmp server) over st(state-threads)
BUILD_KEY="srs" APP_MAIN="srs_main_server" APP_NAME="srs" . auto/apps.sh
# srs librtmp
if [ $SRS_LIBRTMP = YES ]; then
MODULE_OBJS="${CORE_OBJS[@]} ${KERNEL_OBJS[@]} ${RTMP_OBJS[@]} ${LIBS_OBJS[@]}"
BUILD_KEY="librtmp" LIB_NAME="lib/srs_librtmp" . auto/libs.sh
fi
#
# utest, the unit-test cases of srs, base on gtest1.6
MODULE_FILES=("srs_utest" "srs_utest_amf0" "srs_utest_protocol"
"srs_utest_kernel" "srs_utest_core" "srs_utest_config"
"srs_utest_reload")
ModuleLibIncs=(${SRS_OBJS} ${LibSTRoot} ${LibSSLRoot})
ModuleLibFiles=(${LibSTfile} ${LibHttpParserfile} ${LibSSLfile})
MODULE_DEPENDS=("CORE" "KERNEL" "RTMP" "APP")
MODULE_OBJS="${CORE_OBJS[@]} ${KERNEL_OBJS[@]} ${RTMP_OBJS[@]} ${APP_OBJS[@]}"
LINK_OPTIONS="-lpthread ${SrsLinkOptions}" MODULE_DIR="src/utest" APP_NAME="srs_utest" . auto/utest.sh
echo 'configure ok! '
#####################################################################################
# when configure success, prepare build
#####################################################################################
# create objs/logs for ffmpeg to write log.
mkdir -p ${SRS_OBJS}/logs
#####################################################################################
# configure summary
#####################################################################################
# summary
echo ""
echo "configure summary:"
echo " ${SRS_AUTO_USER_CONFIGURE}"
echo " ${SRS_AUTO_CONFIGURE}"
if [ $SRS_HLS = YES ]; then
echo -e "${GREEN}HLS is enabled${BLACK}"
else
echo -e "${YELLOW}warning: without HLS support${BLACK}"
fi
if [ $SRS_NGINX = YES ]; then
echo -e "${GREEN}Nginx http server is enabled${BLACK}"
else
echo -e "${GREEN}note: Nginx http server is disabled${BLACK}"
fi
if [ $SRS_DVR = YES ]; then
echo -e "${GREEN}DVR is enabled${BLACK}"
else
echo -e "${YELLOW}warning: without DVR support${BLACK}"
fi
if [ $SRS_SSL = YES ]; then
echo -e "${GREEN}rtmp complex handshake is enabled${BLACK}"
else
echo -e "${YELLOW}warning: without rtmp complex handshake support, donot support h264/aac to adobe flash player${BLACK}"
fi
if [ $SRS_FFMPEG_TOOL = YES ]; then
echo -e "${GREEN}transcode/mux/ingest tool FFMPEG is enabled${BLACK}"
else
echo -e "${YELLOW}warning: without transcode/mux/ingest tool FFMPEG support${BLACK}"
fi
if [ $SRS_TRANSCODE = YES ]; then
echo -e "${GREEN}transcoding RTMP stream is enabled${BLACK}"
else
echo -e "${YELLOW}warning: without transcoding RTMP stream support${BLACK}"
fi
if [ $SRS_INGEST = YES ]; then
echo -e "${GREEN}ingest file/stream/device is enabled${BLACK}"
else
echo -e "${YELLOW}warning: without ingest file/stream/device support${BLACK}"
fi
if [ $SRS_HTTP_CALLBACK = YES ]; then
echo -e "${GREEN}http hooks callback over CherryPy is enabled${BLACK}"
else
echo -e "${YELLOW}warning: without http hooks callback over CherryPy support${BLACK}"
fi
if [ $SRS_HTTP_SERVER = YES ]; then
echo -e "${GREEN}http server to delivery http stream is enabled${BLACK}"
else
echo -e "${YELLOW}warning: without http server to delivery http stream support${BLACK}"
fi
if [ $SRS_HTTP_API = YES ]; then
echo -e "${GREEN}http api to manage server is enabled${BLACK}"
else
echo -e "${YELLOW}warning: without http api to manage server support${BLACK}"
fi
if [ $SRS_LIBRTMP = YES ]; then
echo -e "${GREEN}srs-librtmp for client is enabled${BLACK}"
else
echo -e "${YELLOW}note: srs-librtmp for client is disabled${BLACK}"
fi
if [ $SRS_RESEARCH = YES ]; then
echo -e "${GREEN}research tools are builded${BLACK}"
else
echo -e "${GREEN}note: research tools are not builded${BLACK}"
fi
if [ $SRS_UTEST = YES ]; then
echo -e "${GREEN}utest for srs are builded${BLACK}"
else
echo -e "${YELLOW}note: utest for srs are not builded${BLACK}"
fi
if [ $SRS_GPERF = YES ]; then
echo -e "${GREEN}gperf(tcmalloc) for srs are builded${BLACK}"
else
echo -e "${GREEN}note: gperf(tcmalloc) for srs are not builded${BLACK}"
fi
if [ $SRS_GPERF_MC = YES ]; then
echo -e "${YELLOW}gmc(gperf memory check) for srs are builded -- Performance may suffer${BLACK}"
else
echo -e "${GREEN}note: gmc(gperf memory check) for srs are not builded${BLACK}"
fi
if [ $SRS_GPERF_MP = YES ]; then
echo -e "${YELLOW}gmp(gperf memory profile) for srs are builded -- Performance may suffer${BLACK}"
else
echo -e "${GREEN}note: gmp(gperf memory profile) for srs are not builded${BLACK}"
fi
if [ $SRS_GPERF_CP = YES ]; then
echo -e "${YELLOW}gcp(gperf cpu profile) for srs are builded -- Performance may suffer${BLACK}"
else
echo -e "${GREEN}note: gcp(gperf cpu profile) for srs are not builded${BLACK}"
fi
if [ $SRS_GPROF = YES ]; then
echo -e "${YELLOW}gprof(GNU profile tool) for srs are builded -- Performance may suffer${BLACK}"
else
echo -e "${GREEN}note: gprof(GNU profile tool) for srs are not builded${BLACK}"
fi
if [ $SRS_ARM_UBUNTU12 = YES ]; then
echo -e "${GREEN}arm-ubuntu12(armhf, v7cpu) for srs are builded${BLACK}"
else
echo -e "${GREEN}note: arm-ubuntu12(armhf, v7cpu) for srs are not builded${BLACK}"
fi
if [ $SRS_MIPS_UBUNTU12 = YES ]; then
echo -e "${GREEN}mips-ubuntu12 for srs are builded${BLACK}"
else
echo -e "${GREEN}note: mips-ubuntu12 for srs are not builded${BLACK}"
fi
#####################################################################################
# next step
#####################################################################################
ip=`ifconfig|grep "inet addr"| grep -v "127.0.0.1"|awk '{print $2}'|awk -F ':' 'NR==1 {print $2}'`
echo ""
echo "to run 3rdparty application:"
if [ $SRS_NGINX = YES ]; then
echo "\" sudo ./objs/nginx/sbin/nginx \" to start the nginx http server for hls"
fi
if [ $SRS_FFMPEG_TOOL = YES ]; then
echo -e "\" ./objs/ffmpeg/bin/ffmpeg \" is used for live stream transcoding"
fi
if [ $SRS_HTTP_CALLBACK = YES ]; then
echo -e "\" python ./research/api-server/server.py 8085 \" to start the api-server"
fi
echo ""
echo "to build:"
echo "\" make \" to build the srs(simple rtmp server)."
echo "\" make help \" to get the usage of make"

Binary file not shown.

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -0,0 +1,61 @@
ffmpeg-logo.png
ffmpeg-min.png
ffmpeg的logo。
source.flv
avatar预告片400kbps。
aac-iso-13818-7.pdf
aac标准aac的编码等。
aac-mp4a-format-ISO_IEC_14496-3+2001.pdf
aac的封装标准即ts/flv里面的aac raw data标准。
amf0_spec_121207.pdf
adobe amf0标准
amf3_spec_121207.pdf
adobe amf3标准。
H.264-AVC-ISO_IEC_14496-10.pdf
avc标准编码部分。
H.264-AVC-ISO_IEC_14496-15.pdf
avc标准封装部分。
H.264_MPEG-4-Part-10-White-Paper.pdf
h264简介。
hls-m3u8-draft-pantos-http-live-streaming-12.txt
m3u8标准。
hls-mpeg-ts-iso13818-1.pdf
ts标准。
hls-mpeg-ts-VB_WhitePaper_TransportStreamVSProgramStream_rd2.pdf
ts的介绍。
rtmp.part1.Chunk-Stream.pdf
rtmp.part2.Message-Formats.pdf
rtmp.part3.Commands-Messages.pdf
rtmp_specification_1.0.pdf
adobe rtmp标准。
rtmfp-rfc7016.pdf
adobe RTMFP, http://tools.ietf.org/html/rfc7016.
rtmfp-tsvarea-1.pdf
http://www.ietf.org/proceedings/10mar/slides/tsvarea-1.pdf
flv_v10_1.pdf
video_file_format_spec_v10_1.pdf
adobe f4v/flv标准。
HTTP协议
http1.0-rfc1945.txt
http://www.rfc-editor.org/rfc/rfc1945.txt
http1.1-rfc2616.txt
http://www.rfc-editor.org/rfc/rfc2616.txt
arpa-internet-text-messages-rfc822.txt
http://www.rfc-editor.org/rfc/rfc822.txt
Winlin

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

@ -0,0 +1,197 @@
#!/bin/bash
### BEGIN INIT INFO
# Provides: simple-rtmp-server(srs)
# RequiRED-Start: $all
# RequiRED-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: simple-rtmp-server(srs)
# Description: https://github.com/winlinvip/simple-rtmp-server
### END INIT INFO
# the config of ROOT, user must modify it when start srs from other directory,
# it's ok to use the script by command ./etc/init.d/simple-rtmp-server
ROOT="./"
APP="./objs/srs"
CONFIG="./conf/srs.conf"
DEFAULT_PID_FILE='./objs/srs.pid'
DEFAULT_LOG_FILE='./objs/srs.log'
########################################################################
# utility functions
########################################################################
RED="\\e[31m"
GREEN="\\e[32m"
YELLOW="\\e[33m"
BLACK="\\e[0m"
POS="\\e[60G"
ok_msg() {
echo -e "${1}${POS}${BLACK}[${GREEN} OK ${BLACK}]"
}
failed_msg() {
echo -e "${1}${POS}${BLACK}[${RED}FAILED${BLACK}]"
}
# load process info of srs
# @set variable $srs_pid to the process id in srs.pid file.
# @return 0, if process exists; otherwise:
# 1, for pid file not exists.
# 2, for get proecess info by pid failed.
# @set variable $error_msg if error.
# @set variable $pid_file to pid file.
load_process_info() {
# get pid file
pid_file=`cd ${ROOT} && cat ${CONFIG} |grep ^pid|awk '{print $2}'|awk -F ';' '{print $1}'`
if [[ -z $pid_file ]]; then pid_file=${DEFAULT_PID_FILE}; fi
# get abs path
pid_dir=`dirname $pid_file`
pid_file=`(cd ${ROOT}; cd $pid_dir; pwd)`/`basename $pid_file`
srs_pid=`cat $pid_file 2>/dev/null`
ret=$?; if [[ 0 -ne $ret ]]; then error_msg="file $pid_file does not exists"; return 1; fi
ps -p ${srs_pid} >/dev/null 2>/dev/null
ret=$?; if [[ 0 -ne $ret ]]; then error_msg="process $srs_pid does not exists"; return 2; fi
return 0;
}
start() {
# if exists, exit.
load_process_info
if [[ 0 -eq $? ]]; then failed_msg "SRS started(pid ${srs_pid}), should not start it again."; return 0; fi
# not exists, start server
ok_msg "Starting SRS..."
# get log file
log_file=`cd ${ROOT} && cat ${CONFIG} |grep '^log_file'| awk '{print $2}'| awk -F ';' '{print $1}'`
if [[ -z $log_file ]]; then log_file=${DEFAULT_LOG_FILE}; fi
# get abs path
log_dir=`dirname $log_file`
log_file=`(cd ${ROOT} && cd $log_dir && pwd)`/`basename $log_file`
# TODO: FIXME: set limit by, for instance, "ulimit -HSn 10000"
if [[ -z $log_file ]]; then
(ulimit -c unlimited && cd ${ROOT}; ${APP} -c ${CONFIG} >/dev/null 2>&1)
else
(ulimit -c unlimited && cd ${ROOT}; ${APP} -c ${CONFIG} >> $log_file 2>&1)
fi
# check again after start server
for ((i = 0; i < 5; i++)); do
# sleep a little while, for srs may start then crash.
sleep 0.1
load_process_info
ret=$?; if [[ 0 -ne $ret ]]; then
failed_msg "SRS start failed";
failed_msg "see $log_file";
return $ret;
fi
done
# check whether started.
load_process_info
ret=$?; if [[ 0 -eq $? ]]; then ok_msg "SRS started(pid ${srs_pid})"; return 0; fi
failed_msg "SRS not started"
return $ret
}
stop() {
# not start, exit
load_process_info
if [[ 0 -ne $? ]]; then failed_msg "SRS not start."; return 0; fi
ok_msg "Stopping SRS(pid ${srs_pid})..."
# process exists, try to kill to stop normally
for((i=0;i<30;i++)); do
load_process_info
if [[ 0 -eq $? ]]; then
kill -s SIGTERM ${srs_pid} 2>/dev/null
ret=$?; if [[ 0 -ne $ret ]]; then failed_msg "send signal SIGTERM failed ret=$ret"; return $ret; fi
sleep 0.1
else
ok_msg "SRS stopped by SIGTERM"
# delete the pid file when stop success.
rm -f ${pid_file}
break;
fi
done
# process exists, use kill -9 to force to exit
load_process_info
if [[ 0 -eq $? ]]; then
kill -s SIGKILL ${srs_pid} 2>/dev/null
ret=$?; if [[ 0 -ne $ret ]]; then failed_msg "send signal SIGKILL failed ret=$ret"; return $ret; fi
ok_msg "SRS stopped by SIGKILL"
else
# delete the pid file when stop success.
rm -f ${pid_file}
fi
sleep 0.1
return 0
}
# get the status of srs process
# @return 0 if srs is running; otherwise, 1 for stopped.
status() {
load_process_info
ret=$?; if [[ 0 -eq $ret ]]; then echo "SRS(pid ${srs_pid}) is running."; return 0; fi
echo "SRS is stopped, $error_msg"
return 1
}
reload() {
# not start, exit
load_process_info
if [[ 0 -ne $? ]]; then failed_msg "SRS not start."; return 0; fi
ok_msg "Reload SRS(pid ${srs_pid})..."
# process exists, reload it
kill -s SIGHUP ${srs_pid} 2>/dev/null
ret=$?; if [[ 0 -ne $ret ]]; then failed_msg "Reload SRS failed ret=$ret"; return $ret; fi
load_process_info
if [[ 0 -ne $? ]]; then failed_msg "SRS reload failed."; return $ret; fi
ok_msg "SRS reloaded"
return 0
}
menu() {
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
status)
status
;;
reload)
reload
;;
*)
echo "Usage: $0 {start|stop|status|restart|reload}"
return 1
;;
esac
}
menu $1
code=$?
exit ${code}

@ -0,0 +1,127 @@
#!/bin/bash
### BEGIN INIT INFO
# Provides: simple-rtmp-server-api(srs-api)
# RequiRED-Start: $all
# RequiRED-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: simple-rtmp-server-api(srs-api)
# Description: https://github.com/winlinvip/simple-rtmp-server
### END INIT INFO
# the config of ROOT, user must modify it when start srs from other directory,
# it's ok to use the script by command ./etc/init.d/simple-rtmp-server
ROOT="./"
APP="python ./research/api-server/server.py"
CONFIG="8085"
########################################################################
# utility functions
########################################################################
RED="\\e[31m"
GREEN="\\e[32m"
YELLOW="\\e[33m"
BLACK="\\e[0m"
POS="\\e[60G"
ok_msg(){
echo -e "${1}${POS}${BLACK}[${GREEN} OK ${BLACK}]"
}
failed_msg(){
echo -e "${1}${POS}${BLACK}[${RED}FAILED${BLACK}]"
}
# load process info of srs-api
# @set variable $srs_api_id to the process id.
# @return 0, if process exists; otherwise:
# 1, for srs-api not exists.
# @set variable $error_msg if error.
load_process_info() {
srs_api_id=`ps aux|grep python|grep research|grep "api-server"|awk '{print $2}'`
if [[ -z $srs_api_id ]]; then error_msg="srs-api process does not exists"; return 1; fi
return 0;
}
start() {
# if exists, exit.
load_process_info
if [[ 0 -eq $? ]]; then failed_msg "SRS-api started(pid ${srs_api_id}), should not start it again."; return 0; fi
# not exists, start server
ok_msg "Starting SRS-api..."
# TODO: FIXME: set limit by, for instance, "ulimit -HSn 10000"
# TODO: FIXME: write log to, for instance, the same dir of log.
# TODO: FIXME: support deamon, without nohup.
(cd ${ROOT}; nohup ${APP} ${CONFIG} >/dev/null 2>&1 &)
# check again after start server
load_process_info
ret=$?; if [[ 0 -eq $? ]]; then ok_msg "SRS-api started(pid ${srs_api_id})"; return 0; fi
failed_msg "SRS-api not started"
return $ret
}
stop() {
# not start, exit
load_process_info
if [[ 0 -ne $? ]]; then failed_msg "SRS-api not start."; return 0; fi
ok_msg "Stopping SRS-api(pid ${srs_api_id})..."
# process exists, kill util stop
for((;;)); do
load_process_info
if [[ 0 -eq $? ]]; then
kill -s SIGKILL ${srs_api_id} 2>/dev/null
ret=$?; if [[ 0 -ne $ret ]]; then failed_msg "send signal SIGKILL failed ret=$ret"; return $ret; fi
sleep 0.1
else
ok_msg "SRS-api stopped"
break;
fi
done
sleep 0.1
return 0
}
# get the status of srs-api process
# @return 0 if srs-api is running; otherwise, 1 for stopped.
status() {
load_process_info
ret=$?; if [[ 0 -eq $ret ]]; then echo "SRS-api(pid ${srs_api_id}) is running."; return 0; fi
echo "SRS-api is stopped"
return 1
}
menu() {
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
status)
status
;;
*)
echo "Usage: $0 {start|stop|status|restart}"
return 1
;;
esac
}
menu $1
code=$?
exit ${code}

@ -0,0 +1,184 @@
#!/bin/bash
### BEGIN INIT INFO
# Provides: simple-rtmp-server(srs)
# RequiRED-Start: $all
# RequiRED-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: simple-rtmp-server(srs)
# Description: https://github.com/winlinvip/simple-rtmp-server
### END INIT INFO
# the config of ROOT, user must modify it when start srs from other directory,
# it's ok to use the script by command ./etc/init.d/simple-rtmp-server
ROOT="./"
APP="./objs/srs"
CONFIG="./conf/demo.conf"
DEFAULT_PID_FILE='./objs/srs.demo.pid'
DEFAULT_LOG_FILE='./objs/srs.demo.log'
########################################################################
# utility functions
########################################################################
RED="\\e[31m"
GREEN="\\e[32m"
YELLOW="\\e[33m"
BLACK="\\e[0m"
POS="\\e[60G"
ok_msg() {
echo -e "${1}${POS}${BLACK}[${GREEN} OK ${BLACK}]"
}
failed_msg() {
echo -e "${1}${POS}${BLACK}[${RED}FAILED${BLACK}]"
}
# load process info of srs
# @set variable $srs_pid to the process id in srs.pid file.
# @return 0, if process exists; otherwise:
# 1, for pid file not exists.
# 2, for get proecess info by pid failed.
# @set variable $error_msg if error.
# @set variable $pid_file to pid file.
load_process_info() {
# get pid file
pid_file=`cd ${ROOT} && cat ${CONFIG} |grep ^pid|awk '{print $2}'|awk -F ';' '{print $1}'`
if [[ -z $pid_file ]]; then pid_file=${DEFAULT_PID_FILE}; fi
# get abs path
pid_dir=`dirname $pid_file`
pid_file=`(cd ${ROOT}; cd $pid_dir; pwd)`/`basename $pid_file`
srs_pid=`cat $pid_file 2>/dev/null`
ret=$?; if [[ 0 -ne $ret ]]; then error_msg="file $pid_file does not exists"; return 1; fi
ps -p ${srs_pid} >/dev/null 2>/dev/null
ret=$?; if [[ 0 -ne $ret ]]; then error_msg="process $srs_pid does not exists"; return 2; fi
return 0;
}
start() {
# if exists, exit.
load_process_info
if [[ 0 -eq $? ]]; then failed_msg "SRS started(pid ${srs_pid}), should not start it again."; return 0; fi
# not exists, start server
ok_msg "Starting SRS..."
# get log file
log_file=`cd ${ROOT} && cat ${CONFIG} |grep '^log_file'| awk '{print $2}'| awk -F ';' '{print $1}'`
if [[ -z $log_file ]]; then log_file=${DEFAULT_LOG_FILE}; fi
# get abs path
log_dir=`dirname $log_file`
log_file=`(cd ${ROOT} && cd $log_dir && pwd)`/`basename $log_file`
# TODO: FIXME: set limit by, for instance, "ulimit -HSn 10000"
if [[ -z $log_file ]]; then
(cd ${ROOT}; ${APP} -c ${CONFIG} >/dev/null 2>&1)
else
(cd ${ROOT}; ${APP} -c ${CONFIG} >> $log_file 2>&1)
fi
# check again after start server
for ((i = 0; i < 5; i++)); do
# sleep a little while, for srs may start then crash.
sleep 0.1
load_process_info
ret=$?; if [[ 0 -ne $ret ]]; then
failed_msg "SRS start failed";
failed_msg "see $log_file";
return $ret;
fi
done
# check whether started.
load_process_info
ret=$?; if [[ 0 -eq $? ]]; then ok_msg "SRS started(pid ${srs_pid})"; return 0; fi
failed_msg "SRS not started"
return $ret
}
stop() {
# not start, exit
load_process_info
if [[ 0 -ne $? ]]; then failed_msg "SRS not start."; return 0; fi
ok_msg "Stopping SRS(pid ${srs_pid})..."
# process exists, kill util stop
for((;;)); do
load_process_info
if [[ 0 -eq $? ]]; then
kill -s SIGTERM ${srs_pid} 2>/dev/null
ret=$?; if [[ 0 -ne $ret ]]; then failed_msg "send signal SIGTERM failed ret=$ret"; return $ret; fi
sleep 0.1
else
ok_msg "SRS stopped"
break;
fi
done
sleep 0.1
return 0
}
# get the status of srs process
# @return 0 if srs is running; otherwise, 1 for stopped.
status() {
load_process_info
ret=$?; if [[ 0 -eq $ret ]]; then echo "SRS(pid ${srs_pid}) is running."; return 0; fi
echo "SRS is stopped, $error_msg"
return 1
}
reload() {
# not start, exit
load_process_info
if [[ 0 -ne $? ]]; then failed_msg "SRS not start."; return 0; fi
ok_msg "Reload SRS(pid ${srs_pid})..."
# process exists, reload it
kill -s SIGHUP ${srs_pid} 2>/dev/null
ret=$?; if [[ 0 -ne $ret ]]; then failed_msg "Reload SRS failed ret=$ret"; return $ret; fi
load_process_info
if [[ 0 -ne $? ]]; then failed_msg "SRS reload failed."; return $ret; fi
ok_msg "SRS reloaded"
return 0
}
menu() {
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
status)
status
;;
reload)
reload
;;
*)
echo "Usage: $0 {start|stop|status|restart|reload}"
return 1
;;
esac
}
menu $1
code=$?
exit ${code}

@ -0,0 +1,184 @@
#!/bin/bash
### BEGIN INIT INFO
# Provides: simple-rtmp-server(srs)
# RequiRED-Start: $all
# RequiRED-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: simple-rtmp-server(srs)
# Description: https://github.com/winlinvip/simple-rtmp-server
### END INIT INFO
# the config of ROOT, user must modify it when start srs from other directory,
# it's ok to use the script by command ./etc/init.d/simple-rtmp-server
ROOT="./"
APP="./objs/srs"
CONFIG="./conf/demo.19350.conf"
DEFAULT_PID_FILE='./objs/srs.demo.19350.pid'
DEFAULT_LOG_FILE='./objs/srs.demo.19350.log'
########################################################################
# utility functions
########################################################################
RED="\\e[31m"
GREEN="\\e[32m"
YELLOW="\\e[33m"
BLACK="\\e[0m"
POS="\\e[60G"
ok_msg() {
echo -e "${1}${POS}${BLACK}[${GREEN} OK ${BLACK}]"
}
failed_msg() {
echo -e "${1}${POS}${BLACK}[${RED}FAILED${BLACK}]"
}
# load process info of srs
# @set variable $srs_pid to the process id in srs.pid file.
# @return 0, if process exists; otherwise:
# 1, for pid file not exists.
# 2, for get proecess info by pid failed.
# @set variable $error_msg if error.
# @set variable $pid_file to pid file.
load_process_info() {
# get pid file
pid_file=`cd ${ROOT} && cat ${CONFIG} |grep ^pid|awk '{print $2}'|awk -F ';' '{print $1}'`
if [[ -z $pid_file ]]; then pid_file=${DEFAULT_PID_FILE}; fi
# get abs path
pid_dir=`dirname $pid_file`
pid_file=`(cd ${ROOT}; cd $pid_dir; pwd)`/`basename $pid_file`
srs_pid=`cat $pid_file 2>/dev/null`
ret=$?; if [[ 0 -ne $ret ]]; then error_msg="file $pid_file does not exists"; return 1; fi
ps -p ${srs_pid} >/dev/null 2>/dev/null
ret=$?; if [[ 0 -ne $ret ]]; then error_msg="process $srs_pid does not exists"; return 2; fi
return 0;
}
start() {
# if exists, exit.
load_process_info
if [[ 0 -eq $? ]]; then failed_msg "SRS started(pid ${srs_pid}), should not start it again."; return 0; fi
# not exists, start server
ok_msg "Starting SRS..."
# get log file
log_file=`cd ${ROOT} && cat ${CONFIG} |grep '^log_file'| awk '{print $2}'| awk -F ';' '{print $1}'`
if [[ -z $log_file ]]; then log_file=${DEFAULT_LOG_FILE}; fi
# get abs path
log_dir=`dirname $log_file`
log_file=`(cd ${ROOT} && cd $log_dir && pwd)`/`basename $log_file`
# TODO: FIXME: set limit by, for instance, "ulimit -HSn 10000"
if [[ -z $log_file ]]; then
(cd ${ROOT}; ${APP} -c ${CONFIG} >/dev/null 2>&1)
else
(cd ${ROOT}; ${APP} -c ${CONFIG} >> $log_file 2>&1)
fi
# check again after start server
for ((i = 0; i < 5; i++)); do
# sleep a little while, for srs may start then crash.
sleep 0.1
load_process_info
ret=$?; if [[ 0 -ne $ret ]]; then
failed_msg "SRS start failed";
failed_msg "see $log_file";
return $ret;
fi
done
# check whether started.
load_process_info
ret=$?; if [[ 0 -eq $? ]]; then ok_msg "SRS started(pid ${srs_pid})"; return 0; fi
failed_msg "SRS not started"
return $ret
}
stop() {
# not start, exit
load_process_info
if [[ 0 -ne $? ]]; then failed_msg "SRS not start."; return 0; fi
ok_msg "Stopping SRS(pid ${srs_pid})..."
# process exists, kill util stop
for((;;)); do
load_process_info
if [[ 0 -eq $? ]]; then
kill -s SIGTERM ${srs_pid} 2>/dev/null
ret=$?; if [[ 0 -ne $ret ]]; then failed_msg "send signal SIGTERM failed ret=$ret"; return $ret; fi
sleep 0.1
else
ok_msg "SRS stopped"
break;
fi
done
sleep 0.1
return 0
}
# get the status of srs process
# @return 0 if srs is running; otherwise, 1 for stopped.
status() {
load_process_info
ret=$?; if [[ 0 -eq $ret ]]; then echo "SRS(pid ${srs_pid}) is running."; return 0; fi
echo "SRS is stopped, $error_msg"
return 1
}
reload() {
# not start, exit
load_process_info
if [[ 0 -ne $? ]]; then failed_msg "SRS not start."; return 0; fi
ok_msg "Reload SRS(pid ${srs_pid})..."
# process exists, reload it
kill -s SIGHUP ${srs_pid} 2>/dev/null
ret=$?; if [[ 0 -ne $ret ]]; then failed_msg "Reload SRS failed ret=$ret"; return $ret; fi
load_process_info
if [[ 0 -ne $? ]]; then failed_msg "SRS reload failed."; return $ret; fi
ok_msg "SRS reloaded"
return 0
}
menu() {
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
status)
status
;;
reload)
reload
;;
*)
echo "Usage: $0 {start|stop|status|restart|reload}"
return 1
;;
esac
}
menu $1
code=$?
exit ${code}

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

@ -0,0 +1,50 @@
<!DOCTYPE html>
<html>
<head>
<title>SRS</title>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="players/css/bootstrap.min.css"/>
<script type="text/javascript" src="players/js/jquery-1.10.2.min.js"></script>
<script type="text/javascript" src="players/js/bootstrap.min.js"></script>
<script type="text/javascript" src="players/js/swfobject.js"></script>
<script type="text/javascript" src="players/js/srs.page.js"></script>
<style>
body{
padding-top: 55px;
}
</style>
<script type="text/javascript">
$(function(){
update_nav();
// direct to the default vhost for players.
window.location.href = "players/index.html" + window.location.search;
});
</script>
</head>
<body>
<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="brand" href="index.html">SRS</a>
<div class="nav-collapse collapse">
<ul class="nav">
<li><a id="nav_srs_player" href="srs_player.html">SRS播放器</a></li>
<li><a id="nav_srs_publisher" href="srs_publisher.html">SRS编码器</a></li>
<li><a id="nav_srs_chat" href="srs_chat.html">SRS会议</a></li>
<li><a id="nav_srs_bwt" href="srs_bwt.html">SRS测网速</a></li>
<li><a id="nav_jwplayer6" href="jwplayer6.html">JWPlayer6播放器</a></li>
<li><a id="nav_osmf" href="osmf.html">AdobeOSMF播放器</a></li>
<li><a id="nav_vlc" href="vlc.html">VLC播放器</a></li>
</ul>
</div>
</div>
</div>
</div>
<div class="container">
<hr>
<footer>
<p><a href="https://github.com/winlinvip/simple-rtmp-server">SRS Team &copy; 2013</a></p>
</footer>
</div>
</body>

@ -0,0 +1,49 @@
/*
# see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_SrsLinuxArm
arm-linux-gnueabi-g++ -o jmp jmp.cpp -static
arm-linux-gnueabi-strip jmp
*/
#include <stdio.h>
#include <stdlib.h>
#include <setjmp.h>
jmp_buf env_func1, env_func2;
int sum = 0;
void func1() {
int ret = setjmp(env_func1);
printf("setjmp func1 ret=%d\n", ret);
if (sum <= 0) {
return;
}
if (sum++ > 1000) {
return;
}
// jmp to func2
longjmp(env_func2, 3);
}
void func2() {
int ret = setjmp(env_func2);
printf("setjmp func2 ret=%d\n", ret);
if (sum <= 0) {
return;
}
// jmp to func1
longjmp(env_func1, 2);
}
int main(int argc, char** argv) {
printf("hello, setjmp/longjmp!\n");
func1();
sum++;
func2();
printf("jmp finished, sum=%d\n", sum);
return 0;
}

@ -0,0 +1,39 @@
/*
# see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_SrsLinuxArm
arm-linux-gnueabi-g++ -g -o jmp_sp jmp_sp.cpp -static
arm-linux-gnueabi-strip jmp_sp
*/
#include <stdio.h>
#include <stdlib.h>
#include <setjmp.h>
int main(int argc, char** argv) {
#if defined(__amd64__) || defined(__x86_64__)
printf("x86_64 sizeof(long int)=%d, sizeof(long)=%d, sizeof(int)=%d\n", (int)sizeof(long int), (int)sizeof(long), (int)sizeof(int));
#else
printf("arm sizeof(long int)=%d, sizeof(long)=%d, sizeof(int)=%d\n", (int)sizeof(long int), (int)sizeof(long), (int)sizeof(int));
#endif
jmp_buf env;
int ret = setjmp(env);
printf("setjmp func1 ret=%d\n", ret);
#if defined(__amd64__) || defined(__x86_64__)
// typedef lint64_t __jmp_buf[8];
printf("after setjmp: ");
for (int i = 0; i < 8; i++) {
printf("env[%d]=%#x, ", i, (int)env[0].__jmpbuf[i]);
}
printf("\n");
#else
// typedef int32_t __jmp_buf[64] __attribute__((__aligned__ (8)));
printf("after setjmp: ");
for (int i = 0; i < 64; i++) {
printf("env[%d]=%#x, ", i, (int)env[0].__jmpbuf[i]);
}
printf("\n");
#endif
return 0;
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save