SRS 6.0-b0 源码 + danmaku 后端(排除 objs/3rdparty/测试媒体)

This commit is contained in:
RRRosmontis
2026-08-27 21:46:20 +08:00
commit 41b5da7c7e
578 changed files with 237858 additions and 0 deletions
+7
View File
@@ -0,0 +1,7 @@
# 排除编译产物 / 第三方源码 / 测试媒体
.claude/
__pycache__/
*.pyc
trunk/objs/
trunk/3rdparty/
*.flv
Executable
+20
View File
@@ -0,0 +1,20 @@
The MIT License (MIT)
Copyright (c) 2013-2025 The SRS Authors
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.
Executable
+204
View File
@@ -0,0 +1,204 @@
# SRS(Simple Realtime Server)
![](http://ossrs.net/gif/v1/sls.gif?site=github.com&path=/srs/develop)
[![](https://github.com/ossrs/srs/actions/workflows/codeql-analysis.yml/badge.svg?branch=develop)](https://github.com/ossrs/srs/actions?query=workflow%3ACodeQL+branch%3Adevelop)
[![](https://github.com/ossrs/srs/actions/workflows/release.yml/badge.svg)](https://github.com/ossrs/srs/actions/workflows/release.yml?query=workflow%3ARelease)
[![](https://github.com/ossrs/srs/actions/workflows/test.yml/badge.svg?branch=develop)](https://github.com/ossrs/srs/actions?query=workflow%3ATest+branch%3Adevelop)
[![](https://codecov.io/gh/ossrs/srs/branch/develop/graph/badge.svg?token=Zx2LhdtA39)](https://app.codecov.io/gh/ossrs/srs/tree/develop)
[![](https://ossrs.net/wiki/images/wechat-badge4.svg)](https://ossrs.net/lts/zh-cn/contact#discussion)
[![](https://img.shields.io/twitter/follow/srs_server?style=social)](https://twitter.com/srs_server)
[![](https://img.shields.io/badge/SRS-YouTube-red)](https://www.youtube.com/@srs_server)
[![](https://badgen.net/discord/members/yZ4BnPmHAd)](https://discord.gg/yZ4BnPmHAd)
[![](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fossrs%2Fsrs.svg?type=small)](https://app.fossa.com/projects/git%2Bgithub.com%2Fossrs%2Fsrs?ref=badge_small)
[![](https://badgen.net/badge/srs/stackoverflow/orange?icon=terminal)](https://stackoverflow.com/questions/tagged/simple-realtime-server)
[![](https://opencollective.com/srs-server/tiers/badge.svg)](https://opencollective.com/srs-server)
[![](https://img.shields.io/docker/pulls/ossrs/srs)](https://hub.docker.com/r/ossrs/srs/tags)
SRS/6.0 ([Hang](https://ossrs.io/lts/en-us/product#release-60)) is a simple, high-efficiency, and real-time video server,
supporting RTMP/WebRTC/HLS/HTTP-FLV/SRT/MPEG-DASH/GB28181, Linux/Windows/macOS, X86_64/ARMv7/AARCH64/M1/RISCV/LOONGARCH/MIPS,
and essential [features](trunk/doc/Features.md#features).
[![SRS Overview](https://ossrs.net/wiki/images/SRS-SingleNode-4.0-sd.png?v=114)](https://ossrs.net/wiki/images/SRS-SingleNode-4.0-hd.png)
> Note: For more details on the single-node architecture for SRS, please visit the following [link](https://www.figma.com/file/333POxVznQ8Wz1Rxlppn36/SRS-4.0-Server-Arch).
SRS is licenced under [MIT](https://github.com/ossrs/srs/blob/develop/LICENSE), and some third-party libraries are
distributed under their [licenses](https://ossrs.io/lts/en-us/license).
<a name="product"></a> <a name="usage-docker"></a>
## Usage
Please check the Getting Started guide in [English](https://ossrs.io/lts/en-us/docs/v5/doc/getting-started)
or [Chinese](https://ossrs.net/lts/zh-cn/docs/v5/doc/getting-started). We highly recommend using SRS with docker:
```bash
docker run --rm -it -p 1935:1935 -p 1985:1985 -p 8080:8080 \
-p 8000:8000/udp -p 10080:10080/udp ossrs/srs:5
```
> Tips: If you're in China, use this image `registry.cn-hangzhou.aliyuncs.com/ossrs/srs:5` for faster speed.
Open [http://localhost:8080/](http://localhost:8080/) to verify, and then stream using the following
[FFmpeg](https://ffmpeg.org/download.html) command:
```bash
ffmpeg -re -i ./doc/source.flv -c copy -f flv -y rtmp://localhost/live/livestream
```
Alternatively, stream by [OBS](https://obsproject.com/download) using the following configuration:
* Service: `Custom`
* Server: `rtmp://localhost/live`
* Stream Key: `livestream`
Play the following streams using media players:
* To play an RTMP stream with URL `rtmp://localhost/live/livestream` on [VLC player](https://www.videolan.org/), open the player, go to Media > Open Network Stream, enter the URL and click Play.
* You can play HTTP-FLV stream URL [http://localhost:8080/live/livestream.flv](http://localhost:8080/players/srs_player.html?autostart=true&stream=livestream.flv) on a webpage using the srs-player, an HTML5-based player.
* Use srs-player for playing HLS stream with URL [http://localhost:8080/live/livestream.m3u8](http://localhost:8080/players/srs_player.html?autostart=true&stream=livestream.m3u8).
If you'd like to use WebRTC, convert RTMP to WebRTC, or convert WebRTC to RTMP, please check out
the wiki documentation in either [English](https://ossrs.io/lts/en-us/docs/v5/doc/getting-started#webrtc) or
[Chinese](https://ossrs.net/lts/zh-cn/docs/v5/doc/getting-started#webrtc).
To learn more about RTMP, HLS, HTTP-FLV, SRT, MPEG-DASH, WebRTC protocols, clustering,
HTTP API, DVR, and transcoding, please check the documents in [English](https://ossrs.io)
or [Chinese](https://ossrs.net).
## Sponsor
Would you like additional assistance from us? By becoming a sponsor or backer of SRS, we can provide you
with the support you need:
* Backer: $5 per month, online text chat support through Discord.
* Sponsor: $100 per month, online text chat plus online meeting support.
Please visit [OpenCollective](https://opencollective.com/srs-server) to become a backer or sponsor, and send
us a direct message on [Discord](https://discord.gg/yZ4BnPmHAd). We are currently providing support to the
developers listed below:
[![](https://opencollective.com/srs-server/backers.svg?width=800&button=false)](https://opencollective.com/srs-server)
At SRS, our goal is to create a free, open-source community that helps developers all over the world
build high-quality streaming and RTC platforms for their businesses.
<a name="authors"></a>
## Contributing
The [authors](trunk/AUTHORS.md#authors), [TOC(Technical Oversight Committee)](trunk/AUTHORS.md#toc),
and [contributors](trunk/AUTHORS.md#contributors) are listed [here](trunk/AUTHORS.md). The TOC members
who made significant contributions and maintained parts of SRS are listed below:
* [Winlin](https://github.com/winlinvip): Founder of the project, focusing on ST and Issues/PR. Responsible for architecture and maintenance.
* [ZhaoWenjie](https://github.com/wenjiegit): One of the earliest contributors, focusing on HDS and Windows. Has expertise in client technology.
* [ShiWei](https://github.com/runner365): Specializes in SRT and H.265, maintaining SRT and FLV patches for FFmpeg. An expert in codecs and FFmpeg.
* [XiaoZhihong](https://github.com/xiaozhihong): Concentrates on WebRTC/QUIC and SRT, with expertise in network QoS. Contributed to ARM on ST and was the original contributor for WebRTC.
* [WuPengqiang](https://github.com/Bepartofyou): Focused on H.265, initially contributed to the FFmpeg module in SRS for transcoding AAC with OPUS for WebRTC.
* [XiaLixin](https://github.com/xialixin): Specializes in GB28181, with expertise in live streaming and WebRTC.
* [LiPeng](https://github.com/lipeng19811218): Concentrates on WebRTC and contributes to memory management and smart pointers.
* [ChenGuanghua](https://github.com/chen-guanghua): Focused on WebRTC/QoS and introduced the Asan toolchain to SRS.
* [ChenHaibo](https://github.com/duiniuluantanqin): Specializes in GB28181 and HTTP API, contributing to patches for FFmpeg with WHIP.
* [ZhangJunqin](https://github.com/chundonglinlin): Focused on H.265, Prometheus Exporter, and API module.
A huge `THANK YOU` goes out to:
* All the [contributors](trunk/AUTHORS.md#contributors) of SRS.
* All the friends of SRS who gave [big support](https://ossrs.net/lts/zh-cn/product).
* [Genes](http://sourceforge.net/users/genes), [Mabbott](http://sourceforge.net/users/mabbott), and [Michael Talyanksy](https://github.com/michaeltalyansky) for making and sharing [State Threads](https://github.com/ossrs/state-threads/tree/srs).
We're really thankful to everyone in the community for helping us find bugs and improve the project.
To stay in touch and keep helping our community, please check out this [guide](https://github.com/ossrs/srs/contribute).
## LICENSE
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fossrs%2Fsrs.svg?type=small)](https://app.fossa.com/projects/git%2Bgithub.com%2Fossrs%2Fsrs?ref=badge_small)
SRS is licenced under [MIT](https://github.com/ossrs/srs/blob/develop/LICENSE), and some third-party libraries are
distributed under their [licenses](https://ossrs.io/lts/en-us/license).
[![](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fossrs%2Fsrs.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Fossrs%2Fsrs?ref=badge_large)
## Releases
* 2024-09-01, [Release v6.0-a1](https://github.com/ossrs/srs/releases/tag/v6.0-a1), v6.0-a1, 6.0 alpha1, v6.0.155, 169636 lines.
* 2024-07-27, [Release v6.0-a0](https://github.com/ossrs/srs/releases/tag/v6.0-a0), v6.0-a0, 6.0 alpha0, v6.0.145, 169259 lines.
* 2024-07-04, [Release v6.0-d6](https://github.com/ossrs/srs/releases/tag/v6.0-d6), v6.0-d6, 6.0 dev6, v6.0.134, 168904 lines.
* 2024-06-15, [Release v6.0-d5](https://github.com/ossrs/srs/releases/tag/v6.0-d5), v6.0-d5, 6.0 dev5, v6.0.129, 168454 lines.
* 2024-02-15, [Release v6.0-d4](https://github.com/ossrs/srs/releases/tag/v6.0-d4), v6.0-d4, 6.0 dev4, v6.0.113, 167695 lines.
* 2023-11-19, [Release v6.0-d3](https://github.com/ossrs/srs/releases/tag/v6.0-d3), v6.0-d3, 6.0 dev3, v6.0.101, 167560 lines.
* 2023-09-28, [Release v6.0-d2](https://github.com/ossrs/srs/releases/tag/v6.0-d2), v6.0-d2, 6.0 dev2, v6.0.85, 167509 lines.
* 2023-08-31, [Release v6.0-d1](https://github.com/ossrs/srs/releases/tag/v6.0-d1), v6.0-d1, 6.0 dev1, v6.0.72, 167135 lines.
* 2023-07-09, [Release v6.0-d0](https://github.com/ossrs/srs/releases/tag/v6.0-d0), v6.0-d0, 6.0 dev0, v6.0.59, 166739 lines.
* 2024-06-15, [Release v5.0-r3](https://github.com/ossrs/srs/releases/tag/v5.0-r3), v5.0-r3, 5.0 release3, v5.0.213, 163585 lines.
* 2024-04-03, [Release v5.0-r2](https://github.com/ossrs/srs/releases/tag/v5.0-r2), v5.0-r2, 5.0 release2, v5.0.210, 163515 lines.
* 2024-02-15, [Release v5.0-r1](https://github.com/ossrs/srs/releases/tag/v5.0-r1), v5.0-r1, 5.0 release1, v5.0.208, 163441 lines.
* 2023-12-30, [Release v5.0-r0](https://github.com/ossrs/srs/releases/tag/v5.0-r0), v5.0-r0, 5.0 release0, v5.0.205, 163363 lines.
* 2023-11-19, [Release v5.0-b7](https://github.com/ossrs/srs/releases/tag/v5.0-b7), v5.0-b7, 5.0 beta7, v5.0.200, 163305 lines.
* 2023-10-25, [Release v5.0-b6](https://github.com/ossrs/srs/releases/tag/v5.0-b6), v5.0-b6, 5.0 beta6, v5.0.195, 163303 lines.
* 2023-09-28, [Release v5.0-b5](https://github.com/ossrs/srs/releases/tag/v5.0-b5), v5.0-b5, 5.0 beta5, v5.0.185, 163254 lines.
* 2023-08-31, [Release v5.0-b4](https://github.com/ossrs/srs/releases/tag/v5.0-b4), v5.0-b4, 5.0 beta4, v5.0.176, 162919 lines.
* 2023-08-02, [Release v5.0-b3](https://github.com/ossrs/srs/releases/tag/v5.0-b3), v5.0-b3, 5.0 beta3, v5.0.170, 162704 lines.
* 2023-07-09, [Release v5.0-b2](https://github.com/ossrs/srs/releases/tag/v5.0-b2), v5.0-b2, 5.0 beta2, v5.0.166, 162520 lines.
* 2023-06-11, [Release v5.0-b1](https://github.com/ossrs/srs/releases/tag/v5.0-b1), v5.0-b1, 5.0 beta1, v5.0.157, 162494 lines.
* 2023-05-14, [Release v5.0-b0](https://github.com/ossrs/srs/releases/tag/v5.0-b0), v5.0-b0, 5.0 beta0, v5.0.155, 162600 lines.
* 2023-03-23, [Release v5.0-a5](https://github.com/ossrs/srs/releases/tag/v5.0-a5), v5.0-a5, 5.0 alpha5, v5.0.148, 162066 lines.
* 2023-02-12, [Release v5.0-a4](https://github.com/ossrs/srs/releases/tag/v5.0-a4), v5.0-a4, 5.0 alpha4, v5.0.141, 161897 lines.
* 2023-01-02, [Release v5.0-a3](https://github.com/ossrs/srs/releases/tag/v5.0-a3), v5.0-a3, 5.0 alpha3, v5.0.128, 161327 lines.
* 2022-12-18, [Release v5.0-a2](https://github.com/ossrs/srs/releases/tag/v5.0-a2), v5.0-a2, 5.0 alpha2, v5.0.112, 161233 lines.
* 2022-12-01, [Release v5.0-a1](https://github.com/ossrs/srs/releases/tag/v5.0-a1), v5.0-a1, 5.0 alpha1, v5.0.100, 160817 lines.
* 2022-11-25, [Release v5.0-a0](https://github.com/ossrs/srs/releases/tag/v5.0-a0), v5.0-a0, 5.0 alpha0, v5.0.98, 159813 lines.
* 2022-11-22, Release [v4.0-r4](https://github.com/ossrs/srs/releases/tag/v4.0-r4), v4.0-r4, 4.0 release4, v4.0.268, 145482 lines.
* 2022-09-16, Release [v4.0-r3](https://github.com/ossrs/srs/releases/tag/v4.0-r3), v4.0-r3, 4.0 release3, v4.0.265, 145328 lines.
* 2022-08-24, Release [v4.0-r2](https://github.com/ossrs/srs/releases/tag/v4.0-r2), v4.0-r2, 4.0 release2, v4.0.257, 144890 lines.
* 2022-06-29, Release [v4.0-r1](https://github.com/ossrs/srs/releases/tag/v4.0-r1), v4.0-r1, 4.0 release1, v4.0.253, 144680 lines.
* 2022-06-11, Release [v4.0-r0](https://github.com/ossrs/srs/releases/tag/v4.0-r0), v4.0-r0, 4.0 release0, v4.0.252, 144680 lines.
* 2020-06-27, [Release v3.0-r0](https://github.com/ossrs/srs/releases/tag/v3.0-r0), 3.0 release0, 3.0.141, 122674 lines.
* 2020-02-02, [Release v3.0-b0](https://github.com/ossrs/srs/releases/tag/v3.0-b0), 3.0 beta0, 3.0.112, 121709 lines.
* 2019-10-04, [Release v3.0-a0](https://github.com/ossrs/srs/releases/tag/v3.0-a0), 3.0 alpha0, 3.0.56, 107946 lines.
* 2017-03-03, [Release v2.0-r0](https://github.com/ossrs/srs/releases/tag/v2.0-r0), 2.0 release0, 2.0.234, 86373 lines.
* 2016-08-06, [Release v2.0-b0](https://github.com/ossrs/srs/releases/tag/v2.0-b0), 2.0 beta0, 2.0.210, 89704 lines.
* 2015-08-23, [Release v2.0-a0](https://github.com/ossrs/srs/releases/tag/v2.0-a0), 2.0 alpha0, 2.0.185, 89022 lines.
* 2014-12-05, [Release v1.0-r0](https://github.com/ossrs/srs/releases/tag/v1.0-r0), all bug fixed, 1.0.10, 59391 lines.
* 2014-10-09, [Release v0.9.8](https://github.com/ossrs/srs/releases/tag/v0.9.8), all bug fixed, 1.0.0, 59316 lines.
* 2014-04-07, [Release v0.9.1](https://github.com/ossrs/srs/releases/tag/v0.9.1), live streaming. 30000 lines.
* 2013-10-23, [Release v0.1.0](https://github.com/ossrs/srs/releases/tag/v0.1.0), rtmp. 8287 lines.
* 2013-10-17, Created.
## Features
Please read [FEATURES](trunk/doc/Features.md#features).
<a name="history"></a> <a name="change-logs"></a>
## Changelog
Please read [CHANGELOG](trunk/doc/CHANGELOG.md#changelog).
## Performance
Please read [PERFORMANCE](trunk/doc/PERFORMANCE.md#performance).
## Architecture
Please read [ARCHITECTURE](trunk/doc/Architecture.md#architecture).
## Ports
Please read [PORTS](trunk/doc/Resources.md#ports).
## APIs
Please read [APIS](trunk/doc/Resources.md#apis).
## Mirrors
Please read [MIRRORS](trunk/doc/Resources.md#mirrors).
## Dockers
Please read [DOCKERS](trunk/doc/Dockers.md).
Beijing, 2013.10<br/>
Winlin
+176
View File
@@ -0,0 +1,176 @@
import asyncio
import json
import time
import logging
from collections import deque
from typing import Set, Dict
from fastapi import FastAPI, WebSocket, WebSocketDisconnect
# ==================== 配置日志 ====================
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
handlers=[
logging.StreamHandler(),
logging.FileHandler('danmaku.log', encoding='utf-8')
]
)
logger = logging.getLogger("danmaku")
# ==================== 直播间类 ====================
class LiveRoom:
def __init__(self, room_id: int):
self.room_id = room_id
self.start_time = time.time()
self.timeline: list = []
self.timeline_lock = asyncio.Lock()
self.recent_danmaku = deque(maxlen=20)
self.connections: Set[WebSocket] = set()
self.connections_lock = asyncio.Lock()
logger.info(f"创建新房间 {room_id},开始时间: {self.start_time}")
# ==================== 全局房间管理 ====================
rooms: Dict[int, LiveRoom] = {}
rooms_lock = asyncio.Lock()
async def get_or_create_room(room_id: int) -> LiveRoom:
async with rooms_lock:
if room_id not in rooms:
rooms[room_id] = LiveRoom(room_id)
return rooms[room_id]
async def remove_connection_from_room(websocket: WebSocket):
async with rooms_lock:
for room in rooms.values():
async with room.connections_lock:
if websocket in room.connections:
room.connections.remove(websocket)
logger.info(f"从房间 {room.room_id} 移除连接,当前连接数: {len(room.connections)}")
break
# ==================== FastAPI 应用 ====================
app = FastAPI()
@app.websocket("/danmaku")
async def websocket_endpoint(websocket: WebSocket):
await websocket.accept()
client_host = websocket.client.host if websocket.client else "unknown"
logger.info(f"新WebSocket连接: {client_host}")
current_room: LiveRoom = None
current_user: str = None
try:
async for message in websocket.iter_text():
logger.info(f"收到消息 from {client_host}: {message[:200]}")
data = json.loads(message)
msg_type = data.get("type")
if msg_type == "join":
# 房间号处理
room_id = data.get("room")
try:
room_id = int(room_id)
except (TypeError, ValueError):
await websocket.send_json({"type": "error", "message": "房间号必须是整数"})
continue
# 如果已经加入过房间,先从原房间移除
if current_room:
async with current_room.connections_lock:
current_room.connections.discard(websocket)
# 加入新房间
current_room = await get_or_create_room(room_id)
current_user = data.get("user", "匿名")
async with current_room.connections_lock:
current_room.connections.add(websocket)
logger.info(f"客户端 {client_host} 加入房间 {room_id},用户名 {current_user}")
# 发送 init 消息(历史弹幕等)
elapsed = time.time() - current_room.start_time
init_msg = {
"type": "init",
"start_time": current_room.start_time,
"elapsed": elapsed,
"recent_danmaku": list(current_room.recent_danmaku)
}
await websocket.send_json(init_msg)
continue
elif msg_type == "danmaku":
if current_room is None:
await websocket.send_json({"type": "error", "message": "请先发送 join 消息加入房间"})
continue
text = data.get("text", "")
user = data.get("user", current_user or "匿名")
danmaku = {
"text": text,
"user": user,
"time": time.time()
}
# 记录到房间的最近弹幕和 timeline
current_room.recent_danmaku.append(danmaku)
async with current_room.timeline_lock:
current_room.timeline.append({
"time": time.time() - current_room.start_time,
"type": "danmaku",
"user": danmaku["user"],
"text": danmaku["text"]
})
logger.info(f"弹幕 (房间 {current_room.room_id}): {danmaku['user']}: {danmaku['text']}")
# 广播给同一房间的所有客户端
await broadcast_danmaku(current_room, danmaku)
continue
else:
logger.warning(f"未知消息类型: {msg_type}")
await websocket.send_json({"type": "error", "message": f"未知消息类型: {msg_type}"})
except WebSocketDisconnect:
logger.info(f"WebSocket断开: {client_host}")
except Exception as e:
logger.error(f"WebSocket处理异常: {e}", exc_info=True)
finally:
if current_room:
async with current_room.connections_lock:
current_room.connections.discard(websocket)
logger.info(f"从房间 {current_room.room_id} 移除连接,当前连接数: {len(current_room.connections)}")
else:
await remove_connection_from_room(websocket)
logger.info(f"当前所有房间连接状态: {[(rid, len(room.connections)) for rid, room in rooms.items()]}")
async def broadcast_danmaku(room: LiveRoom, danmaku: dict):
async with room.connections_lock:
for conn in room.connections:
try:
await conn.send_json({"type": "danmaku", "data": danmaku})
except:
pass
logger.info(f"广播弹幕到房间 {room.room_id}: {danmaku['user']}: {danmaku['text']}")
@app.get("/")
async def root():
return {
"status": "running",
"rooms": [
{
"room_id": rid,
"connections": len(room.connections),
"timeline_count": len(room.timeline),
"start_time": room.start_time
} for rid, room in rooms.items()
]
}
# ==================== 启动服务 ====================
if __name__ == "__main__":
import uvicorn
logger.info("启动 uvicorn 服务器,端口 55556")
uvicorn.run(app, host="0.0.0.0", port=55556)
+54
View File
@@ -0,0 +1,54 @@
.idea/
/*.conf
/*.txt
/*.flv
/*.mp4
/doc/frozen*.flv
/doc/kungfupanda*.flv
/doc/time*.flv
/doc/source*.mp4
/html
/ide/srs_xcode/srs_xcode.xcodeproj/project.xcworkspace/xcshareddata/
/ide/srs_xcode/srs_xcode.xcodeproj/project.xcworkspace/xcuserdata/
/ide/srs_xcode/srs_xcode.xcodeproj/xcuserdata/
/research/aac/
/research/api-server/static-dir/mse
/research/api-server/static-dir/crossdomain.xml
/research/bat/
/research/big/
/research/bitch/
/research/bott/
/research/cgo/
/research/dns/
/research/empty/
/research/golang/golang
/research/golang/temp.flv
/research/librtmp/720p.h264.raw
/research/librtmp/test.h264
/research/licenser/
/research/players/fls_player/
/research/players/mic/
/research/proxy/
/research/redis-ocluster/
/research/rtmfp/
/research/snap/
/research/speex/
/test/
.DS_Store
./srs
*.dSYM/
*.gcov
*.gcno
*.ts
*.h264
*.264
/webrtc
/configure.sh
/janus
*.dump
bug
/research/thread-model/thread-local
*.gcp
*.svg
/3rdparty/st-srs/srs
/3rdparty/st-srs/.circleci
+165
View File
@@ -0,0 +1,165 @@
## AUTHORS
The authors and administrators of SRS, ordered by first contribution:
- `Winlin<winlinvip@gmail.com>`
- `XiaoZhihong<hondaxiao@tencent.com>`
## TOC
The TOC(Technical Oversight Committee), ordered by first contribution:
- `Winlin<winlinvip@gmail.com>`
- `ZhaoWenjie<zhaowenjie@tal.com>`
- `ShiWei<xiaoq_bj@126.com>`
- `XiaoZhihong<hondaxiao@tencent.com>`
- `WuPengqiang<pengqiang.wpq@alibaba-inc.com>`
- `XiaLixin<xialixin@kanzhun.com>`
- `LiPeng<lipeng19811218@gmail.com>`
- `ChenGuanghua<jinxue.cgh@alibaba-inc.com>`
- `ChenHaibo<nmgchenhaibo@foxmail.com>`
- `ZhangJunqin<chundonglinlin@126.com>`
## CONTRIBUTORS
CONTRIBUTORS ordered by first contribution.
* `Winlin<winlin@vip.126.com>`
* `Winlin<winterserver@126.com>`
* `Winlin<chengli.ycl@alibaba-inc.com>`
* `ZhaoWenjie<zhaowenjie@tal.com>`
* `ZhaoWenjie<740936897@qq.com>`
* `ZhaoWenjie<wenjie.zhao@chinacache.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>`
* `StevenLiu<lingjiujianke@gmail.com>`
* `StevenLiu<liuqi05@kuaishou.com>`
* `zhengfl<zhengfl_1989@126.com>`
* `tufang14<breadbean1449@gmail.com>`
* `allspace<allspace@gmail.com>`
* `niesongsong<nie950@gmail.com>`
* `rudeb0t<nimrod@themanxgroup.tw>`
* `CallMeNP<np.liamg@gmail.com>`
* `synote<synote@qq.com>`
* `lovecat<littlefawn@163.com>`
* `panda1986<542638787@qq.com>`
* `YueHonghui<hongf.yue@hotmail.com>`
* `ThomasDreibholz<dreibh@simula.no>`
* `JuntaoLiu<juntliu@gmail.com>`
* `RocFang<fangpeng1986@gmail.com>`
* `MakarovYaroslav<yaroslav.makarov.97@mail.ru>`
* `MirkoVelic<mvelic@inoxx.net>`
* `HuiZhang(huzhang2)<huzhang2@cisco.com>`
* `OtterWa<simpleotter23@gmail.com>`
* `walkermi<172192667@qq.com>`
* `haofz<fuzhuang.hao@vhall.com>`
* `ME_Kun_Han<hanvskun@hotmail.com>`
* `ljx0305<ljx0305@gmail.com>`
* `cenxinwei<censhanhe@163.com>`
* `StarBrilliant<m13253@hotmail.com>`
* `xubin<xubin@chnvideo.com>`
* `intliang<yintiliang@gmail.com>`
* `flowerwrong<sysuyangkang@gmail.com>`
* `YLX<568414379@qq.com>`
* `J<guotaojiang@qq.com>`
* `Harlan<hailiang@gvrcraft.com>`
* `hankun<hankun@bravovcloud.com>`
* `JonathanBarratt<jonathan.barratt@gmail.com>`
* `KeeganH<keeganwharris@gmail.com>`
* `liuxc0116<liuxc0116@gmail.com>`
* `ChengdongZhang<lmajzcd@sina.com>`
* `lovacat<lovecat@china.sina.com>`
* `qiang.li<qiang.li@verycdn.com.cn>`
* `HungMingWu<u9089000@gmail.com>`
* `Himer<xishizhaohua@qq.com>`
* `XiaLixin<xialixin@kanzhun.com>`
* `XiaLixin<68469352@qq.com>`
* `XiaLixin<xlx0625@163.com>`
* `XiaLixin<xialx@yuntongxun.com>`
* `alphonsetai<tyh_123@163.com>`
* `Michael.Ma<wnpllr@gmail.com>`
* `lam2003<linmin3@yy.com>`
* `ShiWei<shiwei05@kuaishou.com>`
* `ShiWei<shi.weibd@hotmail.com>`
* `ShiWei<xiaoq_bj@126.com>`
* `XiaofengWang<wasphin@gmail.com>`
* `XiaoZhihong<hondaxiao@tencent.com>`
* `XiaoZhihong<xiaozhihong8@gmail.com>`
* `XiaoZhihong<xiaozhihong@huya.com>`
* `yanghuiwen<cainiaodj@qq.com>`
* `WuPengqiang<309554135@qq.com>`
* `WuPengqiang<pengqiang.wpq@alibaba-inc.com>`
* `l<22312935+lam2003@users.noreply.github.com>`
* `xfalcon<x-falcon@users.noreply.github.com>`
* `ChenGuanghua<jinxue.cgh@alibaba-inc.com>`
* `ChenGuanghua<chengh_math@126.com>`
* `LiPeng<mozhan.lp@alibaba-inc.com>`
* `LiPeng<lipeng19811218@gmail.com>`
* `yajun18<yajun18@staff.sina.com.cn>`
* `liulichuan<liulichuan@kuaishou.com>`
* `yapingcat<caoyapingneu@163.com>`
* `chenchengbin<chenchengbin@yy.com>`
* `ChenHaibo<495810242@qq.com>`
* `ChenHaibo<nmgchenhaibo@foxmail.com>`
* `jasongwq<jasongwq@gmail.com>`
* `yinjiaoyuan<yinjiaoyuan@163.com>`
* `PieerePi<pihuibin@hotmail.com>`
* `JesseXi<jesse.jinjin@wo.cn>`
* `PieerePi<40780488+PieerePi@users.noreply.github.com>`
* `ghostsf<ghost_sf@163.com>`
* `xbpeng121<53243357+xbpeng121@users.noreply.github.com>`
* `Johzzy<hellojinqiang@gmail.com>`
* `stone<bluestn@163.com>`
* `cfw11<34058899+cfw11@users.noreply.github.com>`
* `Hung-YiChen<gaod.chen@gmail.com>`
* `long<liyalong12345@126.com>`
* `matthew1838<77285055+matthew1838@users.noreply.github.com>`
* `rise<rise.worlds@outlook.com>`
* `pyw<PYW1@users.noreply.github.com>`
* `MatheusMacabu<macabu@users.noreply.github.com>`
* `Alex.CR<xiaoq_bj@126.com>`
* `Zhouxiaojun2008<279686030@qq.com>`
* `Zhouxiaojun2008 <31402829+zhouxiaojun2008@users.noreply.github.com>`
* `Pengfei.ma<pengfei.ma.chn@outlook.com>`
* `Pengfei.ma<52305649+mapengfei53@users.noreply.github.com>`
* `ZhangJunqin<zhangjunqin@jd.com>`
* `ZhangJunqin<chundonglinlin@126.com>`
* `AbrarAhmed<13979201+abrar71@users.noreply.github.com>`
* `BoringWednesday<2651933495@qq.com>`
* `liuxiaoliang<37902979+liuxiaoliang8@users.noreply.github.com>`
* `qingfuliao<45161976+qingfuliao@users.noreply.github.com>`
* `along<alongL@users.noreply.github.com>`
* `akanchi<chenpx718@gmail.com>`
* `HuachaoMao<huachaomao@gmail.com>`
* `James<jiankai.wang@opensight.cn>`
* `lvndry<monga.4landry@gmail.com>`
* `马文武<mwenwu@kitegogo.com>`
* `PurpleGrape<purplegrape4@gmail.com>`
* `xmedia-systems<xmedia.systems@gmail.com>`
* `MatinZadehDolatabad<zadehdolatabad@gmail.com>`
* `zozobreakzou<zozobreak@163.com>`
* `mingo-wu<57790355+mingo-wu1@users.noreply.github.com>`
* `CommanderRoot<CommanderRoot@users.noreply.github.com>`
* `dev-clavis<declavis.company@gmail.com>`
* `everything411<everything411@163.com>`
* `faicker<faicker.mo@gmail.com>`
* `Matthew<matthewgao@gmail.com>`
* `simon1tan1<107955289+simon1tan1@users.noreply.github.com>`
* `feng<308276366@qq.com>`
* `wangzhen<wrennywang@hotmail.com>`
* `yashwardhan-jyani<100014271+yashwardhan-jyani@users.noreply.github.com>`
* `qyt<486179@qq.com>`
* `Kazuo<hagihara@miharu.co.jp>`
* `MarkCao<industriousonesoft@gmail.com>`
* `Mr.Li<iskyman@163.com>`
* `Loken<lokenetwork@users.noreply.github.com>`
* `JacobSu<suzp1984@gmail.com>`
* `terrencetang2023<tangshaoteng@163.com>`
+65
View File
@@ -0,0 +1,65 @@
########################################################
FROM ossrs/srs:dev-cache AS centos7-baseline
COPY . /srs
RUN cd /srs/trunk && ./configure --srt=off --gb28181=off && make
FROM ossrs/srs:dev-cache AS centos7-no-webrtc
COPY . /srs
RUN cd /srs/trunk && ./configure --srt=off --gb28181=off --rtc=off && make
FROM ossrs/srs:dev-cache AS centos7-no-asm
COPY . /srs
RUN cd /srs/trunk && ./configure --srt=off --gb28181=off --nasm=off --srtp-nasm=off && make
FROM ossrs/srs:dev-cache AS centos7-all
COPY . /srs
RUN cd /srs/trunk && ./configure --srt=on --gb28181=on --apm=on --h265=on && make
FROM ossrs/srs:dev-cache AS centos7-ansi-no-ffmpeg
COPY . /srs
RUN cd /srs/trunk && ./configure --srt=off --gb28181=off --cxx11=off --cxx14=off --ffmpeg-fit=off && make
########################################################
FROM ossrs/srs:ubuntu16-cache AS ubuntu16-baseline
COPY . /srs
RUN cd /srs/trunk && ./configure --srt=off --gb28181=off && make
FROM ossrs/srs:ubuntu16-cache AS ubuntu16-all
COPY . /srs
RUN cd /srs/trunk && ./configure --srt=on --gb28181=on --h265=on && make
########################################################
FROM ossrs/srs:ubuntu18-cache AS ubuntu18-baseline
COPY . /srs
RUN cd /srs/trunk && ./configure --srt=off --gb28181=off && make
FROM ossrs/srs:ubuntu18-cache AS ubuntu18-all
COPY . /srs
RUN cd /srs/trunk && ./configure --srt=on --gb28181=on --h265=on && make
########################################################
FROM ossrs/srs:ubuntu20-cache AS ubuntu20-baseline
COPY . /srs
RUN cd /srs/trunk && ./configure --srt=off --gb28181=off && make
FROM ossrs/srs:ubuntu20-cache AS ubuntu20-all
COPY . /srs
RUN cd /srs/trunk && ./configure --srt=on --gb28181=on --apm=on --h265=on && make
########################################################
FROM ossrs/srs:ubuntu16-cache-cross-arm AS ubuntu16-cache-cross-armv7
COPY . /srs
RUN cd /srs/trunk && ./configure --cross-build --cross-prefix=arm-linux-gnueabihf- && make
FROM ossrs/srs:ubuntu16-cache-cross-aarch64 AS ubuntu16-cache-cross-aarch64
COPY . /srs
RUN cd /srs/trunk && ./configure --cross-build --cross-prefix=aarch64-linux-gnu- && make
########################################################
FROM ossrs/srs:ubuntu20-cache-cross-arm AS ubuntu20-cache-cross-armv7
COPY . /srs
RUN cd /srs/trunk && ./configure --cross-build --cross-prefix=arm-linux-gnueabihf- && make
FROM ossrs/srs:ubuntu20-cache-cross-aarch64 AS ubuntu20-cache-cross-aarch64
COPY . /srs
RUN cd /srs/trunk && ./configure --cross-build --cross-prefix=aarch64-linux-gnu- && make
+21
View File
@@ -0,0 +1,21 @@
FROM ossrs/srs:ubuntu20-cache
ARG MAKEARGS
RUN echo "MAKEARGS: ${MAKEARGS}"
# https://serverfault.com/questions/949991/how-to-install-tzdata-on-a-ubuntu-docker-image
ENV DEBIAN_FRONTEND noninteractive
# For go to build and run utest.
ENV PATH $PATH:/usr/local/go/bin
RUN apt update -y && apt install -y gcc make g++ patch unzip perl git libasan5
# Build and install SRS.
COPY . /srs
WORKDIR /srs/trunk
# Note that we must enable the gcc7 or link failed.
RUN ./configure --srt=on --gb28181=on --apm=on --h265=on --utest=on --gcov=on --sanitizer=on
RUN make utest ${MAKEARGS}
+14
View File
@@ -0,0 +1,14 @@
FROM ossrs/srs:dev
# version=4.0.145
ARG version
ARG SRS_AUTO_PACKAGER
# Install depends tools.
RUN yum install -y zip
# Build and install SRS.
ADD srs-server-${version}.tar.gz /srs
WORKDIR /srs/srs-server-${version}/trunk
RUN ./scripts/package.sh --x86-x64 --gb28181=on --apm=on --h265=on --tag=${version}
+26
View File
@@ -0,0 +1,26 @@
FROM ossrs/srs:ubuntu20-cache
ARG MAKEARGS
RUN echo "MAKEARGS: ${MAKEARGS}"
# https://serverfault.com/questions/949991/how-to-install-tzdata-on-a-ubuntu-docker-image
ENV DEBIAN_FRONTEND noninteractive
# For go to build and run utest.
ENV PATH $PATH:/usr/local/go/bin
RUN apt update -y && apt install -y gcc make g++ patch unzip perl git libasan5
# Build and install SRS.
COPY . /srs
WORKDIR /srs/trunk
# Note that we must enable the gcc7 or link failed.
# Please note that we must disable the ffmpeg-opus, as it negatively impacts performance. We may consider
# enabling it in the future when support for multi-threading transcoding is available.
RUN ./configure --srt=on --gb28181=on --srt=on --apm=on --h265=on --utest=on --ffmpeg-opus=off --build-cache=on
RUN make utest ${MAKEARGS}
# Build benchmark tool.
RUN cd 3rdparty/srs-bench && make ${MAKEARGS}
+153
View File
@@ -0,0 +1,153 @@
.PHONY: default all _default install help clean destroy server utest _prepare_dir srs_mp4_parser srs_hls_ingester
.PHONY: clean_srs clean_modules clean_openssl clean_srtp2 clean_opus clean_ffmpeg clean_st
.PHONY: st ffmpeg
GCC = gcc
CXX = g++
AR = ar
LINK = ld
RANDLIB = randlib
CXXFLAGS = -std=c++11 -Wall -g -O0 -fsanitize=address -fno-omit-frame-pointer
LDFLAGS =
# install prefix.
SRS_PREFIX=/usr/local/srs
SRS_DEFAULT_CONFIG=conf/srs.conf
__REAL_INSTALL=$(DESTDIR)$(SRS_PREFIX)
SRS_FORCE_MAKE_JOBS=YES
JOBS=$(shell echo $(MAKEFLAGS)| grep -qE '\-j[0-9]+' || echo " --jobs=2")
default: server
all: _default
_default: server utest srs_mp4_parser srs_hls_ingester
help:
@echo "Usage: make <help>|<clean>|<destroy>|<server>|<utest>|<install>|<uninstall>"
@echo " help Display this help menu"
@echo " clean Cleanup project and all depends"
@echo " destroy Cleanup all files for this platform in ./objs/Platform-SRS6-Linux-5.15.0-GCC11.4.0-x86_64"
@echo " server Build the srs and other modules in main"
@echo " utest Build the utest for srs"
@echo " install Install srs to the prefix path"
@echo " uninstall Uninstall srs from prefix path"
@echo "To rebuild special module:"
@echo " st Rebuild st-srs in ./objs/Platform-SRS6-Linux-5.15.0-GCC11.4.0-x86_64/st-srs"
@echo " ffmpeg Rebuild ffmpeg in ./objs/Platform-SRS6-Linux-5.15.0-GCC11.4.0-x86_64/ffmpeg-4.2-fit"
@echo "To reconfigure special depends:"
@echo " clean_openssl Remove the openssl cache."
@echo " clean_srtp2 Remove the libsrtp2 cache."
@echo " clean_opus Remove the opus cache."
@echo " clean_ffmpeg Remove the FFmpeg cache."
@echo " clean_st Remove the ST cache."
@echo "For example:"
@echo " make"
@echo " make help"
doclean:
(cd ./objs && rm -rf srs srs_utest srs.exe srs_utest.exe srs_mp4_parser srs_hls_ingester)
(cd ./objs && rm -rf src/* include lib)
(mkdir -p ./objs/utest && cd ./objs/utest && rm -rf *.o *.a)
clean: clean_srs clean_modules
destroy:
(cd ./objs && rm -rf Platform-SRS6-Linux-5.15.0-GCC11.4.0-x86_64)
clean_srs:
@(cd ./objs && rm -rf srs srs_utest src/* utest/*)
clean_modules:
@(cd ./objs && rm -rf srs_mp4_parser srs_hls_ingester)
clean_openssl:
@rm -rf ./objs/Platform-SRS6-Linux-5.15.0-GCC11.4.0-x86_64/3rdparty/openssl
@echo "Please rebuild openssl by: ./configure"
clean_srtp2:
@rm -rf ./objs/Platform-SRS6-Linux-5.15.0-GCC11.4.0-x86_64/3rdparty/srtp2
@echo "Please rebuild libsrtp2 by: ./configure"
clean_opus:
@rm -rf ./objs/Platform-SRS6-Linux-5.15.0-GCC11.4.0-x86_64/3rdparty/opus
@echo "Please rebuild opus by: ./configure"
clean_ffmpeg:
@rm -rf ./objs/Platform-SRS6-Linux-5.15.0-GCC11.4.0-x86_64/3rdparty/ffmpeg
@echo "Please rebuild FFmpeg by: ./configure"
clean_st:
@rm -rf ./objs/Platform-SRS6-Linux-5.15.0-GCC11.4.0-x86_64/3rdparty/st
@echo "Please rebuild ST by: ./configure"
st:
@rm -f ./objs/srs srs_utest
@$(MAKE)$(JOBS) -C ./objs/Platform-SRS6-Linux-5.15.0-GCC11.4.0-x86_64/st-srs clean
@env EXTRA_CFLAGS="-DMALLOC_STACK -DMD_HAVE_EPOLL" $(MAKE)$(JOBS) -C ./objs/Platform-SRS6-Linux-5.15.0-GCC11.4.0-x86_64/st-srs linux-debug STATIC_ONLY=yes CC=gcc AR=ar LD=ld RANDLIB=randlib CC=$(GCC) AR=$(AR) LD=$(LINK) RANDLIB=$(RANDLIB)
@echo "Please rebuild srs by: make"
ffmpeg:
@rm -f ./objs/srs srs_utest
$(MAKE)$(JOBS) -C ./objs/Platform-SRS6-Linux-5.15.0-GCC11.4.0-x86_64/ffmpeg-4.2-fit
$(MAKE)$(JOBS) -C ./objs/Platform-SRS6-Linux-5.15.0-GCC11.4.0-x86_64/ffmpeg-4.2-fit install-libs
@echo "Please rebuild srs by: make"
server: _prepare_dir
@echo "Build the SRS server, JOBS=${JOBS}, FORCE_MAKE_JOBS=YES"
$(MAKE)$(JOBS) -f ./objs/Makefile srs
@bash objs/_srs_build_summary.sh
srs_mp4_parser: _prepare_dir server
@echo "Build the srs_mp4_parser over SRS"
$(MAKE)$(JOBS) -f ./objs/Makefile srs_mp4_parser
srs_hls_ingester: _prepare_dir server
@echo "Build the srs_hls_ingester over SRS"
$(MAKE)$(JOBS) -f ./objs/Makefile srs_hls_ingester
uninstall:
@echo "rmdir $(SRS_PREFIX)"
@rm -rf $(SRS_PREFIX)
install:
@echo "Now mkdir $(__REAL_INSTALL)"
@mkdir -p $(__REAL_INSTALL)
@echo "Now make the http root dir"
@mkdir -p $(__REAL_INSTALL)/objs/nginx/html
@cp -f research/index.html $(__REAL_INSTALL)/objs/nginx/html
@cp -f research/favicon.ico $(__REAL_INSTALL)/objs/nginx/html
@cp -Rf research/players $(__REAL_INSTALL)/objs/nginx/html/
@cp -Rf research/console $(__REAL_INSTALL)/objs/nginx/html/
@cp -Rf 3rdparty/signaling/www/demos $(__REAL_INSTALL)/objs/nginx/html/
@echo "Now copy binary files"
@mkdir -p $(__REAL_INSTALL)/objs
@cp -f objs/srs $(__REAL_INSTALL)/objs
@echo "Now copy srs conf files"
@mkdir -p $(__REAL_INSTALL)/conf
@cp -f conf/*.conf $(__REAL_INSTALL)/conf
@cp -f conf/server.key conf/server.crt $(__REAL_INSTALL)/conf
@echo "Now copy init.d script files"
@mkdir -p $(__REAL_INSTALL)/etc/init.d
@cp -f etc/init.d/srs $(__REAL_INSTALL)/etc/init.d
@sed -i "s|^ROOT=.*|ROOT=\"$(SRS_PREFIX)\"|g" $(__REAL_INSTALL)/etc/init.d/srs
@sed -i "s|^CONFIG=.*|CONFIG=\"$(SRS_DEFAULT_CONFIG)\"|g" $(__REAL_INSTALL)/etc/init.d/srs
@echo "Now copy systemctl service files"
@mkdir -p $(__REAL_INSTALL)/usr/lib/systemd/system
@cp -f usr/lib/systemd/system/srs.service $(__REAL_INSTALL)/usr/lib/systemd/system/srs.service
@echo ""
@echo "@see: https://ossrs.net/lts/zh-cn/docs/v4/doc/service"
utest: server
@echo "Ignore utest for it's disabled."
# the ./configure will generate it.
_prepare_dir:
@mkdir -p ./objs
@mkdir -p ./objs/src/core
@mkdir -p ./objs/src/kernel
@mkdir -p ./objs/src/protocol
@mkdir -p ./objs/src/app
@mkdir -p ./objs/src/main
@mkdir -p ./objs/src/main
+96
View File
@@ -0,0 +1,96 @@
# generate the binary
#
# params:
# $SRS_OBJS the objs directory to store the Makefile. ie. ./objs
# $SRS_OBJS the objs directory for Makefile. ie. objs
#
# $MAIN_ENTRANCES array, disable all except the $APP_MAIN itself. ie. ["srs_main_server"]
# $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}/Makefile
APP_TARGET="${SRS_OBJS}/${APP_NAME}"
echo "Generating app ${APP_NAME} depends.";
echo "# build ${APP_TARGET}" >> ${FILE}
# generate the binary depends, for example:
# srs: objs/srs
echo "${BUILD_KEY}: ${APP_TARGET}" >> ${FILE}
echo "" >> ${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 ${SRS_WORKDIR}/${item} ]; then
ignored=1
fi
if [ ${ignored} == 1 ]; then
echo "Ignore file ${FILE_NAME}"
continue;
fi
OBJ_FILE=${SRS_OBJS}/$item
OBJ_FILE="${OBJ_FILE%.*}.o"
echo -n "${OBJ_FILE} " >> ${FILE}
done
echo "" >> ${FILE}
echo "Generating 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 ${SRS_WORKDIR}/${item} ]; then
ignored=1
fi
if [ ${ignored} == 1 ]; then
echo "Ignore file ${FILE_NAME}"
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 "" >> ${FILE}
echo -n "Generate app ${APP_NAME} ok"; echo '!';
+271
View File
@@ -0,0 +1,271 @@
#!/bin/bash
# output variables:
# SRS_AUTO_HEADERS_H: the auto generated header file.
SRS_AUTO_HEADERS_H="${SRS_OBJS}/srs_auto_headers.hpp"
# 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_PACKAGER \"${SRS_AUTO_PACKAGER}\"" >> $SRS_AUTO_HEADERS_H
echo "#define SRS_BUILD_TS \"`date +%s`\"" >> $SRS_AUTO_HEADERS_H
echo "#define SRS_BUILD_DATE \"`date \"+%Y-%m-%d %H:%M:%S\"`\"" >> $SRS_AUTO_HEADERS_H
echo "#define SRS_UNAME \"`uname -a`\"" >> $SRS_AUTO_HEADERS_H
echo "#define SRS_USER_CONFIGURE \"${SRS_AUTO_USER_CONFIGURE}\"" >> $SRS_AUTO_HEADERS_H
echo "#define SRS_CONFIGURE \"${SRS_AUTO_CONFIGURE}\"" >> $SRS_AUTO_HEADERS_H
echo "" >> $SRS_AUTO_HEADERS_H
function srs_define_macro()
{
macro=$1 && file=$2
echo "#define $macro" >> $file
echo "#define ${macro}_BOOL true" >> $file
}
function srs_define_macro_value()
{
macro=$1 && value=$2 && file=$3
echo "#define $macro $value" >> $file
echo "#define ${macro}_BOOL true" >> $file
}
function srs_undefine_macro()
{
macro=$1 && file=$2
echo "#undef $macro" >> $file
echo "#define ${macro}_BOOL false" >> $file
}
#####################################################################################
# generate auto headers file, depends on the finished of options.sh
#####################################################################################
# auto headers in depends.
if [[ $SRS_HDS == YES ]]; then
srs_define_macro "SRS_HDS" $SRS_AUTO_HEADERS_H
else
srs_undefine_macro "SRS_HDS" $SRS_AUTO_HEADERS_H
fi
if [[ $SRS_SRT == YES ]]; then
srs_define_macro "SRS_SRT" $SRS_AUTO_HEADERS_H
else
srs_undefine_macro "SRS_SRT" $SRS_AUTO_HEADERS_H
fi
if [[ $SRS_CXX11 == YES ]]; then
srs_define_macro "SRS_CXX11" $SRS_AUTO_HEADERS_H
else
srs_undefine_macro "SRS_CXX11" $SRS_AUTO_HEADERS_H
fi
if [[ $SRS_CXX14 == YES ]]; then
srs_define_macro "SRS_CXX14" $SRS_AUTO_HEADERS_H
else
srs_undefine_macro "SRS_CXX14" $SRS_AUTO_HEADERS_H
fi
if [[ $SRS_BACKTRACE == YES ]]; then
srs_define_macro "SRS_BACKTRACE" $SRS_AUTO_HEADERS_H
else
srs_undefine_macro "SRS_BACKTRACE" $SRS_AUTO_HEADERS_H
fi
if [[ $SRS_RTC == YES ]]; then
srs_define_macro "SRS_RTC" $SRS_AUTO_HEADERS_H
else
srs_undefine_macro "SRS_RTC" $SRS_AUTO_HEADERS_H
fi
if [[ $SRS_FFMPEG_FIT == YES ]]; then
srs_define_macro "SRS_FFMPEG_FIT" $SRS_AUTO_HEADERS_H
else
srs_undefine_macro "SRS_FFMPEG_FIT" $SRS_AUTO_HEADERS_H
fi
if [[ $SRS_FFMPEG_OPUS == YES ]]; then
srs_define_macro "SRS_FFMPEG_OPUS" $SRS_AUTO_HEADERS_H
else
srs_undefine_macro "SRS_FFMPEG_OPUS" $SRS_AUTO_HEADERS_H
fi
if [[ $SRS_H265 == YES ]]; then
srs_define_macro "SRS_H265" $SRS_AUTO_HEADERS_H
else
srs_undefine_macro "SRS_H265" $SRS_AUTO_HEADERS_H
fi
if [[ $SRS_SIMULATOR == YES ]]; then
srs_define_macro "SRS_SIMULATOR" $SRS_AUTO_HEADERS_H
else
srs_undefine_macro "SRS_SIMULATOR" $SRS_AUTO_HEADERS_H
fi
if [[ $SRS_HTTPS == YES ]]; then
srs_define_macro "SRS_HTTPS" $SRS_AUTO_HEADERS_H
else
srs_undefine_macro "SRS_HTTPS" $SRS_AUTO_HEADERS_H
fi
if [[ $SRS_GB28181 == YES ]]; then
srs_define_macro "SRS_GB28181" $SRS_AUTO_HEADERS_H
else
srs_undefine_macro "SRS_GB28181" $SRS_AUTO_HEADERS_H
fi
if [[ $SRS_APM == YES ]]; then
srs_define_macro "SRS_APM" $SRS_AUTO_HEADERS_H
else
srs_undefine_macro "SRS_APM" $SRS_AUTO_HEADERS_H
fi
if [[ $SRS_UTEST == YES ]]; then
srs_define_macro "SRS_UTEST" $SRS_AUTO_HEADERS_H
else
srs_undefine_macro "SRS_UTEST" $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
srs_define_macro "SRS_FFMPEG_STUB" $SRS_AUTO_HEADERS_H
else
srs_undefine_macro "SRS_FFMPEG_STUB" $SRS_AUTO_HEADERS_H
fi
if [[ $SRS_GPERF == YES ]]; then
srs_define_macro "SRS_GPERF" $SRS_AUTO_HEADERS_H
else
srs_undefine_macro "SRS_GPERF" $SRS_AUTO_HEADERS_H
fi
if [[ $SRS_GPERF_MC == YES ]]; then
srs_define_macro "SRS_GPERF_MC" $SRS_AUTO_HEADERS_H
else
srs_undefine_macro "SRS_GPERF_MC" $SRS_AUTO_HEADERS_H
fi
if [[ $SRS_GPERF_MD == YES ]]; then
srs_define_macro "SRS_GPERF_MD" $SRS_AUTO_HEADERS_H
else
srs_undefine_macro "SRS_GPERF_MD" $SRS_AUTO_HEADERS_H
fi
if [[ $SRS_GPERF_MP == YES ]]; then
srs_define_macro "SRS_GPERF_MP" $SRS_AUTO_HEADERS_H
else
srs_undefine_macro "SRS_GPERF_MP" $SRS_AUTO_HEADERS_H
fi
if [[ $SRS_GPERF_CP == YES ]]; then
srs_define_macro "SRS_GPERF_CP" $SRS_AUTO_HEADERS_H
else
srs_undefine_macro "SRS_GPERF_CP" $SRS_AUTO_HEADERS_H
fi
if [ $SRS_SANITIZER == YES ]; then
srs_define_macro "SRS_SANITIZER" $SRS_AUTO_HEADERS_H
else
srs_undefine_macro "SRS_SANITIZER" $SRS_AUTO_HEADERS_H
fi
if [ $SRS_SANITIZER_LOG == YES ]; then
srs_define_macro "SRS_SANITIZER_LOG" $SRS_AUTO_HEADERS_H
else
srs_undefine_macro "SRS_SANITIZER_LOG" $SRS_AUTO_HEADERS_H
fi
if [ $SRS_VALGRIND == YES ]; then
srs_define_macro "SRS_VALGRIND" $SRS_AUTO_HEADERS_H
else
srs_undefine_macro "SRS_VALGRIND" $SRS_AUTO_HEADERS_H
fi
#####################################################################################
# for embeded.
#####################################################################################
# for log level compile settings
if [[ $SRS_LOG_VERBOSE == YES ]]; then
srs_define_macro "SRS_VERBOSE" $SRS_AUTO_HEADERS_H
else
srs_undefine_macro "SRS_VERBOSE" $SRS_AUTO_HEADERS_H
fi
if [[ $SRS_LOG_INFO == YES ]]; then
srs_define_macro "SRS_INFO" $SRS_AUTO_HEADERS_H
else
srs_undefine_macro "SRS_INFO" $SRS_AUTO_HEADERS_H
fi
if [[ $SRS_LOG_TRACE == YES ]]; then
srs_define_macro "SRS_TRACE" $SRS_AUTO_HEADERS_H
else
srs_undefine_macro "SRS_TRACE" $SRS_AUTO_HEADERS_H
fi
if [[ $SRS_SINGLE_THREAD == YES ]]; then
srs_define_macro "SRS_SINGLE_THREAD" $SRS_AUTO_HEADERS_H
else
srs_undefine_macro "SRS_SINGLE_THREAD" $SRS_AUTO_HEADERS_H
fi
if [[ $SRS_SIGNAL_API == YES ]]; then
srs_define_macro "SRS_SIGNAL_API" $SRS_AUTO_HEADERS_H
else
srs_undefine_macro "SRS_SIGNAL_API" $SRS_AUTO_HEADERS_H
fi
if [[ $SRS_LOG_LEVEL_V2 == YES ]]; then
srs_define_macro "SRS_LOG_LEVEL_V2" $SRS_AUTO_HEADERS_H
else
srs_undefine_macro "SRS_LOG_LEVEL_V2" $SRS_AUTO_HEADERS_H
fi
if [[ $SRS_CROSS_BUILD == YES ]]; then
srs_define_macro "SRS_CROSSBUILD" $SRS_AUTO_HEADERS_H
else
srs_undefine_macro "SRS_CROSSBUILD" $SRS_AUTO_HEADERS_H
fi
if [[ $SRS_CYGWIN64 == YES ]]; then
srs_define_macro "SRS_CYGWIN64" $SRS_AUTO_HEADERS_H
else
srs_undefine_macro "SRS_CYGWIN64" $SRS_AUTO_HEADERS_H
fi
if [[ $SRS_OSX == YES ]]; then
srs_define_macro "SRS_OSX" $SRS_AUTO_HEADERS_H
else
srs_undefine_macro "SRS_OSX" $SRS_AUTO_HEADERS_H
fi
if [[ $SRS_DEBUG == YES ]]; then
srs_define_macro "SRS_DEBUG" $SRS_AUTO_HEADERS_H
else
srs_undefine_macro "SRS_DEBUG" $SRS_AUTO_HEADERS_H
fi
if [[ $SRS_DEBUG_STATS == YES ]]; then
srs_define_macro "SRS_DEBUG_STATS" $SRS_AUTO_HEADERS_H
else
srs_undefine_macro "SRS_DEBUG_STATS" $SRS_AUTO_HEADERS_H
fi
# prefix
echo "" >> $SRS_AUTO_HEADERS_H
echo "#define SRS_PREFIX \"${SRS_PREFIX}\"" >> $SRS_AUTO_HEADERS_H
echo "#define SRS_DEFAULT_CONFIG \"${SRS_DEFAULT_CONFIG}\"" >> $SRS_AUTO_HEADERS_H
echo "" >> $SRS_AUTO_HEADERS_H
#####################################################################################
# generated the contributors from AUTHORS.txt
#####################################################################################
if [[ -f AUTHORS.md ]]; then
RTMP_SIG_SRS_AUTHORS=$(cat AUTHORS.md|grep "^-"|awk -F '`' '{print $2}')
echo "#define RTMP_SIG_SRS_AUTHORS \"\\" >> $SRS_AUTO_HEADERS_H
for CONTRIBUTOR in $RTMP_SIG_SRS_AUTHORS; do
echo "${CONTRIBUTOR} \\" >> $SRS_AUTO_HEADERS_H
done
echo "\"" >> $SRS_AUTO_HEADERS_H
else
echo "#define RTMP_SIG_SRS_AUTHORS \"ossrs\"" >> $SRS_AUTO_HEADERS_H
fi
# new empty line to auto headers file.
echo "" >> $SRS_AUTO_HEADERS_H
#####################################################################################
# auto header EOF.
#####################################################################################
echo "#endif" >> $SRS_AUTO_HEADERS_H
echo "" >> $SRS_AUTO_HEADERS_H
+42
View File
@@ -0,0 +1,42 @@
#!/bin/bash
# In .circleci/config.yml, generate *.gcno with
# ./configure --gcov && make utest
# and generate *.gcda by
# ./objs/srs_utest
# Workdir is objs/cover.
workdir=$(cd `dirname $0`/.. && pwd)/objs/cover
# Create trunk under workdir.
mkdir -p $workdir && cd $workdir
ret=$?; if [[ $ret -ne 0 ]]; then echo "Enter workdir failed, ret=$ret"; exit $ret; fi
CODECOV_ARGS=""
if [[ $SRS_PROJECT != '' ]]; then
# -R root dir Used when not in git/hg project to identify project root directory
# -p dir Project root directory. Also used when preparing gcov
CODECOV_ARGS="$CODECOV_ARGS -R $SRS_PROJECT -p $SRS_PROJECT"
fi
if [[ $SRS_BRANCH != '' ]]; then
# -B branch Specify the branch name
CODECOV_ARGS="$CODECOV_ARGS -B $SRS_BRANCH"
fi
if [[ $SRS_SHA != '' ]]; then
# -C sha Specify the commit sha
CODECOV_ARGS="$CODECOV_ARGS -C $SRS_SHA"
fi
if [[ $SRS_PR != '' ]]; then
# -P pr Specify the pull request number
CODECOV_ARGS="$CODECOV_ARGS -P $SRS_PR"
fi
# Upload report with *.gcov
# Remark: The file codecov.yml is not neccessary. It literally depends on git.
# Note: The right path is like:
# https://codecov.io/gh/ossrs/srs/src/3.0release/trunk/src/protocol/srs_rtmp_stack.cpp
# https://codecov.io/gh/ossrs/srs/src/20fbb4466fdc8ba5d810b8570df6004063212838/trunk/src/protocol/srs_rtmp_stack.cpp
cd $workdir &&
export CODECOV_TOKEN="$CODECOV_TOKEN" &&
bash <(curl -s https://codecov.io/bash) $CODECOV_ARGS -f '!*gtest*' -f '!*c++*' -f '!*ffmpeg-*-fit*' &&
echo "Done" && exit 0
+762
View File
@@ -0,0 +1,762 @@
#!/bin/bash
# variables, parent script must set it:
# SRS_JOBS: the build jobs.
# SrsArmMakeOptions: the arm make options for ubuntu12(armhf, v7cpu)
#####################################################################################
#####################################################################################
# prepare the depends tools and libraries
# DEPENDS: options.sh, only when user options parsed, the depends tools are known.
#####################################################################################
#####################################################################################
#####################################################################################
# Check OS and CPU architectures.
#####################################################################################
if [[ $OS_IS_UBUNTU != YES && $OS_IS_CENTOS != YES && $OS_IS_OSX != YES && $SRS_CYGWIN64 != YES ]]; then
if [[ $SRS_CROSS_BUILD != YES && $SRS_GENERIC_LINUX != YES ]]; then
echo "Your OS `uname -s` is not supported."
if [[ $(uname -s) == "Linux" ]]; then
echo "Please try --generic-linux=on for other Linux systems."
fi
exit 1
fi
fi
# The absolute path of SRS_OBJS, for prefix and PKG_CONFIG_PATH
SRS_DEPENDS_LIBS=$(mkdir -p $SRS_OBJS && cd $SRS_OBJS && pwd)
echo -n "SRS_JOBS: $SRS_JOBS, SRS_DEPENDS_LIBS: ${SRS_DEPENDS_LIBS}"
if [[ ! -z $OS_IS_LINUX ]]; then echo -n ", OS_IS_LINUX: $OS_IS_LINUX"; fi
if [[ ! -z $OS_IS_OSX ]]; then echo -n ", OS_IS_OSX: $OS_IS_OSX"; fi
if [[ ! -z $OS_IS_CYGWIN ]]; then echo -n ", OS_IS_CYGWIN: $OS_IS_CYGWIN"; fi
if [[ ! -z $OS_IS_UBUNTU ]]; then echo -n ", OS_IS_UBUNTU: $OS_IS_UBUNTU"; fi
if [[ ! -z $OS_IS_CENTOS ]]; then echo -n ", OS_IS_CENTOS: $OS_IS_CENTOS"; fi
if [[ ! -z $SRS_CROSS_BUILD ]]; then echo -n ", SRS_CROSS_BUILD: $SRS_CROSS_BUILD"; fi
if [[ ! -z $OS_IS_LOONGARCH64 ]]; then echo -n ", OS_IS_LOONGARCH64: $OS_IS_LOONGARCH64"; fi
if [[ ! -z $OS_IS_MIPS64 ]]; then echo -n ", OS_IS_MIPS64: $OS_IS_MIPS64"; fi
if [[ ! -z $OS_IS_LOONGSON ]]; then echo -n ", OS_IS_LOONGSON: $OS_IS_LOONGSON"; fi
if [[ ! -z $OS_IS_X86_64 ]]; then echo -n ", OS_IS_X86_64: $OS_IS_X86_64"; fi
if [[ ! -z $OS_IS_RISCV ]]; then echo -n ", OS_IS_RISCV: $OS_IS_RISCV"; fi
echo ""
#####################################################################################
# Check dependency tools.
#####################################################################################
if [[ $SRS_OSX == YES ]]; then
brew --version >/dev/null 2>/dev/null; ret=$?; if [[ 0 -ne $ret ]]; then
echo "Please install brew at https://brew.sh/"; exit $ret;
fi
fi
# Check perl, which is depended by automake for building libopus etc.
perl --version >/dev/null 2>/dev/null; ret=$?; if [[ 0 -ne $ret ]]; then
if [[ $OS_IS_CENTOS == YES ]]; then
echo "Please install perl by:"
echo " yum install -y perl"
elif [[ $OS_IS_UBUNTU == YES ]]; then
echo "Please install perl by:"
echo " apt install -y perl"
else
echo "Please install perl"
fi
exit $ret;
fi
gcc --version >/dev/null 2>/dev/null; ret=$?; if [[ 0 -ne $ret ]]; then
if [[ $OS_IS_CENTOS == YES ]]; then
echo "Please install gcc by:"
echo " yum install -y gcc"
elif [[ $OS_IS_UBUNTU == YES ]]; then
echo "Please install gcc by:"
echo " apt install -y gcc"
else
echo "Please install gcc"
fi
exit $ret;
fi
g++ --version >/dev/null 2>/dev/null; ret=$?; if [[ 0 -ne $ret ]]; then
if [[ $OS_IS_CENTOS == YES ]]; then
echo "Please install g++ by:"
echo " yum install -y gcc-c++"
elif [[ $OS_IS_UBUNTU == YES ]]; then
echo "Please install g++ by:"
echo " apt install -y g++"
else
echo "Please install gcc-c++"
fi
exit $ret;
fi
make --version >/dev/null 2>/dev/null; ret=$?; if [[ 0 -ne $ret ]]; then
if [[ $OS_IS_CENTOS == YES ]]; then
echo "Please install make by:"
echo " yum install -y make"
elif [[ $OS_IS_UBUNTU == YES ]]; then
echo "Please install make by:"
echo " apt install -y make"
else
echo "Please install make"
fi
exit $ret;
fi
patch --version >/dev/null 2>/dev/null; ret=$?; if [[ 0 -ne $ret ]]; then
if [[ $OS_IS_CENTOS == YES ]]; then
echo "Please install patch by:"
echo " yum install -y patch"
elif [[ $OS_IS_UBUNTU == YES ]]; then
echo "Please install patch by:"
echo " apt install -y patch"
else
echo "Please install patch"
fi
exit $ret;
fi
unzip -v >/dev/null 2>/dev/null; ret=$?; if [[ 0 -ne $ret ]]; then
if [[ $OS_IS_CENTOS == YES ]]; then
echo "Please install unzip by:"
echo " yum install -y unzip"
elif [[ $OS_IS_UBUNTU == YES ]]; then
echo "Please install unzip by:"
echo " apt install -y unzip"
else
echo "Please install unzip"
fi
exit $ret;
fi
automake --version >/dev/null 2>/dev/null; ret=$?; if [[ 0 -ne $ret ]]; then
if [[ $OS_IS_CENTOS == YES ]]; then
echo "Please install automake by:"
echo " yum install -y automake"
elif [[ $OS_IS_UBUNTU == YES ]]; then
echo "Please install automake by:"
echo " apt install -y automake"
else
echo "Please install automake"
fi
exit $ret;
fi
if [[ $SRS_VALGRIND == YES ]]; then
valgrind --version >/dev/null 2>/dev/null; ret=$?; if [[ 0 -ne $ret ]]; then
echo "Please install valgrind"; exit $ret;
fi
if [[ ! -f /usr/include/valgrind/valgrind.h ]]; then
echo "Please install valgrind-dev"; exit $ret;
fi
fi
# Check tclsh, which is depended by SRT.
if [[ $SRS_SRT == YES ]]; then
tclsh <<< "exit" >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
if [[ $OS_IS_CENTOS == YES ]]; then
echo "Please install tclsh by:"
echo " yum install -y tcl"
elif [[ $OS_IS_UBUNTU == YES ]]; then
echo "Please install tclsh by:"
echo " apt install -y tclsh"
else
echo "Please install tclsh"
fi
exit $ret;
fi
cmake --version >/dev/null 2>/dev/null; ret=$?; if [[ 0 -ne $ret ]]; then
if [[ $OS_IS_CENTOS == YES ]]; then
echo "Please install cmake by:"
echo " yum install -y cmake"
elif [[ $OS_IS_UBUNTU == YES ]]; then
echo "Please install cmake by:"
echo " apt install -y cmake"
else
echo "Please install cmake"
fi
exit $ret;
fi
fi
pkg-config --version >/dev/null 2>/dev/null; ret=$?; if [[ 0 -ne $ret ]]; then
echo "Please install pkg-config"; exit $ret;
fi
which ls >/dev/null 2>/dev/null; ret=$?; if [[ 0 -ne $ret ]]; then
if [[ $OS_IS_CENTOS == YES ]]; then
echo "Please install which by:"
echo " yum install -y which"
elif [[ $OS_IS_UBUNTU == YES ]]; then
echo "Please install which by:"
echo " apt install -y which"
else
echo "Please install which"
fi
exit $ret;
fi
#####################################################################################
# Try to load cache if exists /usr/local/srs-cache
#####################################################################################
# Use srs-cache from base image. See https://github.com/ossrs/dev-docker/blob/ubuntu20-cache/Dockerfile
# Note that the cache for cygwin is not under /usr/local, but copy to objs instead.
if [[ -d /usr/local/srs-cache/srs/trunk/objs && $(pwd) != "/usr/local/srs-cache/srs/trunk" && $SRS_BUILD_CACHE == YES ]]; then
SOURCE_DIR=$(ls -d /usr/local/srs-cache/srs/trunk/objs/Platform-SRS${SRS_MAJOR}-* 2>/dev/null|head -n 1)
if [[ -d $SOURCE_DIR ]]; then
TARGET_DIR=${SRS_OBJS}/${SRS_PLATFORM} &&
echo "Build from cache, source=$SOURCE_DIR, target=$TARGET_DIR" &&
rm -rf $TARGET_DIR && mkdir -p ${SRS_OBJS} && cp -R $SOURCE_DIR $TARGET_DIR &&
du -sh /usr/local/srs-cache/srs/trunk/objs/Platform-* &&
du -sh /usr/local/srs-cache/srs/trunk/objs/Platform-*/* &&
du -sh objs/Platform-* &&
ls -lh objs
fi
fi
#####################################################################################
# Check for address sanitizer, see https://github.com/google/sanitizers
#####################################################################################
if [[ $SRS_SANITIZER == YES && $OS_IS_X86_64 == YES ]]; then
echo 'int main() { return 0; }' > ${SRS_OBJS}/test_sanitizer.c &&
gcc -fsanitize=address -fno-omit-frame-pointer -g -O0 ${SRS_OBJS}/test_sanitizer.c \
-o ${SRS_OBJS}/test_sanitizer 1>/dev/null 2>&1;
ret=$?; rm -rf ${SRS_OBJS}/test_sanitizer*
if [[ $ret -ne 0 ]]; then
echo "Please install libasan, see https://github.com/google/sanitizers";
if [[ $OS_IS_CENTOS == YES ]]; then echo " sudo yum install -y libasan"; fi
exit $ret;
fi
fi
if [[ $SRS_SANITIZER == YES && $OS_IS_X86_64 == YES && $SRS_SANITIZER_STATIC == NO ]]; then
echo 'int main() { return 0; }' > ${SRS_OBJS}/test_sanitizer.c &&
gcc -fsanitize=address -fno-omit-frame-pointer -static-libasan -g -O0 ${SRS_OBJS}/test_sanitizer.c \
-o ${SRS_OBJS}/test_sanitizer 1>/dev/null 2>&1;
ret=$?; rm -rf ${SRS_OBJS}/test_sanitizer*
if [[ $ret -eq 0 ]]; then
echo "link static-libasan"
SRS_SANITIZER_STATIC=YES
fi
fi
if [[ $SRS_SANITIZER == YES && $OS_IS_X86_64 == YES && $SRS_SANITIZER_LOG == NO ]]; then
echo "#include <sanitizer/asan_interface.h>" > ${SRS_OBJS}/test_sanitizer.c &&
echo "int main() { return 0; }" >> ${SRS_OBJS}/test_sanitizer.c &&
gcc -fsanitize=address -fno-omit-frame-pointer -g -O0 ${SRS_OBJS}/test_sanitizer.c \
-o ${SRS_OBJS}/test_sanitizer 1>/dev/null 2>&1;
ret=$?; rm -rf ${SRS_OBJS}/test_sanitizer*
if [[ $ret -eq 0 ]]; then
echo "libasan api found ok!";
SRS_SANITIZER_LOG=YES
fi
fi
#####################################################################################
# state-threads
#####################################################################################
# check the cross build flag file, if flag changed, need to rebuild the st.
_ST_MAKE=linux-debug && _ST_OBJ="LINUX_`uname -r`_DBG"
# Always alloc on heap, @see https://github.com/ossrs/srs/issues/509#issuecomment-719931676
_ST_EXTRA_CFLAGS="-DMALLOC_STACK"
# For valgrind to detect memory issues.
if [[ $SRS_VALGRIND == YES ]]; then
_ST_EXTRA_CFLAGS="$_ST_EXTRA_CFLAGS -DMD_VALGRIND"
fi
# for osx, use darwin for st, donot use epoll.
if [[ $SRS_OSX == YES ]]; then
_ST_MAKE=darwin-debug && _ST_OBJ="DARWIN_`uname -r`_DBG"
fi
# for windows/cygwin
if [[ $SRS_CYGWIN64 = YES ]]; then
_ST_MAKE=cygwin64-debug && _ST_OBJ="CYGWIN64_`uname -s`_DBG"
fi
# For Ubuntu, the epoll detection might be fail.
if [[ $OS_IS_UBUNTU == YES ]]; then
_ST_EXTRA_CFLAGS="$_ST_EXTRA_CFLAGS -DMD_HAVE_EPOLL"
fi
# Whether enable debug stats.
if [[ $SRS_DEBUG_STATS == YES ]]; then
_ST_EXTRA_CFLAGS="$_ST_EXTRA_CFLAGS -DDEBUG_STATS"
fi
# Pass the global extra flags.
if [[ $SRS_EXTRA_FLAGS != '' ]]; then
_ST_EXTRA_CFLAGS="$_ST_EXTRA_CFLAGS $SRS_EXTRA_FLAGS"
fi
# Whether link as .so
if [[ $SRS_SHARED_ST == YES ]]; then
_ST_STATIC_ONLY=no;
else
_ST_STATIC_ONLY=yes;
fi
# The final args to make st.
_ST_MAKE_ARGS="${_ST_MAKE} STATIC_ONLY=${_ST_STATIC_ONLY}"
_ST_MAKE_ARGS="${_ST_MAKE_ARGS} CC=${SRS_TOOL_CC} AR=${SRS_TOOL_AR} LD=${SRS_TOOL_LD} RANDLIB=${SRS_TOOL_RANDLIB}"
# Patched ST from https://github.com/ossrs/state-threads/tree/srs
if [[ -f ${SRS_OBJS}/${SRS_PLATFORM}/3rdparty/st/libst.a ]]; then
rm -rf ${SRS_OBJS}/st && cp -rf ${SRS_OBJS}/${SRS_PLATFORM}/3rdparty/st ${SRS_OBJS}/ &&
echo "The state-threads is ok."
else
echo "Building state-threads." &&
rm -rf ${SRS_OBJS}/${SRS_PLATFORM}/st-srs ${SRS_OBJS}/${SRS_PLATFORM}/3rdparty/st ${SRS_OBJS}/st &&
cp -rf ${SRS_WORKDIR}/3rdparty/st-srs ${SRS_OBJS}/${SRS_PLATFORM}/ &&
env EXTRA_CFLAGS="${_ST_EXTRA_CFLAGS}" make -C ${SRS_OBJS}/${SRS_PLATFORM}/st-srs ${_ST_MAKE_ARGS} &&
mkdir -p ${SRS_OBJS}/${SRS_PLATFORM}/3rdparty/st &&
cp -f ${SRS_OBJS}/${SRS_PLATFORM}/st-srs/${_ST_OBJ}/st.h ${SRS_OBJS}/${SRS_PLATFORM}/3rdparty/st/ &&
cp -f ${SRS_OBJS}/${SRS_PLATFORM}/st-srs/${_ST_OBJ}/libst.a ${SRS_OBJS}/${SRS_PLATFORM}/3rdparty/st/ &&
cp -rf ${SRS_OBJS}/${SRS_PLATFORM}/3rdparty/st ${SRS_OBJS}/ &&
echo "The state-threads is ok."
fi
# check status
ret=$?; if [[ $ret -ne 0 ]]; then echo "Build state-threads failed, ret=$ret"; exit $ret; fi
#####################################################################################
# nginx for HLS, nginx-1.5.0
#####################################################################################
function write_nginx_html5()
{
cat<<END > ${html_file}
<video width="100%" autoplay controls autobuffer type="application/vnd.apple.mpegurl"
src="${hls_stream}">
</video>
END
}
# create the nginx dir, for http-server if not build nginx
mkdir -p ${SRS_OBJS}/nginx
# the demo dir.
# create forward dir
mkdir -p ${SRS_OBJS}/nginx/html/live &&
html_file=${SRS_OBJS}/nginx/html/live/livestream.html && hls_stream=livestream.m3u8 && write_nginx_html5 &&
# copy players to nginx html dir.
rm -rf ${SRS_OBJS}/nginx/html/players &&
cp -rf $SRS_WORKDIR/research/players ${SRS_OBJS}/nginx/html/ &&
# for favicon.ico
rm -rf ${SRS_OBJS}/nginx/html/favicon.ico &&
cp -f $SRS_WORKDIR/research/api-server/static-dir/favicon.ico ${SRS_OBJS}/nginx/html/favicon.ico &&
# For srs-console.
rm -rf ${SRS_OBJS}/nginx/html/console &&
cp -rf $SRS_WORKDIR/research/console ${SRS_OBJS}/nginx/html/ &&
# For SRS signaling.
rm -rf ${SRS_OBJS}/nginx/html/demos &&
cp -rf $SRS_WORKDIR/3rdparty/signaling/www/demos ${SRS_OBJS}/nginx/html/ &&
# For home page index.html
rm -rf ${SRS_OBJS}/nginx/html/index.html &&
cp -f $SRS_WORKDIR/research/api-server/static-dir/index.html ${SRS_OBJS}/nginx/html/index.html &&
# nginx.html to detect whether nginx is alive
echo "Nginx is ok." > ${SRS_OBJS}/nginx/html/nginx.html
# check status
ret=$?; if [[ $ret -ne 0 ]]; then echo "Build web pages failed, ret=$ret"; exit $ret; fi
#####################################################################################
# Generate default self-sign certificate for HTTPS server, test only.
#####################################################################################
if [[ ! -f $SRS_WORKDIR/conf/server.key || ! -f $SRS_WORKDIR/conf/server.crt ]]; then
openssl genrsa -out $SRS_WORKDIR/conf/server.key 2048 &&
openssl req -new -x509 -key $SRS_WORKDIR/conf/server.key -out $SRS_WORKDIR/conf/server.crt -days 3650 \
-subj "/C=CN/ST=Beijing/L=Beijing/O=Me/OU=Me/CN=ossrs.net" &&
echo "Generate test-only self-sign certificate files"
fi
#####################################################################################
# openssl, for rtmp complex handshake and HLS encryption.
#####################################################################################
if [[ $SRS_SSL == YES && $SRS_USE_SYS_SSL == YES ]]; then
echo "Warning: Use system libssl, without compiling openssl."
fi
# @see http://www.openssl.org/news/secadv/20140407.txt
# Affected users should upgrade to OpenSSL 1.1.0e. Users unable to immediately
# upgrade can alternatively recompile OpenSSL with -DOPENSSL_NO_HEARTBEATS.
if [[ $SRS_SSL == YES && $SRS_USE_SYS_SSL != YES ]]; then
OPENSSL_OPTIONS="-no-shared -no-threads -DOPENSSL_NO_HEARTBEATS"
OPENSSL_CONFIG="./config"
# https://stackoverflow.com/questions/15539062/cross-compiling-of-openssl-for-linux-arm-v5te-linux-gnueabi-toolchain
if [[ $SRS_CROSS_BUILD == YES ]]; then
OPENSSL_CONFIG="./Configure linux-generic32"
if [[ $SRS_CROSS_BUILD_ARCH == "arm" ]]; then OPENSSL_CONFIG="./Configure linux-armv4"; fi
if [[ $SRS_CROSS_BUILD_ARCH == "aarch64" ]]; then OPENSSL_CONFIG="./Configure linux-aarch64"; fi
if [[ $SRS_CROSS_BUILD_ARCH == "mipsel" ]]; then OPENSSL_CONFIG="./Configure linux-mips32"; fi
elif [[ ! -f ${SRS_OBJS}/${SRS_PLATFORM}/3rdparty/openssl/lib/libssl.a ]]; then
# Try to use exists libraries.
if [[ -f /usr/local/ssl/lib/libssl.a && $SRS_SSL_LOCAL == NO ]]; then
(mkdir -p ${SRS_OBJS}/${SRS_PLATFORM}/3rdparty/openssl/lib && cd ${SRS_OBJS}/${SRS_PLATFORM}/3rdparty/openssl/lib &&
cp /usr/local/ssl/lib/libssl.a . && cp /usr/local/ssl/lib/libcrypto.a . &&
mkdir -p /usr/local/ssl/lib/pkgconfig && cp -rf /usr/local/ssl/lib/pkgconfig .)
(mkdir -p ${SRS_OBJS}/${SRS_PLATFORM}/3rdparty/openssl/include && cd ${SRS_OBJS}/${SRS_PLATFORM}/3rdparty/openssl/include &&
cp -rf /usr/local/ssl/include/openssl .)
fi
# Warning if not use the system ssl.
if [[ -f /usr/local/ssl/lib/libssl.a && $SRS_SSL_LOCAL == YES ]]; then
echo "Warning: Local openssl is on, ignore system openssl"
fi
fi
# Patch for loongarch mips64, disable ASM for build failed message as bellow:
# Error: opcode not supported on this processor: mips3 (mips3)
if [[ $OS_IS_MIPS64 == YES ]]; then OPENSSL_CONFIG="./Configure linux64-mips64"; fi
if [[ $OS_IS_LOONGSON == YES ]]; then OPENSSL_OPTIONS="$OPENSSL_OPTIONS -no-asm"; fi
# For RTC, we should use ASM to improve performance, not a little improving.
if [[ $SRS_RTC == NO || $SRS_NASM == NO ]]; then
OPENSSL_OPTIONS="$OPENSSL_OPTIONS -no-asm"
echo "Warning: NASM is off, performance is hurt"
fi
# Mac OS X can have issues (its often a neglected platform).
# @see https://wiki.openssl.org/index.php/Compilation_and_Installation
if [[ $SRS_OSX == YES ]]; then
export KERNEL_BITS=64;
fi
# Use 1.0 if required.
if [[ $SRS_SSL_1_0 == YES ]]; then
OPENSSL_AR="$SRS_TOOL_AR -r" # For openssl 1.0, MUST specifies the args for ar or build faild.
OPENSSL_CANDIDATE="openssl-OpenSSL_1_0_2u" &&
OPENSSL_UNZIP="tar xf ${SRS_WORKDIR}/3rdparty/$OPENSSL_CANDIDATE.tar.gz -C ${SRS_OBJS}/${SRS_PLATFORM}"
else
OPENSSL_AR="$SRS_TOOL_AR"
OPENSSL_CANDIDATE="openssl-1.1-fit" &&
OPENSSL_UNZIP="cp -R ${SRS_WORKDIR}/3rdparty/$OPENSSL_CANDIDATE ${SRS_OBJS}/${SRS_PLATFORM}/"
fi
#
# https://wiki.openssl.org/index.php/Compilation_and_Installation#Configure_Options
# Already defined: -no-shared -no-threads -no-asm
# Should enable: -no-dtls -no-dtls1 -no-ssl3
# Might able to disable: -no-ssl2 -no-comp -no-idea -no-hw -no-engine -no-dso -no-err -no-nextprotoneg -no-psk -no-srp -no-ec2m -no-weak-ssl-ciphers
# Note that we do not disable more features, because no file could be removed.
#OPENSSL_OPTIONS="$OPENSSL_OPTIONS -no-ssl2 -no-comp -no-idea -no-hw -no-engine -no-dso -no-err -no-nextprotoneg -no-psk -no-srp -no-ec2m -no-weak-ssl-ciphers"
#
# cross build not specified, if exists flag, need to rebuild for no-arm platform.
if [[ -f ${SRS_OBJS}/${SRS_PLATFORM}/3rdparty/openssl/lib/libssl.a ]]; then
rm -rf ${SRS_OBJS}/openssl && cp -rf ${SRS_OBJS}/${SRS_PLATFORM}/3rdparty/openssl ${SRS_OBJS}/ &&
echo "The $OPENSSL_CANDIDATE is ok."
else
echo "Building $OPENSSL_CANDIDATE." &&
rm -rf ${SRS_OBJS}/${SRS_PLATFORM}/${OPENSSL_CANDIDATE} ${SRS_OBJS}/${SRS_PLATFORM}/3rdparty/openssl \
${SRS_OBJS}/openssl &&
${OPENSSL_UNZIP} &&
(
cd ${SRS_OBJS}/${SRS_PLATFORM}/${OPENSSL_CANDIDATE} &&
chmod +x ./config ./Configure &&
${OPENSSL_CONFIG} --prefix=${SRS_DEPENDS_LIBS}/${SRS_PLATFORM}/3rdparty/openssl $OPENSSL_OPTIONS
) &&
make -C ${SRS_OBJS}/${SRS_PLATFORM}/${OPENSSL_CANDIDATE} CC=${SRS_TOOL_CC} AR="${OPENSSL_AR}" \
LD=${SRS_TOOL_LD} RANDLIB=${SRS_TOOL_RANDLIB} ${SRS_JOBS} &&
make -C ${SRS_OBJS}/${SRS_PLATFORM}/${OPENSSL_CANDIDATE} install_sw &&
cp -rf ${SRS_OBJS}/${SRS_PLATFORM}/3rdparty/openssl ${SRS_OBJS}/ &&
echo "The $OPENSSL_CANDIDATE is ok."
fi
# check status
ret=$?; if [[ $ret -ne 0 ]]; then echo "Build $OPENSSL_CANDIDATE failed, ret=$ret"; exit $ret; fi
fi
#####################################################################################
# srtp
#####################################################################################
if [[ $SRS_RTC == YES && $SRS_USE_SYS_SRTP == YES ]]; then
echo "Warning: Use system libsrtp, without compiling srtp."
fi
if [[ $SRS_RTC == YES && $SRS_USE_SYS_SRTP == NO ]]; then
SRTP_OPTIONS=""
# To eliminate warnings, see https://stackoverflow.com/a/34208904/17679565
# was built for newer macOS version (11.6) than being linked (11.0)
if [[ $SRS_OSX == YES ]]; then
export MACOSX_DEPLOYMENT_TARGET=11.0
echo "Set MACOSX_DEPLOYMENT_TARGET to avoid warnings"
fi
# If use ASM for SRTP, we enable openssl(with ASM).
if [[ $SRS_SRTP_ASM == YES ]]; then
SRTP_OPTIONS="--enable-openssl"
SRTP_CONFIGURE="env PKG_CONFIG_PATH=${SRS_DEPENDS_LIBS}/openssl/lib/pkgconfig ./configure"
else
SRTP_OPTIONS="--disable-openssl"
SRTP_CONFIGURE="./configure"
fi
if [[ $SRS_CROSS_BUILD == YES ]]; then
SRTP_OPTIONS="$SRTP_OPTIONS --host=$SRS_CROSS_BUILD_HOST"
fi
if [[ $OS_IS_LOONGARCH64 == YES ]]; then
SRTP_OPTIONS="$SRTP_OPTIONS --build=loongarch64-unknown-linux-gnu"
fi
# Copy and patch source files, then build and install libsrtp.
if [[ -f ${SRS_OBJS}/${SRS_PLATFORM}/3rdparty/srtp2/lib/libsrtp2.a ]]; then
rm -rf ${SRS_OBJS}/srtp2 &&
cp -rf ${SRS_OBJS}/${SRS_PLATFORM}/3rdparty/srtp2 ${SRS_OBJS} &&
echo "The libsrtp-2-fit is ok."
else
echo "Building libsrtp-2-fit."
rm -rf ${SRS_OBJS}/${SRS_PLATFORM}/libsrtp-2-fit ${SRS_OBJS}/${SRS_PLATFORM}/3rdparty/srtp2 \
${SRS_OBJS}/srtp2 &&
cp -rf ${SRS_WORKDIR}/3rdparty/libsrtp-2-fit ${SRS_OBJS}/${SRS_PLATFORM}/ &&
# For cygwin64, the patch is not available, so use sed instead.
if [[ $SRS_CYGWIN64 == YES ]]; then
sed -i 's/char bit_string/static char bit_string/g' ${SRS_OBJS}/${SRS_PLATFORM}/libsrtp-2-fit/crypto/math/datatypes.c
else
patch -p0 ${SRS_OBJS}/${SRS_PLATFORM}/libsrtp-2-fit/crypto/math/datatypes.c ${SRS_WORKDIR}/3rdparty/patches/srtp/gcc10-01.patch
fi &&
# Patch the cpu arch guessing for RISCV.
if [[ $OS_IS_RISCV == YES ]]; then
patch -p0 ${SRS_OBJS}/${SRS_PLATFORM}/libsrtp-2-fit/config.guess ${SRS_WORKDIR}/3rdparty/patches/srtp/config.guess-02.patch
fi &&
(
cd ${SRS_OBJS}/${SRS_PLATFORM}/libsrtp-2-fit &&
$SRTP_CONFIGURE ${SRTP_OPTIONS} --prefix=${SRS_DEPENDS_LIBS}/${SRS_PLATFORM}/3rdparty/srtp2
) &&
# Sometimes it might fail because autoconf failed to generate crypto/include.config.h
if [[ $SRS_CYGWIN64 == YES ]]; then
SRS_PATCH_SOURCE=${SRS_WORKDIR}/3rdparty/patches/srtp/cygwin-crypto-include-config.h
if [[ $SRS_SRTP_ASM == YES ]]; then
SRS_PATCH_SOURCE=${SRS_WORKDIR}/3rdparty/patches/srtp/cygwin-gcm-crypto-include-config.h
fi
grep -q 'HAVE_UINT64_T 1' ${SRS_OBJS}/${SRS_PLATFORM}/libsrtp-2-fit/crypto/include/config.h ||
cp -f $SRS_PATCH_SOURCE ${SRS_OBJS}/${SRS_PLATFORM}/libsrtp-2-fit/crypto/include/config.h
fi &&
make -C ${SRS_OBJS}/${SRS_PLATFORM}/libsrtp-2-fit ${SRS_JOBS} &&
make -C ${SRS_OBJS}/${SRS_PLATFORM}/libsrtp-2-fit install &&
cp -rf ${SRS_OBJS}/${SRS_PLATFORM}/3rdparty/srtp2 ${SRS_OBJS}/ &&
echo "The libsrtp-2-fit is ok."
fi
ret=$?; if [[ $ret -ne 0 ]]; then echo "Build libsrtp failed, ret=$ret"; exit $ret; fi
fi
#####################################################################################
# libopus, for WebRTC to transcode AAC with Opus.
#####################################################################################
# For cross build, we use opus of FFmpeg, so we don't build the libopus.
if [[ $SRS_RTC == YES && $SRS_USE_SYS_FFMPEG != YES && $SRS_FFMPEG_OPUS != YES ]]; then
# Only build static libraries if no shared FFmpeg.
if [[ $SRS_SHARED_FFMPEG != YES ]]; then
OPUS_OPTIONS="--disable-shared --disable-doc"
fi
if [[ $OS_IS_LOONGARCH64 == YES ]]; then
OPUS_OPTIONS="$OPUS_OPTIONS --build=loongarch64-unknown-linux-gnu"
fi
if [[ -f ${SRS_OBJS}/${SRS_PLATFORM}/3rdparty/opus/lib/libopus.a ]]; then
rm -rf ${SRS_OBJS}/opus && cp -rf ${SRS_OBJS}/${SRS_PLATFORM}/3rdparty/opus ${SRS_OBJS}/ &&
echo "The opus-1.3.1 is ok."
else
echo "Building opus-1.3.1." &&
rm -rf ${SRS_OBJS}/${SRS_PLATFORM}/opus-1.3.1 ${SRS_OBJS}/${SRS_PLATFORM}/3rdparty/opus ${SRS_OBJS}/opus &&
tar xf ${SRS_WORKDIR}/3rdparty/opus-1.3.1.tar.gz -C ${SRS_OBJS}/${SRS_PLATFORM} &&
(
# Opus requires automake 1.15, and fails for automake 1.16+, so we run autoreconf to fix it.
cd ${SRS_OBJS}/${SRS_PLATFORM}/opus-1.3.1 && autoreconf &&
./configure --prefix=${SRS_DEPENDS_LIBS}/${SRS_PLATFORM}/3rdparty/opus --enable-static $OPUS_OPTIONS
) &&
make -C ${SRS_OBJS}/${SRS_PLATFORM}/opus-1.3.1 ${SRS_JOBS} &&
make -C ${SRS_OBJS}/${SRS_PLATFORM}/opus-1.3.1 install &&
cp -rf ${SRS_OBJS}/${SRS_PLATFORM}/3rdparty/opus ${SRS_OBJS}/ &&
echo "The opus-1.3.1 is ok."
fi
if [ ! -f ${SRS_OBJS}/opus/lib/libopus.a ]; then echo "Build opus-1.3.1 failed."; exit -1; fi
fi
#####################################################################################
# ffmpeg-fit, for WebRTC to transcode AAC with Opus.
#####################################################################################
if [[ $SRS_FFMPEG_FIT == YES && $SRS_USE_SYS_FFMPEG == YES ]]; then
echo "Warning: Use system ffmpeg, without compiling ffmpeg."
fi
if [[ $SRS_FFMPEG_FIT == YES && $SRS_USE_SYS_FFMPEG == NO ]]; then
FFMPEG_CONFIGURE="env SRS_FFMPEG_FIT=on"
if [[ $SRS_FFMPEG_OPUS != YES ]]; then
FFMPEG_CONFIGURE="$FFMPEG_CONFIGURE PKG_CONFIG_PATH=${SRS_DEPENDS_LIBS}/opus/lib/pkgconfig"
fi
FFMPEG_CONFIGURE="$FFMPEG_CONFIGURE ./configure"
# Disable all features, note that there are still some options need to be disabled.
FFMPEG_OPTIONS="--disable-everything"
# Disable all asm for FFmpeg, to compatible with ARM CPU.
FFMPEG_OPTIONS="$FFMPEG_OPTIONS --disable-asm --disable-x86asm --disable-inline-asm"
# Only build static libraries if no shared FFmpeg.
if [[ $SRS_SHARED_FFMPEG == YES ]]; then
FFMPEG_OPTIONS="$FFMPEG_OPTIONS --enable-shared"
fi
# For loongson/mips64, disable mips64r6, or build failed.
if [[ $OS_IS_MIPS64 == YES && $OS_IS_LOONGSON == YES ]]; then FFMPEG_OPTIONS="$FFMPEG_OPTIONS --disable-mips64r6"; fi
# For cross-build.
if [[ $SRS_CROSS_BUILD == YES ]]; then
FFMPEG_OPTIONS="$FFMPEG_OPTIONS --enable-cross-compile --target-os=linux --disable-pthreads"
FFMPEG_OPTIONS="$FFMPEG_OPTIONS --arch=$SRS_CROSS_BUILD_ARCH";
if [[ $SRS_CROSS_BUILD_CPU != "" ]]; then FFMPEG_OPTIONS="$FFMPEG_OPTIONS --cpu=$SRS_CROSS_BUILD_CPU"; fi
FFMPEG_OPTIONS="$FFMPEG_OPTIONS --cross-prefix=$SRS_CROSS_BUILD_PREFIX"
FFMPEG_OPTIONS="$FFMPEG_OPTIONS --cc=${SRS_TOOL_CC} --cxx=${SRS_TOOL_CXX} --ar=${SRS_TOOL_AR} --ld=${SRS_TOOL_LD}"
fi
# For audio codec opus, use FFmpeg native one, or external libopus.
if [[ $SRS_FFMPEG_OPUS == YES ]]; then
# TODO: FIXME: Note that the audio might be corrupted, see https://github.com/ossrs/srs/issues/3140
FFMPEG_OPTIONS="$FFMPEG_OPTIONS --enable-decoder=opus --enable-encoder=opus"
else
FFMPEG_OPTIONS="$FFMPEG_OPTIONS --enable-decoder=libopus --enable-encoder=libopus --enable-libopus"
fi
# Disable features of ffmpeg.
FFMPEG_OPTIONS="$FFMPEG_OPTIONS --disable-avdevice --disable-avformat --disable-swscale --disable-postproc --disable-avfilter --disable-network"
FFMPEG_OPTIONS="$FFMPEG_OPTIONS --disable-dwt --disable-error-resilience --disable-lsp --disable-lzo --disable-faan --disable-pixelutils"
FFMPEG_OPTIONS="$FFMPEG_OPTIONS --disable-hwaccels --disable-devices --disable-audiotoolbox --disable-videotoolbox --disable-cuvid"
FFMPEG_OPTIONS="$FFMPEG_OPTIONS --disable-d3d11va --disable-dxva2 --disable-ffnvcodec --disable-nvdec --disable-nvenc --disable-v4l2-m2m --disable-vaapi"
FFMPEG_OPTIONS="$FFMPEG_OPTIONS --disable-vdpau --disable-appkit --disable-coreimage --disable-avfoundation --disable-securetransport --disable-iconv"
FFMPEG_OPTIONS="$FFMPEG_OPTIONS --disable-lzma --disable-sdl2"
# Enable FFmpeg native AAC encoder and decoder.
FFMPEG_OPTIONS="$FFMPEG_OPTIONS --enable-decoder=aac --enable-decoder=aac_fixed --enable-decoder=aac_latm --enable-encoder=aac"
# Enable FFmpeg native MP3 decoder, which depends on dct.
FFMPEG_OPTIONS="$FFMPEG_OPTIONS --enable-decoder=mp3 --enable-dct"
if [[ -f ${SRS_OBJS}/${SRS_PLATFORM}/3rdparty/ffmpeg/lib/libavcodec.a ]]; then
rm -rf ${SRS_OBJS}/ffmpeg && cp -rf ${SRS_OBJS}/${SRS_PLATFORM}/3rdparty/ffmpeg ${SRS_OBJS}/ &&
echo "The ffmpeg-4-fit is ok."
else
echo "Building ffmpeg-4-fit." &&
rm -rf ${SRS_OBJS}/${SRS_PLATFORM}/ffmpeg-4-fit ${SRS_OBJS}/${SRS_PLATFORM}/3rdparty/ffmpeg \
${SRS_OBJS}/ffmpeg &&
cp -rf ${SRS_WORKDIR}/3rdparty/ffmpeg-4-fit ${SRS_OBJS}/${SRS_PLATFORM}/ &&
(
cd ${SRS_OBJS}/${SRS_PLATFORM}/ffmpeg-4-fit &&
$FFMPEG_CONFIGURE --prefix=${SRS_DEPENDS_LIBS}/${SRS_PLATFORM}/3rdparty/ffmpeg \
--pkg-config=pkg-config --pkg-config-flags='--static' --extra-libs='-lpthread' --extra-libs='-lm' \
${FFMPEG_OPTIONS}
) &&
# See https://www.laoyuyu.me/2019/05/23/android/clang_compile_ffmpeg/
if [[ $SRS_CROSS_BUILD == YES ]]; then
sed -i -e 's/#define getenv(x) NULL/\/\*#define getenv(x) NULL\*\//g' ${SRS_OBJS}/${SRS_PLATFORM}/ffmpeg-4-fit/config.h &&
sed -i -e 's/#define HAVE_GMTIME_R 0/#define HAVE_GMTIME_R 1/g' ${SRS_OBJS}/${SRS_PLATFORM}/ffmpeg-4-fit/config.h &&
sed -i -e 's/#define HAVE_LOCALTIME_R 0/#define HAVE_LOCALTIME_R 1/g' ${SRS_OBJS}/${SRS_PLATFORM}/ffmpeg-4-fit/config.h &&
# For MIPS, which fail with:
# ./libavutil/libm.h:54:32: error: static declaration of 'cbrt' follows non-static declaration
# /root/openwrt/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/include/math.h:163:13: note: previous declaration of 'cbrt' was here
if [[ $SRS_CROSS_BUILD_ARCH == "mipsel" || $SRS_CROSS_BUILD_ARCH == "arm" || $SRS_CROSS_BUILD_ARCH == "aarch64" ]]; then
sed -i -e 's/#define HAVE_CBRT 0/#define HAVE_CBRT 1/g' ${SRS_OBJS}/${SRS_PLATFORM}/ffmpeg-4-fit/config.h &&
sed -i -e 's/#define HAVE_CBRTF 0/#define HAVE_CBRTF 1/g' ${SRS_OBJS}/${SRS_PLATFORM}/ffmpeg-4-fit/config.h &&
sed -i -e 's/#define HAVE_COPYSIGN 0/#define HAVE_COPYSIGN 1/g' ${SRS_OBJS}/${SRS_PLATFORM}/ffmpeg-4-fit/config.h &&
sed -i -e 's/#define HAVE_ERF 0/#define HAVE_ERF 1/g' ${SRS_OBJS}/${SRS_PLATFORM}/ffmpeg-4-fit/config.h &&
sed -i -e 's/#define HAVE_HYPOT 0/#define HAVE_HYPOT 1/g' ${SRS_OBJS}/${SRS_PLATFORM}/ffmpeg-4-fit/config.h &&
sed -i -e 's/#define HAVE_RINT 0/#define HAVE_RINT 1/g' ${SRS_OBJS}/${SRS_PLATFORM}/ffmpeg-4-fit/config.h &&
sed -i -e 's/#define HAVE_LRINT 0/#define HAVE_LRINT 1/g' ${SRS_OBJS}/${SRS_PLATFORM}/ffmpeg-4-fit/config.h &&
sed -i -e 's/#define HAVE_LRINTF 0/#define HAVE_LRINTF 1/g' ${SRS_OBJS}/${SRS_PLATFORM}/ffmpeg-4-fit/config.h &&
sed -i -e 's/#define HAVE_ROUND 0/#define HAVE_ROUND 1/g' ${SRS_OBJS}/${SRS_PLATFORM}/ffmpeg-4-fit/config.h &&
sed -i -e 's/#define HAVE_ROUNDF 0/#define HAVE_ROUNDF 1/g' ${SRS_OBJS}/${SRS_PLATFORM}/ffmpeg-4-fit/config.h &&
sed -i -e 's/#define HAVE_TRUNC 0/#define HAVE_TRUNC 1/g' ${SRS_OBJS}/${SRS_PLATFORM}/ffmpeg-4-fit/config.h &&
sed -i -e 's/#define HAVE_TRUNCF 0/#define HAVE_TRUNCF 1/g' ${SRS_OBJS}/${SRS_PLATFORM}/ffmpeg-4-fit/config.h &&
echo "FFmpeg sed ok"
fi
fi &&
make -C ${SRS_OBJS}/${SRS_PLATFORM}/ffmpeg-4-fit ${SRS_JOBS} &&
make -C ${SRS_OBJS}/${SRS_PLATFORM}/ffmpeg-4-fit install &&
cp -rf ${SRS_OBJS}/${SRS_PLATFORM}/3rdparty/ffmpeg ${SRS_OBJS}/ &&
echo "The ffmpeg-4-fit is ok."
fi
# check status
ret=$?; if [[ $ret -ne 0 ]]; then echo "Build ffmpeg-4-fit failed, ret=$ret"; exit $ret; fi
fi
#####################################################################################
# live transcoding, ffmpeg-4.1, x264-core157, lame-3.99.5, libaacplus-2.0.2.
#####################################################################################
# Guess where is the ffmpeg.
SYSTEMP_FFMPEG_BIN=`which ffmpeg`
# Always link the ffmpeg tools if exists.
if [[ -f $SYSTEMP_FFMPEG_BIN && ! -f ${SRS_OBJS}/ffmpeg/bin/ffmpeg ]]; then
mkdir -p ${SRS_OBJS}/ffmpeg/bin &&
cp -f $SYSTEMP_FFMPEG_BIN ${SRS_OBJS}/ffmpeg/bin/
fi
if [[ $SRS_FFMPEG_TOOL == YES ]]; then
if [[ -f ${SRS_OBJS}/ffmpeg/bin/ffmpeg ]]; then
cp -f $SYSTEMP_FFMPEG_BIN ${SRS_OBJS}/ffmpeg/bin/ &&
echo "ffmpeg-4.1 is ok.";
else
echo -e "${RED}Error: No FFmpeg found at /usr/local/bin/ffmpeg${BLACK}"
echo -e "${RED} Please copy it from srs-docker${BLACK}"
echo -e "${RED} or download from http://ffmpeg.org/download.html${BLACK}"
echo -e "${RED} or disable it by --without-ffmpeg${BLACK}"
exit -1;
fi
fi
#####################################################################################
# SRT module, https://github.com/ossrs/srs/issues/1147#issuecomment-577469119
#####################################################################################
if [[ $SRS_SRT == YES && $SRS_USE_SYS_SRT == YES ]]; then
echo "Warning: Use system libsrt, without compiling srt."
fi
if [[ $SRS_SRT == YES && $SRS_USE_SYS_SRT == NO ]]; then
# Always disable c++11 for libsrt, because only the srt-app requres it.
LIBSRT_OPTIONS="--enable-apps=0 --enable-static=1 --enable-c++11=0"
if [[ $SRS_SHARED_SRT == YES ]]; then
LIBSRT_OPTIONS="$LIBSRT_OPTIONS --enable-shared=1"
else
LIBSRT_OPTIONS="$LIBSRT_OPTIONS --enable-shared=0"
fi
# For windows build, over cygwin
if [[ $SRS_CYGWIN64 == YES ]]; then
LIBSRT_OPTIONS="$LIBSRT_OPTIONS --cygwin-use-posix"
fi
# For cross-build.
if [[ $SRS_CROSS_BUILD == YES ]]; then
TOOL_GCC_REALPATH=$(realpath $(which $SRS_TOOL_CC))
SRT_COMPILER_PREFIX=$(echo $TOOL_GCC_REALPATH |sed 's/-gcc.*$/-/')
LIBSRT_OPTIONS="$LIBSRT_OPTIONS --with-compiler-prefix=$SRT_COMPILER_PREFIX"
fi
if [[ -f ${SRS_OBJS}/${SRS_PLATFORM}/3rdparty/srt/lib/libsrt.a ]]; then
rm -rf ${SRS_OBJS}/srt && cp -rf ${SRS_OBJS}/${SRS_PLATFORM}/3rdparty/srt ${SRS_OBJS}/ &&
echo "libsrt-1-fit is ok."
else
if [[ $SRS_USE_SYS_SSL != YES && ! -d ${SRS_OBJS}/openssl/lib/pkgconfig ]]; then
echo "OpenSSL pkgconfig no found, build srt-1-fit failed."
exit -1
fi
echo "Build srt-1-fit" &&
rm -rf ${SRS_OBJS}/${SRS_PLATFORM}/srt-1-fit ${SRS_OBJS}/${SRS_PLATFORM}/3rdparty/srt ${SRS_OBJS}/srt &&
cp -rf ${SRS_WORKDIR}/3rdparty/srt-1-fit ${SRS_OBJS}/${SRS_PLATFORM}/ &&
patch -p0 -R ${SRS_OBJS}/${SRS_PLATFORM}/srt-1-fit/srtcore/api.cpp ${SRS_WORKDIR}/3rdparty/patches/srt/api.cpp-01.patch &&
(
cd ${SRS_OBJS}/${SRS_PLATFORM}/srt-1-fit &&
env PKG_CONFIG_PATH=${SRS_DEPENDS_LIBS}/openssl/lib/pkgconfig \
./configure --prefix=${SRS_DEPENDS_LIBS}/${SRS_PLATFORM}/3rdparty/srt $LIBSRT_OPTIONS
) &&
make -C ${SRS_OBJS}/${SRS_PLATFORM}/srt-1-fit ${SRS_JOBS} &&
make -C ${SRS_OBJS}/${SRS_PLATFORM}/srt-1-fit install &&
# If exists lib64 of libsrt, copy it to lib
if [[ -d ${SRS_OBJS}/${SRS_PLATFORM}/3rdparty/srt/lib64 ]]; then
cp -rf ${SRS_OBJS}/${SRS_PLATFORM}/3rdparty/srt/lib64 ${SRS_OBJS}/${SRS_PLATFORM}/3rdparty/srt/lib
fi &&
cp -rf ${SRS_OBJS}/${SRS_PLATFORM}/3rdparty/srt ${SRS_OBJS}/ &&
echo "libsrt-1-fit is ok."
fi
ret=$?; if [[ $ret -ne 0 ]]; then echo "Build srt-1-fit failed, ret=$ret"; exit $ret; fi
fi
#####################################################################################
# build utest code
#####################################################################################
if [[ $SRS_UTEST == YES ]]; then
if [[ -f ${SRS_OBJS}/${SRS_PLATFORM}/3rdparty/gtest/googletest/include/gtest/gtest.h ]]; then
rm -rf ${SRS_OBJS}/gtest && cp -rf ${SRS_OBJS}/${SRS_PLATFORM}/3rdparty/gtest ${SRS_OBJS}/ &&
echo "The gtest-fit is ok."
else
echo "Build gtest-fit" &&
rm -rf ${SRS_OBJS}/${SRS_PLATFORM}gtest-fit ${SRS_OBJS}/${SRS_PLATFORM}/3rdparty/gtest ${SRS_OBJS}/gtest &&
cp -rf ${SRS_WORKDIR}/3rdparty/gtest-fit ${SRS_OBJS}/${SRS_PLATFORM}/3rdparty/gtest &&
cp -rf ${SRS_OBJS}/${SRS_PLATFORM}/3rdparty/gtest ${SRS_OBJS}/ &&
echo "The gtest-fit is ok."
fi
# check status
ret=$?; if [[ $ret -ne 0 ]]; then echo "Build gtest-1.6.0 failed, ret=$ret"; exit $ret; fi
fi
#####################################################################################
# build gperf code
#####################################################################################
if [[ $SRS_GPERF == YES ]]; then
if [[ -f ${SRS_OBJS}/${SRS_PLATFORM}/3rdparty/gperf/bin/pprof ]]; then
rm -rf ${SRS_OBJS}/gperf && cp -rf ${SRS_OBJS}/${SRS_PLATFORM}/3rdparty/gperf ${SRS_OBJS}/ &&
cp -f ${SRS_OBJS}/gperf/bin/pprof ${SRS_OBJS}/ &&
echo "The gperftools-2-fit is ok."
else
echo "Build gperftools-2-fit" &&
rm -rf ${SRS_OBJS}/${SRS_PLATFORM}/gperftools-2-fit ${SRS_OBJS}/${SRS_PLATFORM}/3rdparty/gperf \
${SRS_OBJS}/gperf ${SRS_OBJS}/pprof &&
cp -rf ${SRS_WORKDIR}/3rdparty/gperftools-2-fit ${SRS_OBJS}/${SRS_PLATFORM}/ &&
(
cd ${SRS_OBJS}/${SRS_PLATFORM}/gperftools-2-fit &&
./configure --prefix=${SRS_DEPENDS_LIBS}/${SRS_PLATFORM}/3rdparty/gperf --enable-frame-pointers
) &&
make -C ${SRS_OBJS}/${SRS_PLATFORM}/gperftools-2-fit ${SRS_JOBS} &&
make -C ${SRS_OBJS}/${SRS_PLATFORM}/gperftools-2-fit install &&
cp -rf ${SRS_OBJS}/${SRS_PLATFORM}/3rdparty/gperf ${SRS_OBJS}/ &&
cp -f ${SRS_OBJS}/gperf/bin/pprof ${SRS_OBJS}/ &&
echo "The gperftools-2-fit is ok."
fi
# check status
ret=$?; if [[ $ret -ne 0 ]]; then echo "Build gperftools-2-fit failed, ret=$ret"; exit $ret; fi
fi
+6
View File
@@ -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
+96
View File
@@ -0,0 +1,96 @@
#
# Generate the module(in src, not modules) info to Makefile
#
# params:
# $SRS_OBJS the objs directory to store the Makefile. ie. ./objs
# $SRS_OBJS the objs directory for Makefile. ie. objs
#
# $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)
# $DEFINES string, the build macro defines. ie. "-DMY_SRS"
#
# returns:
# $MODULE_OBJS array, the objects of the modules, used for link the binary
FILE=${SRS_OBJS}/Makefile
echo "#####################################################################################" >> ${FILE}
echo "# The module ${MODULE_ID}." >> ${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${SRS_WORKDIR}/${MODULE_DIR} " >> ${FILE}
#
# the private include files, for example:
# CORE_INCS = -Isrc/core -Iobjs
# CORE_LIBS_INCS = -Iobjs/st -Iobjs/ffmpeg/include
# 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${SRS_WORKDIR}/${MODULE_DIR} " >> ${FILE}
#
# depends module header files
for item in ${MODULE_DEPENDS[*]}; do
DEP_INCS_NAME="${item}_MODULE_INCS"
echo -n "\$(${DEP_INCS_NAME})" >> ${FILE}
done
echo "" >> ${FILE}
#
# depends library header files
INCS_LIBS_NAME="${MODULE_ID}_LIBS_INCS"
echo -n "${INCS_LIBS_NAME} = " >> ${FILE}
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="${SRS_WORKDIR}/${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="${SRS_WORKDIR}/${MODULE_DIR}/${item}.cpp"
OBJ_FILE="${SRS_OBJS}/${MODULE_DIR}/${item}.o"
MODULE_OBJS="${MODULE_OBJS[@]} ${MODULE_DIR}/${item}.cpp"
if [ -f ${CPP_FILE} ]; then
echo "${OBJ_FILE}: \$(${DEPS_NAME}) ${CPP_FILE} " >> ${FILE}
echo " \$(CXX) -c \$(CXXFLAGS) ${DEFINES}\\" >> ${FILE}
echo " \$(${INCS_NAME})\\" >> ${FILE}
echo " \$(${INCS_LIBS_NAME})\\" >> ${FILE}
echo " -o ${OBJ_FILE} \\" >> ${FILE}
echo " ${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 modules ${MODULE_ID} ok"; echo '!';
+766
View File
@@ -0,0 +1,766 @@
#!/bin/bash
################################################################
help=no
# feature options
SRS_HDS=NO
SRS_SRT=YES
SRS_RTC=YES
SRS_H265=YES
SRS_GB28181=NO
SRS_CXX11=YES
SRS_CXX14=NO
SRS_BACKTRACE=YES
SRS_NGINX=NO
SRS_UTEST=NO
# Always enable the bellow features.
SRS_STREAM_CASTER=YES
SRS_INGEST=YES
SRS_SSL=YES
SRS_SSL_1_0=NO
SRS_SSL_LOCAL=NO
SRS_HTTPS=YES
SRS_STAT=YES
SRS_TRANSCODE=YES
SRS_HTTP_CALLBACK=YES
SRS_HTTP_SERVER=YES
SRS_HTTP_API=YES
SRS_HTTP_CORE=YES
SRS_HLS=YES
SRS_DVR=YES
#
################################################################
# FFmpeg stub is the stub code in SRS for ingester or encoder.
SRS_FFMPEG_STUB=NO
# FFmpeg tool is the binary for FFmpeg tool, to exec ingest or transcode.
SRS_FFMPEG_TOOL=NO
# FFmpeg fit is the source code for RTC, to transcode audio or video in SRS.
SRS_FFMPEG_FIT=RESERVED
# Whether use FFmpeg native opus codec for RTC. If not, use libopus instead.
# Should disable it by default, because the cost of it is very high, see https://github.com/ossrs/srs/pull/3868
SRS_FFMPEG_OPUS=NO
# arguments
SRS_PREFIX=/usr/local/srs
SRS_DEFAULT_CONFIG=conf/srs.conf
SRS_JOBS=1
# If enabled, force to use SRS_JOBS for make on linux, however you're able to overwrite by -jN on macOS.
SRS_FORCE_MAKE_JOBS=YES
SRS_STATIC=NO
# If enabled, link shared libraries for libst.so which uses MPL license.
# See https://ossrs.net/lts/zh-cn/license#state-threads
SRS_SHARED_ST=NO
# If enabled, link shared libraries for libsrt.so which uses MPL license.
# See https://ossrs.net/lts/zh-cn/license#srt
SRS_SHARED_SRT=RESERVED
# If enabled, link shared libraries for FFmpeg which is LGPL license.
# See https://ossrs.net/lts/zh-cn/license#ffmpeg
SRS_SHARED_FFMPEG=RESERVED
# If enabled, link shared libraries for SRTP which is BSD license.
# See https://ossrs.net/lts/zh-cn/license#srtp
SRS_SHARED_SRTP=RESERVED
# whether enable the gcov
SRS_GCOV=NO
# Whether enable cloud logging and APM(Application Performance Monitor).
SRS_APM=NO
# whether enable the log verbose/info/trace level.
# always enable the warn/error level.
SRS_LOG_VERBOSE=NO
SRS_LOG_INFO=NO
SRS_LOG_TRACE=YES
# Whether use new level definition, see https://stackoverflow.com/a/2031209/17679565
SRS_LOG_LEVEL_V2=YES
#
################################################################
# Experts options.
SRS_USE_SYS_SSL=NO # Use system ssl(-lssl) if required.
SRS_USE_SYS_FFMPEG=NO # Use system ffmpeg if required.
SRS_USE_SYS_SRT=NO # Use system srt(-lsrt) if required.
SRS_USE_SYS_SRTP=NO # Use system srtp(-lsrtp) if required.
SRS_VALGRIND=NO
SRS_SANITIZER=RESERVED
SRS_SANITIZER_STATIC=NO
SRS_SANITIZER_LOG=NO
SRS_BUILD_TAG= # Set the object files tag name.
SRS_CLEAN=YES # Whether do "make clean" when configure.
SRS_SIMULATOR=NO # Whether enable RTC simulate API.
SRS_GENERATE_OBJS=NO # Whether generate objs and quit.
SRS_SINGLE_THREAD=YES # Whether force single thread mode.
SRS_SIGNAL_API=NO # Use http API to simulate sending signal to SRS, for debugging.
#
################################################################
# Performance options.
SRS_GPERF=NO # Performance test: tcmalloc
SRS_GPERF_MC=NO # Performance test: gperf memory check
SRS_GPERF_MD=NO # Performance test: gperf memory defence
SRS_GPERF_MP=NO # Performance test: gperf memory profile
SRS_GPERF_CP=NO # Performance test: gperf cpu profile
SRS_GPROF=NO # Performance test: gprof
#
################################################################
# Preset options
SRS_GENERIC_LINUX= # Try to run as generic linux, not CentOS or Ubuntu.
SRS_OSX= #For OSX/macOS/Darwin PC.
SRS_CYGWIN64= # For Cygwin64 for Windows PC or servers.
SRS_CROSS_BUILD= #For cross build, for example, on Ubuntu.
# For cross build, the cpu, for example(FFmpeg), --cpu=24kc
SRS_CROSS_BUILD_CPU=
# For cross build, the arch, for example(FFmpeg), --arch=aarch64
SRS_CROSS_BUILD_ARCH=
# For cross build, the host, for example(libsrtp), --host=aarch64-linux-gnu
SRS_CROSS_BUILD_HOST=
# For cross build, the cross prefix, for example(FFmpeg), --cross-prefix=aarch64-linux-gnu-
SRS_CROSS_BUILD_PREFIX=
# For cache build
SRS_BUILD_CACHE=YES
#
#####################################################################################
# Toolchain for cross-build on Ubuntu for ARM or MIPS.
SRS_TOOL_CC=gcc
SRS_TOOL_CXX=g++
SRS_TOOL_AR=ar
SRS_TOOL_LD=ld
SRS_TOOL_RANDLIB=randlib
SRS_EXTRA_FLAGS=
SRS_EXTRA_LDFLAGS=
#
#####################################################################################
# Performance optimize.
SRS_NASM=YES
SRS_SRTP_ASM=YES
SRS_DEBUG=NO
SRS_DEBUG_STATS=NO
#####################################################################################
function apply_system_options() {
OS_IS_OSX=$(uname -s |grep -q Darwin && echo YES)
OS_IS_LINUX=$(uname -s |grep -q Linux && echo YES)
OS_IS_CYGWIN=$(uname -s |grep -q CYGWIN && echo YES)
OS_IS_CENTOS=$(yum --version >/dev/null 2>&1 && echo YES)
# For Debian, we think it's ubuntu also.
# For example, the wheezy/sid which is debian armv7 linux, can not identified by uname -v.
OS_IS_UBUNTU=$(apt-get --version >/dev/null 2>&1 && echo YES)
OS_IS_LOONGSON=$(uname -r |grep -q loongson && echo YES)
# Use gcc to detect the CPU arch.
gcc --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then echo "Please install gcc"; exit 1; fi
OS_IS_LOONGARCH64=$(gcc -dM -E - </dev/null |grep '#define __loongarch64 1' -q && echo YES)
OS_IS_MIPS64=$(gcc -dM -E - </dev/null |grep '#define __mips64 1' -q && echo YES)
OS_IS_X86_64=$(gcc -dM -E - </dev/null |grep -q '#define __x86_64 1' && echo YES)
OS_IS_RISCV=$(gcc -dM -E - </dev/null |grep -q '#define __riscv 1' && echo YES)
# Set the os option automatically.
if [[ $OS_IS_OSX == YES ]]; then SRS_OSX=YES; fi
if [[ $OS_IS_CYGWIN == YES ]]; then SRS_CYGWIN64=YES; fi
if [[ $OS_IS_OSX == YES ]]; then SRS_JOBS=$(sysctl -n hw.ncpu 2>/dev/null || echo 1); fi
if [[ $OS_IS_LINUX == YES || $OS_IS_CYGWIN == YES ]]; then
SRS_JOBS=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || echo 1)
fi
if [[ $OS_IS_UBUNTU != YES && $OS_IS_CENTOS != YES && $OS_IS_OSX != YES && $SRS_CYGWIN64 != YES ]]; then
echo "Warning: Your OS is not Ubuntu(no apt-get), CentOS(no yum), maxOS(not Darwin), Windows(not CYGWIN)"
fi
}
apply_system_options
#####################################################################################
# Show help menu.
#####################################################################################
function show_help() {
cat << END
Configure to generate Makefile.
-h, --help Print this message and exit 0.
Features:
--https=on|off Whether enable HTTPS client and server. Default: $(value2switch $SRS_HTTPS)
--utest=on|off Whether build the utest. Default: $(value2switch $SRS_UTEST)
--srt=on|off Whether build the SRT. Default: $(value2switch $SRS_SRT)
--rtc=on|off Whether build the WebRTC. Default: $(value2switch $SRS_RTC)
--gb28181=on|off Whether build the GB28181. Default: $(value2switch $SRS_GB28181)
--cxx11=on|off Whether enable the C++11. Default: $(value2switch $SRS_CXX11)
--cxx14=on|off Whether enable the C++14. Default: $(value2switch $SRS_CXX14)
--ffmpeg-fit=on|off Whether enable the FFmpeg fit(source code). Default: $(value2switch $SRS_FFMPEG_FIT)
--ffmpeg-opus=on|off Whether enable the FFmpeg native opus codec. Default: $(value2switch $SRS_FFMPEG_OPUS)
--apm=on|off Whether enable cloud logging and APM(Application Performance Monitor). Default: $(value2switch $SRS_APM)
--h265=on|off Whether build the HEVC(H.265) support. Default: $(value2switch $SRS_H265)
--prefix=<path> The absolute installation path. Default: $SRS_PREFIX
--jobs[=N] Allow N jobs at once; infinite jobs with no arg. Default: $SRS_JOBS
--config=<path> The default config file for SRS. Default: $SRS_DEFAULT_CONFIG
Performance: @see https://ossrs.net/lts/zh-cn/docs/v5/doc/performance
--valgrind=on|off Whether build valgrind for memory check. Default: $(value2switch $SRS_VALGRIND)
--gperf=on|off Whether build SRS with gperf tools(no gmd/gmc/gmp/gcp, with tcmalloc only). Default: $(value2switch $SRS_GPERF)
--gmc=on|off Whether build memory check with gperf tools. Default: $(value2switch $SRS_GPERF_MC)
--gmd=on|off Whether build memory defense(corrupt memory) with gperf tools. Default: $(value2switch $SRS_GPERF_MD)
--gmp=on|off Whether build memory profile with gperf tools. Default: $(value2switch $SRS_GPERF_MP)
--gcp=on|off Whether build cpu profile with gperf tools. Default: $(value2switch $SRS_GPERF_CP)
--gprof=on|off Whether build SRS with gprof(GNU profile tool). Default: $(value2switch $SRS_GPROF)
--sanitizer=on|off Whether build SRS with address sanitizer(asan). Default: $(value2switch $SRS_SANITIZER)
--sanitizer-static=on|off Whether build SRS with static libasan(asan). Default: $(value2switch $SRS_SANITIZER_STATIC)
--sanitizer-log=on|off Whether hijack the log for libasan(asan). Default: $(value2switch $SRS_SANITIZER_LOG)
--nasm=on|off Whether build FFMPEG for RTC with nasm. Default: $(value2switch $SRS_NASM)
--srtp-nasm=on|off Whether build SRTP with ASM(openssl-asm), requires RTC and openssl-1.0.*. Default: $(value2switch $SRS_SRTP_ASM)
Toolchain options:
--static=on|off Whether add '-static' to link options. Default: $(value2switch $SRS_STATIC)
--cc=<CC> Toolchain: Use c compiler CC. Default: $SRS_TOOL_CC
--cxx=<CXX> Toolchain: Use c++ compiler CXX. Default: $SRS_TOOL_CXX
--ar=<AR> Toolchain: Use archive tool AR. Default: $SRS_TOOL_CXX
--ld=<LD> Toolchain: Use linker tool LD. Default: $SRS_TOOL_CXX
--randlib=<RANDLIB> Toolchain: Use randlib tool RANDLIB. Default: $SRS_TOOL_CXX
--extra-flags=<EFLAGS> Set EFLAGS as CFLAGS and CXXFLAGS. Also passed to ST as EXTRA_CFLAGS.
--extra-ldflags=<ELDFLAGS> Set ELDFLAGS as LDFLAGS.
Cross Build options: @see https://ossrs.net/lts/zh-cn/docs/v4/doc/arm#ubuntu-cross-build-srs
--cross=on|off Enable cross-build, please set bellow Toolchain also. Default: $(value2switch $SRS_CROSS_BUILD)
--cpu=<CPU> Toolchain: Select the minimum required CPU for cross-build. For example: --cpu=24kc
--arch=<ARCH> Toolchain: Select architecture for cross-build. For example: --arch=aarch64
--host=<BUILD> Toolchain: Cross-compile to build programs to run on HOST. For example: --host=aarch64-linux-gnu
--cross-prefix=<PREFIX> Toolchain: Use PREFIX for compilation tools. For example: --cross-prefix=aarch64-linux-gnu-
Experts:
--sys-ssl=on|off Do not compile ssl, use system ssl(-lssl) if required. Default: $(value2switch $SRS_USE_SYS_SSL)
--ssl-1-0=on|off Whether use openssl-1.0.*. Default: $(value2switch $SRS_SSL_1_0)
--ssl-local=on|off Whether use local openssl, not system even exists. Default: $(value2switch $SRS_SSL_LOCAL)
--shared-st=on|off Use shared libraries for ST which is MPL license. Default: $(value2switch $SRS_SHARED_ST)
--shared-srt=on|off Use shared libraries for SRT which is MPL license. Default: $(value2switch $SRS_SHARED_SRT)
--sys-srt=on|off Do not compile srt, use system srt(-lsrt) if required. Default: $(value2switch $SRS_USE_SYS_SRT)
--shared-ffmpeg=on|off Use shared libraries for FFmpeg which is LGPL license. Default: $(value2switch $SRS_SHARED_FFMPEG)
--sys-ffmpeg=on|off Do not compile ffmpeg, use system ffmpeg if required. Default: $(value2switch $SRS_USE_SYS_FFMPEG)
--sys-srtp=on|off Do not compile srtp, use system srtp(-lsrtp) if required. Default: $(value2switch $SRS_USE_SYS_SRTP)
--shared-srtp=on|off Use shared libraries for SRTP which is BSD license. Default: $(value2switch $SRS_SHARED_SRTP)
--clean=on|off Whether do 'make clean' when configure. Default: $(value2switch $SRS_CLEAN)
--simulator=on|off RTC: Whether enable network simulator. Default: $(value2switch $SRS_SIMULATOR)
--generate-objs=on|off RTC: Whether generate objs and quit. Default: $(value2switch $SRS_GENERATE_OBJS)
--single-thread=on|off Whether force single thread mode. Default: $(value2switch $SRS_SINGLE_THREAD)
--signal-api=on|off Whether support sending signal by HTTP API. Default: $(value2switch $SRS_SIGNAL_API)
--build-tag=<TAG> Set the build object directory suffix.
--debug=on|off Whether enable the debug code, may hurt performance. Default: $(value2switch $SRS_DEBUG)
--debug-stats=on|off Whether enable the debug stats, may hurt performance. Default: $(value2switch $SRS_DEBUG_STATS)
--gcov=on|off Whether enable the GCOV for coverage. Default: $(value2switch $SRS_GCOV)
--log-verbose=on|off Whether enable the log verbose level. Default: $(value2switch $SRS_LOG_VERBOSE)
--log-info=on|off Whether enable the log info level. Default: $(value2switch $SRS_LOG_INFO)
--log-trace=on|off Whether enable the log trace level. Default: $(value2switch $SRS_LOG_TRACE)
--log-level_v2=on|off Whether use v2.0 log level definition, see log4j specs. Default: $(value2switch $SRS_LOG_LEVEL_V2)
--backtrace=on|off Whether show backtrace when crashing. Default: $(value2switch $SRS_BACKTRACE)
--generic-linux=on|off Whether run as generic linux, if not CentOS or Ubuntu. Default: $(value2switch $SRS_GENERIC_LINUX)
Deprecated:
--cross-build Enable cross-build, please set bellow Toolchain also. Default: $(value2switch $SRS_CROSS_BUILD)
--hds=on|off Whether build the hds streaming, mux RTMP to F4M/F4V files. Default: $(value2switch $SRS_HDS)
--osx Enable build for OSX/Darwin AppleOS. Deprecated for automatically detecting the OS.
--x86-64 Enable build for __x86_64 systems. Deprecated for automatically detecting the OS.
--x86-x64 Enable build for __x86_64 systems. Deprecated for automatically detecting the OS.
--cygwin64 Use cygwin64 to build for Windows. Deprecated for automatically detecting the OS.
--nginx Build nginx tool. Deprecated for not depends on it.
--ffmpeg Build FFmpeg tool. Deprecated for not build it, user should do it.
For example:
./configure
END
}
#####################################################################################
# Parse user options
#####################################################################################
function parse_user_option() {
# Ignore the options.
if [[ $option == '--demo' || $option == '--dev' || $option == '--fast-dev' || $option == '--pi'
|| $option == '--cubie' || $option == '--fast' || $option == '--pure-rtmp' || $option == '--disable-all'
|| $option == '--full' || $option == '--with-http-callback' || $option == '--without-http-callback'
|| $option == '--http-callback' || $option == '--with-http-api' || $option == '--without-http-api'
|| $option == '--http-api' || $option == '--with-http-server' || $option == '--without-http-server'
|| $option == '--http-server' || $option == '--with-hls' || $option == '--without-hls'
|| $option == '--hls' || $option == '--with-dvr' || $option == '--without-dvr'
|| $option == '--dvr' || $option == '--without-transcode' || $option == '--without-ingest'
|| $option == '--without-stat' || $option == '--without-stream-caster' || $option == '--without-ssl'
|| $option == '--without-librtmp' || ($option == '--librtmp' && $(switch2value $value) == NO)
|| $option == '--without-research' || ($option == '--research' && $(switch2value $value) == NO)
]]; then
echo "Ignore option $option $value"; return 0;
fi
# if specified export single file, export project first.
if [[ $option == '--export-librtmp-single' || $option == '--export-librtmp-project' || $option == '--with-librtmp' || $option == '--librtmp' ]]; then
echo "Error: The $option is not supported yet, please read https://github.com/ossrs/srs-librtmp/issues/32"; exit 1
fi
if [[ $option == '--with-research' || $option == '--research' ]]; then
echo "Error: The $option is not supported yet"; exit 1
fi
if [[ $option == '--arm' || $option == '--mips' || $option == '--with-arm-ubuntu12' || $option == '--with-mips-ubuntu12' ]]; then
echo "Error: Removed misleading option $option, please read https://ossrs.net/lts/zh-cn/docs/v4/doc/arm#ubuntu-cross-build-srs"
exit -1
fi
# Parse options to variables.
case "$option" in
-h) help=YES ;;
--help) help=YES ;;
--jobs) SRS_JOBS=${value} ;;
--force-make-jobs) SRS_FORCE_MAKE_JOBS=${value} ;;
--prefix) SRS_PREFIX=${value} ;;
--config) SRS_DEFAULT_CONFIG=${value} ;;
--static) SRS_STATIC=$(switch2value $value) ;;
--cpu) SRS_CROSS_BUILD_CPU=${value} ;;
--arch) SRS_CROSS_BUILD_ARCH=${value} ;;
--host) SRS_CROSS_BUILD_HOST=${value} ;;
--cross-prefix) SRS_CROSS_BUILD_PREFIX=${value} ;;
--cc) SRS_TOOL_CC=${value} ;;
--cxx) SRS_TOOL_CXX=${value} ;;
--ar) SRS_TOOL_AR=${value} ;;
--ld) SRS_TOOL_LD=${value} ;;
--randlib) SRS_TOOL_RANDLIB=${value} ;;
--extra-flags) SRS_EXTRA_FLAGS=${value} ;;
--extra-ldflags) SRS_EXTRA_LDFLAGS=${value} ;;
--build-tag) SRS_BUILD_TAG=${value} ;;
--srtp-nasm) SRS_SRTP_ASM=$(switch2value $value) ;;
--nasm) SRS_NASM=$(switch2value $value) ;;
--ssl) SRS_SSL=$(switch2value $value) ;;
--https) SRS_HTTPS=$(switch2value $value) ;;
--ssl-1-0) SRS_SSL_1_0=$(switch2value $value) ;;
--ssl-local) SRS_SSL_LOCAL=$(switch2value $value) ;;
--hds) SRS_HDS=$(switch2value $value) ;;
--transcode) SRS_TRANSCODE=$(switch2value $value) ;;
--ingest) SRS_INGEST=$(switch2value $value) ;;
--stat) SRS_STAT=$(switch2value $value) ;;
--stream-caster) SRS_STREAM_CASTER=$(switch2value $value) ;;
--stream-converter) SRS_STREAM_CASTER=$(switch2value $value) ;;
--utest) SRS_UTEST=$(switch2value $value) ;;
--gcov) SRS_GCOV=$(switch2value $value) ;;
--apm) SRS_APM=$(switch2value $value) ;;
--srt) SRS_SRT=$(switch2value $value) ;;
--rtc) SRS_RTC=$(switch2value $value) ;;
--simulator) SRS_SIMULATOR=$(switch2value $value) ;;
--generate-objs) SRS_GENERATE_OBJS=$(switch2value $value) ;;
--single-thread) SRS_SINGLE_THREAD=$(switch2value $value) ;;
--signal-api) SRS_SIGNAL_API=$(switch2value $value) ;;
--ffmpeg-fit) SRS_FFMPEG_FIT=$(switch2value $value) ;;
--ffmpeg-opus) SRS_FFMPEG_OPUS=$(switch2value $value) ;;
--h265) SRS_H265=$(switch2value $value) ;;
--gb28181) SRS_GB28181=$(switch2value $value) ;;
--cxx11) SRS_CXX11=$(switch2value $value) ;;
--cxx14) SRS_CXX14=$(switch2value $value) ;;
--backtrace) SRS_BACKTRACE=$(switch2value $value) ;;
--clean) SRS_CLEAN=$(switch2value $value) ;;
--gperf) SRS_GPERF=$(switch2value $value) ;;
--gmc) SRS_GPERF_MC=$(switch2value $value) ;;
--gmd) SRS_GPERF_MD=$(switch2value $value) ;;
--gmp) SRS_GPERF_MP=$(switch2value $value) ;;
--gcp) SRS_GPERF_CP=$(switch2value $value) ;;
--gprof) SRS_GPROF=$(switch2value $value) ;;
--sanitizer) SRS_SANITIZER=$(switch2value $value) ;;
--sanitizer-static) SRS_SANITIZER_STATIC=$(switch2value $value) ;;
--sanitizer-log) SRS_SANITIZER_LOG=$(switch2value $value) ;;
--use-sys-ssl) SRS_USE_SYS_SSL=YES ;;
--sys-ssl) SRS_USE_SYS_SSL=$(switch2value $value) ;;
--use-shared-st) SRS_SHARED_ST=YES ;;
--use-shared-srt) SRS_SHARED_SRT=YES ;;
--shared-st) SRS_SHARED_ST=$(switch2value $value) ;;
--shared-srt) SRS_SHARED_SRT=$(switch2value $value) ;;
--use-sys-srt) SRS_USE_SYS_SRT=YES ;;
--sys-srt) SRS_USE_SYS_SRT=$(switch2value $value) ;;
--shared-ffmpeg) SRS_SHARED_FFMPEG=$(switch2value $value) ;;
--use-sys-ffmpeg) SRS_USE_SYS_FFMPEG=YES ;;
--sys-ffmpeg) SRS_USE_SYS_FFMPEG=$(switch2value $value) ;;
--shared-srtp) SRS_SHARED_SRTP=$(switch2value $value) ;;
--use-sys-srtp) SRS_USE_SYS_SRTP=YES ;;
--sys-srtp) SRS_USE_SYS_SRTP=$(switch2value $value) ;;
--valgrind) SRS_VALGRIND=$(switch2value $value) ;;
--log-verbose) SRS_LOG_VERBOSE=$(switch2value $value) ;;
--log-info) SRS_LOG_INFO=$(switch2value $value) ;;
--log-trace) SRS_LOG_TRACE=$(switch2value $value) ;;
--log-level_v2) SRS_LOG_LEVEL_V2=$(switch2value $value) ;;
--debug) SRS_DEBUG=$(switch2value $value) ;;
--debug-stats) SRS_DEBUG_STATS=$(switch2value $value) ;;
--cross-build) SRS_CROSS_BUILD=YES ;;
--generic-linux) SRS_GENERIC_LINUX=$(switch2value $value) ;;
--build-cache) SRS_BUILD_CACHE=$(switch2value $value) ;;
##########################################################################################
--without-srtp-nasm) SRS_SRTP_ASM=NO ;; # Deprecated, might be removed in future.
--with-srtp-nasm) SRS_SRTP_ASM=YES ;; # Deprecated, might be removed in future.
--without-nasm) SRS_NASM=NO ;; # Deprecated, might be removed in future.
--with-nasm) SRS_NASM=YES ;; # Deprecated, might be removed in future.
--with-ssl) SRS_SSL=YES ;; # Deprecated, might be removed in future.
--with-hds) SRS_HDS=YES ;; # Deprecated, might be removed in future.
--without-hds) SRS_HDS=NO ;; # Deprecated, might be removed in future.
--with-transcode) SRS_TRANSCODE=YES ;; # Deprecated, might be removed in future.
--with-ingest) SRS_INGEST=YES ;; # Deprecated, might be removed in future.
--with-stat) SRS_STAT=YES ;; # Deprecated, might be removed in future.
--with-stream-caster) SRS_STREAM_CASTER=YES ;; # Deprecated, might be removed in future.
--with-utest) SRS_UTEST=YES ;; # Deprecated, might be removed in future.
--without-utest) SRS_UTEST=NO ;; # Deprecated, might be removed in future.
--with-srt) SRS_SRT=YES ;; # Deprecated, might be removed in future.
--without-srt) SRS_SRT=NO ;; # Deprecated, might be removed in future.
--with-rtc) SRS_RTC=YES ;; # Deprecated, might be removed in future.
--without-rtc) SRS_RTC=NO ;; # Deprecated, might be removed in future.
--with-clean) SRS_CLEAN=YES ;; # Deprecated, might be removed in future.
--without-clean) SRS_CLEAN=NO ;; # Deprecated, might be removed in future.
--with-gperf) SRS_GPERF=YES ;; # Deprecated, might be removed in future.
--without-gperf) SRS_GPERF=NO ;; # Deprecated, might be removed in future.
--with-gmc) SRS_GPERF_MC=YES ;; # Deprecated, might be removed in future.
--without-gmc) SRS_GPERF_MC=NO ;; # Deprecated, might be removed in future.
--with-gmd) SRS_GPERF_MD=YES ;; # Deprecated, might be removed in future.
--without-gmd) SRS_GPERF_MD=NO ;; # Deprecated, might be removed in future.
--with-gmp) SRS_GPERF_MP=YES ;; # Deprecated, might be removed in future.
--without-gmp) SRS_GPERF_MP=NO ;; # Deprecated, might be removed in future.
--with-gcp) SRS_GPERF_CP=YES ;; # Deprecated, might be removed in future.
--without-gcp) SRS_GPERF_CP=NO ;; # Deprecated, might be removed in future.
--with-gprof) SRS_GPROF=YES ;; # Deprecated, might be removed in future.
--without-gprof) SRS_GPROF=NO ;; # Deprecated, might be removed in future.
--with-valgrind) SRS_VALGRIND=YES ;; # Deprecated, might be removed in future.
--without-valgrind) SRS_VALGRIND=NO ;; # Deprecated, might be removed in future.
--cross) SRS_CROSS_BUILD=$(switch2value $value) ;; # Deprecated, might be removed in future.
--enable-cross-compile) SRS_CROSS_BUILD=YES ;; # Deprecated, might be removed in future.
##########################################################################################
--osx) SRS_OSX=YES ;; # Deprecated, might be removed in future.
--cygwin64) SRS_CYGWIN64=YES ;; # Deprecated, might be removed in future.
--x86-x64) SRS_X86_X64=YES ;; # Deprecated, might be removed in future.
--x86-64) SRS_X86_X64=YES ;; # Deprecated, might be removed in future.
--with-nginx) SRS_NGINX=YES ;; # Deprecated, might be removed in future.
--without-nginx) SRS_NGINX=NO ;; # Deprecated, might be removed in future.
--nginx) SRS_NGINX=$(switch2value $value) ;; # Deprecated, might be removed in future.
--with-ffmpeg) SRS_FFMPEG_TOOL=YES ;; # Deprecated, might be removed in future.
--without-ffmpeg) SRS_FFMPEG_TOOL=NO ;; # Deprecated, might be removed in future.
--ffmpeg) SRS_FFMPEG_TOOL=$(switch2value $value) ;; # Deprecated, might be removed in future.
--ffmpeg-tool) SRS_FFMPEG_TOOL=$(switch2value $value) ;; # Deprecated, might be removed in future.
*)
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
}
# For variable values, might be three values: YES, RESERVED, NO(by default).
function value2switch() {
if [[ $1 == YES ]]; then
echo on;
elif [[ $1 == RESERVED ]]; then
echo reserved;
else
echo off;
fi
}
# For user options, only off or on(by default).
function switch2value() {
if [[ $1 == off ]]; then
echo NO;
else
echo YES;
fi
}
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
#####################################################################################
# Apply auto options
#####################################################################################
function apply_auto_options() {
if [[ $OS_IS_CYGWIN == YES ]]; then
SRS_CYGWIN64=YES
fi
if [[ $SRS_CROSS_BUILD == YES ]]; then
if [[ $SRS_CROSS_BUILD_PREFIX != "" && $SRS_CROSS_BUILD_HOST == "" ]]; then
SRS_CROSS_BUILD_HOST=$(echo $SRS_CROSS_BUILD_PREFIX| sed 's/-$//g')
fi
if [[ $SRS_TOOL_CC != "" && $SRS_CROSS_BUILD_HOST == "" ]]; then
SRS_CROSS_BUILD_HOST=$(echo $SRS_TOOL_CC| sed 's/-gcc$//g')
fi
if [[ $SRS_CROSS_BUILD_PREFIX == "" ]]; then
SRS_CROSS_BUILD_PREFIX="${SRS_CROSS_BUILD_HOST}-"
fi
SRS_TOOL_CC=${SRS_CROSS_BUILD_PREFIX}gcc
SRS_TOOL_CXX=${SRS_CROSS_BUILD_PREFIX}g++
SRS_TOOL_AR=${SRS_CROSS_BUILD_PREFIX}ar
SRS_TOOL_LD=${SRS_CROSS_BUILD_PREFIX}ld
SRS_TOOL_RANDLIB=${SRS_CROSS_BUILD_PREFIX}randlib
if [[ $SRS_CROSS_BUILD_ARCH == "" ]]; then
echo $SRS_TOOL_CC| grep arm >/dev/null 2>&1 && SRS_CROSS_BUILD_ARCH="arm"
echo $SRS_TOOL_CC| grep aarch64 >/dev/null 2>&1 && SRS_CROSS_BUILD_ARCH="aarch64"
echo $SRS_TOOL_CC| grep mipsel >/dev/null 2>&1 && SRS_CROSS_BUILD_ARCH="mipsel"
fi
echo "For cross build, host: $SRS_CROSS_BUILD_HOST, prefix: $SRS_CROSS_BUILD_PREFIX, arch: $SRS_CROSS_BUILD_ARCH, cpu: $SRS_CROSS_BUILD_CPU gcc: $SRS_TOOL_CC"
fi
if [[ $SRS_OSX == YES ]]; then
SRS_TOOL_LD=$SRS_TOOL_CC
fi
# Enable FFmpeg fit for RTC to transcode audio from AAC to OPUS, if user enabled it.
if [[ $SRS_RTC == YES && $SRS_FFMPEG_FIT == RESERVED ]]; then
SRS_FFMPEG_FIT=YES
fi
if [[ $SRS_USE_SYS_FFMPEG == YES && $SRS_SHARED_FFMPEG == RESERVED ]]; then
SRS_SHARED_FFMPEG=YES
fi
if [[ $SRS_CROSS_BUILD == YES && $SRS_FFMPEG_OPUS != YES ]]; then
echo "Enable FFmpeg native opus for cross building"
SRS_FFMPEG_OPUS=YES
fi
if [[ $SRS_USE_SYS_SRT == YES && $SRS_SHARED_SRT == RESERVED ]]; then
SRS_SHARED_SRT=YES
fi
if [[ $SRS_USE_SYS_SRTP == YES && $SRS_SHARED_SRTP == RESERVED ]]; then
SRS_SHARED_SRTP=YES
fi
# Enable asan, but disable for Centos
# @see https://github.com/ossrs/srs/issues/3347
if [[ $SRS_SANITIZER == RESERVED && $OS_IS_CENTOS != YES ]]; then
echo "Enable asan by auto options."
SRS_SANITIZER=YES
fi
# If enable gperf, disable sanitizer.
if [[ $SRS_GPERF == YES && $SRS_SANITIZER == YES ]]; then
echo "Disable sanitizer for gperf"
SRS_SANITIZER=NO
fi
# 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 [[ $SRS_SRTP_ASM == YES && $SRS_RTC == NO ]]; then
echo "Disable SRTP-ASM, because RTC is disabled."
SRS_SRTP_ASM=NO
fi
if [[ $SRS_SRTP_ASM == YES && $SRS_NASM == NO ]]; then
echo "Disable SRTP-ASM, because NASM is disabled."
SRS_SRTP_ASM=NO
fi
# TODO: FIXME: Should build address sanitizer for cygwin64.
# See https://github.com/ossrs/srs/issues/3252
if [[ $SRS_CYGWIN64 == YES && $SRS_SANITIZER == YES ]]; then
echo "Disable address sanitizer for cygwin64"
SRS_SANITIZER=NO
fi
# TODO: FIXME: Should fix bug for SRT for cygwin64. Build ok, but fail in SrsSrtSocket::accept.
# See https://github.com/ossrs/srs/issues/3251
if [[ $SRS_CYGWIN64 == YES && $SRS_SRT == YES ]]; then
echo "Disable SRT for cygwin64"
SRS_SRT=NO
fi
# TODO: FIXME: Cygwin: ST stuck when working in multiple threads mode.
# See https://github.com/ossrs/srs/issues/3253
if [[ $SRS_CYGWIN64 == YES && $SRS_SINGLE_THREAD != YES ]]; then
echo "Force single thread for cygwin64"
SRS_SINGLE_THREAD=YES
fi
# parse the jobs for make
if [[ ! -z SRS_JOBS ]]; then
export SRS_JOBS="--jobs=${SRS_JOBS}"
fi
}
apply_auto_options
#####################################################################################
# Apply detail options
#####################################################################################
function apply_detail_options() {
# Always enable HTTP utilies.
if [[ $SRS_HTTP_CORE == NO ]]; then SRS_HTTP_CORE=YES; echo -e "${YELLOW}[WARN] Always enable HTTP utilies.${BLACK}"; fi
if [[ $SRS_STREAM_CASTER == NO ]]; then SRS_STREAM_CASTER=YES; echo -e "${YELLOW}[WARN] Always enable StreamConverter.${BLACK}"; fi
if [[ $SRS_INGEST == NO ]]; then SRS_INGEST=YES; echo -e "${YELLOW}[WARN] Always enable Ingest.${BLACK}"; fi
if [[ $SRS_SSL == NO ]]; then SRS_SSL=YES; echo -e "${YELLOW}[WARN] Always enable SSL.${BLACK}"; fi
if [[ $SRS_STAT == NO ]]; then SRS_STAT=YES; echo -e "${YELLOW}[WARN] Always enable Statistic.${BLACK}"; fi
if [[ $SRS_TRANSCODE == NO ]]; then SRS_TRANSCODE=YES; echo -e "${YELLOW}[WARN] Always enable Transcode.${BLACK}"; fi
if [[ $SRS_HTTP_CALLBACK == NO ]]; then SRS_HTTP_CALLBACK=YES; echo -e "${YELLOW}[WARN] Always enable HTTP callback.${BLACK}"; fi
if [[ $SRS_HTTP_SERVER == NO ]]; then SRS_HTTP_SERVER=YES; echo -e "${YELLOW}[WARN] Always enable HTTP server.${BLACK}"; fi
if [[ $SRS_HTTP_API == NO ]]; then SRS_HTTP_API=YES; echo -e "${YELLOW}[WARN] Always enable HTTP API.${BLACK}"; fi
if [[ $SRS_HLS == NO ]]; then SRS_HLS=YES; echo -e "${YELLOW}[WARN] Always enable HLS.${BLACK}"; fi
if [[ $SRS_DVR == NO ]]; then SRS_DVR=YES; echo -e "${YELLOW}[WARN] Always enable DVR.${BLACK}"; fi
if [[ $SRS_SANITIZER == RESERVED ]]; then SRS_SANITIZER=NO; fi
}
apply_detail_options
#####################################################################################
# Regenerate options for tracing.
#####################################################################################
function regenerate_options() {
# save all config options to macro to write to auto headers file
SRS_AUTO_USER_CONFIGURE=`echo $opt`
# regenerate the options for default values.
SRS_AUTO_CONFIGURE="--prefix=${SRS_PREFIX}"
SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --config=$SRS_DEFAULT_CONFIG"
SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --osx=$(value2switch $SRS_OSX)"
SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --hls=$(value2switch $SRS_HLS)"
SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --hds=$(value2switch $SRS_HDS)"
SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --dvr=$(value2switch $SRS_DVR)"
SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --ssl=$(value2switch $SRS_SSL)"
SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --https=$(value2switch $SRS_HTTPS)"
SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --ssl-1-0=$(value2switch $SRS_SSL_1_0)"
SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --ssl-local=$(value2switch $SRS_SSL_LOCAL)"
SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --sys-ssl=$(value2switch $SRS_USE_SYS_SSL)"
SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --transcode=$(value2switch $SRS_TRANSCODE)"
SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --ingest=$(value2switch $SRS_INGEST)"
SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --stat=$(value2switch $SRS_STAT)"
SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --http-callback=$(value2switch $SRS_HTTP_CALLBACK)"
SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --http-server=$(value2switch $SRS_HTTP_SERVER)"
SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --stream-converter=$(value2switch $SRS_STREAM_CASTER)"
SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --http-api=$(value2switch $SRS_HTTP_API)"
SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --utest=$(value2switch $SRS_UTEST)"
SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --srt=$(value2switch $SRS_SRT)"
SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --sys-srt=$(value2switch $SRS_USE_SYS_SRT)"
SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --rtc=$(value2switch $SRS_RTC)"
SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --h265=$(value2switch $SRS_H265)"
SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --gb28181=$(value2switch $SRS_GB28181)"
SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --simulator=$(value2switch $SRS_SIMULATOR)"
SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --cxx11=$(value2switch $SRS_CXX11)"
SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --cxx14=$(value2switch $SRS_CXX14)"
SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --backtrace=$(value2switch $SRS_BACKTRACE)"
SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --ffmpeg-fit=$(value2switch $SRS_FFMPEG_FIT)"
SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --sys-ffmpeg=$(value2switch $SRS_USE_SYS_FFMPEG)"
SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --ffmpeg-opus=$(value2switch $SRS_FFMPEG_OPUS)"
SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --nasm=$(value2switch $SRS_NASM)"
SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --srtp-nasm=$(value2switch $SRS_SRTP_ASM)"
SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --sys-srtp=$(value2switch $SRS_USE_SYS_SRTP)"
SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --clean=$(value2switch $SRS_CLEAN)"
SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --gperf=$(value2switch $SRS_GPERF)"
SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --gmc=$(value2switch $SRS_GPERF_MC)"
SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --gmd=$(value2switch $SRS_GPERF_MD)"
SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --gmp=$(value2switch $SRS_GPERF_MP)"
SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --gcp=$(value2switch $SRS_GPERF_CP)"
SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --gprof=$(value2switch $SRS_GPROF)"
SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --static=$(value2switch $SRS_STATIC)"
SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --shared-st=$(value2switch $SRS_SHARED_ST)"
SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --shared-srt=$(value2switch $SRS_SHARED_SRT)"
SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --shared-ffmpeg=$(value2switch $SRS_SHARED_FFMPEG)"
SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --shared-srtp=$(value2switch $SRS_SHARED_SRTP)"
SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --log-verbose=$(value2switch $SRS_LOG_VERBOSE)"
SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --log-info=$(value2switch $SRS_LOG_INFO)"
SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --log-trace=$(value2switch $SRS_LOG_TRACE)"
SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --log-level_v2=$(value2switch $SRS_LOG_LEVEL_V2)"
SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --gcov=$(value2switch $SRS_GCOV)"
SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --apm=$(value2switch $SRS_APM)"
SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --debug=$(value2switch $SRS_DEBUG)"
SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --debug-stats=$(value2switch $SRS_DEBUG_STATS)"
SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --cross-build=$(value2switch $SRS_CROSS_BUILD)"
SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --sanitizer=$(value2switch $SRS_SANITIZER)"
SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --sanitizer-static=$(value2switch $SRS_SANITIZER_STATIC)"
SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --sanitizer-log=$(value2switch $SRS_SANITIZER_LOG)"
SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --cygwin64=$(value2switch $SRS_CYGWIN64)"
SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --single-thread=$(value2switch $SRS_SINGLE_THREAD)"
SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --signal-api=$(value2switch $SRS_SIGNAL_API)"
SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --generic-linux=$(value2switch $SRS_GENERIC_LINUX)"
SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --build-cache=$(value2switch $SRS_BUILD_CACHE)"
if [[ $SRS_CROSS_BUILD_ARCH != "" ]]; then SRS_AUTO_CONFIGURE="$SRS_AUTO_CONFIGURE --arch=$SRS_CROSS_BUILD_ARCH"; fi
if [[ $SRS_CROSS_BUILD_CPU != "" ]]; then SRS_AUTO_CONFIGURE="$SRS_AUTO_CONFIGURE --cpu=$SRS_CROSS_BUILD_CPU"; fi
if [[ $SRS_CROSS_BUILD_HOST != "" ]]; then SRS_AUTO_CONFIGURE="$SRS_AUTO_CONFIGURE --host=$SRS_CROSS_BUILD_HOST"; fi
if [[ $SRS_CROSS_BUILD_PREFIX != "" ]]; then SRS_AUTO_CONFIGURE="$SRS_AUTO_CONFIGURE --cross-prefix=$SRS_CROSS_BUILD_PREFIX"; fi
if [[ $SRS_EXTRA_FLAGS != '' ]]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --extra-flags=\\\"$SRS_EXTRA_FLAGS\\\""; fi
if [[ $SRS_EXTRA_LDFLAGS != '' ]]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --extra-ldflags=\\\"$SRS_EXTRA_LDFLAGS\\\""; fi
if [[ $SRS_BUILD_TAG != '' ]]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --build-tag=\\\"$SRS_BUILD_TAG\\\""; fi
if [[ $SRS_TOOL_CC != '' ]]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --cc=$SRS_TOOL_CC"; fi
if [[ $SRS_TOOL_CXX != '' ]]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --cxx=$SRS_TOOL_CXX"; fi
if [[ $SRS_TOOL_AR != '' ]]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --ar=$SRS_TOOL_AR"; fi
if [[ $SRS_TOOL_LD != '' ]]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --ld=$SRS_TOOL_LD"; fi
if [[ $SRS_TOOL_RANDLIB != '' ]]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --randlib=$SRS_TOOL_RANDLIB"; fi
echo "User config: $SRS_AUTO_USER_CONFIGURE"
echo "Detail config: ${SRS_AUTO_CONFIGURE}"
}
regenerate_options
#####################################################################################
# Check conflicted options
#####################################################################################
function check_option_conflicts() {
if [[ $SRS_TOOL_CC == '' || $SRS_TOOL_CXX == '' || $SRS_TOOL_AR == '' || $SRS_TOOL_LD == '' || $SRS_TOOL_RANDLIB == '' ]]; then
echo "Error: No build toolchain, cc: $SRS_TOOL_CC, cxx: $SRS_TOOL_CXX, ar: $SRS_TOOL_AR, ld: $SRS_TOOL_LD, randlib: $SRS_TOOL_RANDLIB"; exit -1
fi
if [[ $SRS_CROSS_BUILD == YES && ($SRS_TOOL_CC == 'gcc' || $SRS_TOOL_CXX == 'g++' || $SRS_TOOL_AR == 'ar') ]]; then
echo "Error: For cross build, should setup the toolchain(./configure -h|grep -i toolchain), cc: $SRS_TOOL_CC, cxx: $SRS_TOOL_CXX, ar: $SRS_TOOL_AR"; exit 1
fi
if [[ $SRS_NGINX == YES ]]; then
echo "Warning: Don't support building NGINX, please use docker https://github.com/ossrs/srs-docker"
SRS_NGINX=NO
fi
# TODO: FIXME: check more os.
__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_MD == YES ]]; then echo "gperf-md 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 && $SRS_GPERF_MP == YES ]]; then
echo "gperf-mc not compatible with gperf-mp, see: ./configure --help";
echo "@see: https://gperftools.github.io/gperftools/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
# 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_MD == 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 variable neccessary
if [[ $SRS_HDS == RESERVED ]]; then echo "you must specifies the hds, 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_STREAM_CASTER == RESERVED ]]; then echo "you must specifies the stream-converter, 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_MD == RESERVED ]]; then echo "you must specifies the gperf-md, 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 [[ -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
+7
View File
@@ -0,0 +1,7 @@
# Reset all variables for config of modules.
SRS_MODULE_NAME=()
SRS_MODULE_MAIN=()
SRS_MODULE_APP=()
SRS_MODULE_DEFINES=""
+75
View File
@@ -0,0 +1,75 @@
#!/bin/bash
# when options parsed, setup some variables, then build the depends.
OS_KERNEL_NAME=$(uname -s)
OS_KERNRL_RELEASE=$(uname -r|awk -F '-' '{print $1}')
OS_PREFIX="Platform"
# Detect gcc, which is required.
gcc --version >/dev/null 2>/dev/null || (ret=$?; echo "Please install gcc"; exit $ret)
# Discover SRS version from header file.
mkdir -p ${SRS_OBJS} &&
echo '#include <stdio.h>' > ${SRS_OBJS}/test_version.c &&
echo '#include <srs_core_version.hpp>' >> ${SRS_OBJS}/test_version.c &&
echo 'int main(int argc, char** argv) {' >> ${SRS_OBJS}/test_version.c &&
echo ' printf("%d.%d.%d\n", VERSION_MAJOR, VERSION_MINOR, VERSION_REVISION);' >> ${SRS_OBJS}/test_version.c &&
echo ' return 0;' >> ${SRS_OBJS}/test_version.c &&
echo '}' >> ${SRS_OBJS}/test_version.c &&
gcc -g -O0 ${SRS_OBJS}/test_version.c -I${SRS_WORKDIR}/src/core -o ${SRS_OBJS}/test_version 1>/dev/null 2>&1 &&
SRS_VERSION=$(./${SRS_OBJS}/test_version 2>/dev/null) &&
SRS_MAJOR=$(echo $SRS_VERSION |awk -F . '{print $1}');
ret=$?; rm -rf ${SRS_OBJS}/test_version*; if [[ $ret -ne 0 ]]; then echo "Detect SRS version failed"; exit $ret; fi
echo "Discover SRS version=${SRS_VERSION}, major=${SRS_MAJOR}"
if [[ $OSTYPE == cygwin ]]; then
OS_KERNRL_RELEASE=$(uname -r|awk -F '(' '{print $1}')
fi
# Build platform cache.
SRS_PLATFORM="${SRS_BUILD_TAG}${OS_PREFIX}-SRS${SRS_MAJOR}-${OS_KERNEL_NAME}-${OS_KERNRL_RELEASE}"
# Build platform cache with gcc version.
if [[ $OS_KERNEL_NAME == Darwin ]]; then
GCC_VERSION="Clang$(gcc --version 2>/dev/null|grep clang|awk '{print $4}')"
SRS_PLATFORM="${SRS_PLATFORM}-${GCC_VERSION}"
else
GCC_VERSION="GCC$(gcc --version 2>/dev/null|grep gcc|awk '{print $3}')"
echo $GCC_VERSION| grep '-' >/dev/null && GCC_VERSION=$(echo $GCC_VERSION| awk -F '-' '{print$1}')
SRS_PLATFORM="${SRS_PLATFORM}-${GCC_VERSION}"
fi
# Use isolate cache for different SRS version.
SRS_PLATFORM="${SRS_PLATFORM}-$(uname -m)"
if [[ $SRS_CROSS_BUILD == YES ]]; then
SRS_TOOL_CC_NAME=$(basename $SRS_TOOL_CC)
SRS_PLATFORM="${SRS_PLATFORM}-crossbuild-$(echo $SRS_TOOL_CC_NAME|awk -F - '{print $1"-"$2}')"
fi
echo "SRS_WORKDIR: ${SRS_WORKDIR}, SRS_OBJS: ${SRS_OBJS}, SRS_PLATFORM: ${SRS_PLATFORM}"
echo "All outputs to: ${SRS_OBJS}/${SRS_PLATFORM}"
# For src object files on each platform.
(
mkdir -p ${SRS_OBJS} &&
(cd ${SRS_OBJS} && rm -rf src utest srs srs_utest research include lib srs_hls_ingester srs_mp4_parser) &&
mkdir -p ${SRS_OBJS}/src ${SRS_OBJS}/research ${SRS_OBJS}/utest &&
mkdir -p ${SRS_OBJS}/${SRS_PLATFORM}/3rdparty &&
(cd ${SRS_OBJS} && rm -rf st ffmpeg opus srtp2 openssl srt) &&
mkdir -p ${SRS_OBJS}/st ${SRS_OBJS}/ffmpeg ${SRS_OBJS}/opus ${SRS_OBJS}/srtp2 ${SRS_OBJS}/openssl \
${SRS_OBJS}/srt &&
mkdir -p ${SRS_OBJS}/${SRS_PLATFORM}/3rdparty/st ${SRS_OBJS}/${SRS_PLATFORM}/3rdparty/ffmpeg \
${SRS_OBJS}/${SRS_PLATFORM}/3rdparty/opus ${SRS_OBJS}/${SRS_PLATFORM}/3rdparty/srtp2 \
${SRS_OBJS}/${SRS_PLATFORM}/3rdparty/openssl ${SRS_OBJS}/${SRS_PLATFORM}/3rdparty/srt
)
ret=$?; if [[ $ret -ne 0 ]]; then echo "Create build directory failed, ret=$ret"; exit $ret; fi
if [[ $SRS_CLEAN == NO ]]; then
echo "Fast cleanup, if need to do full cleanup, please use: make clean"
fi
# TODO: FIXME: Remove python, use Go for api server demo.
# Python or python2, for CentOS8.
python2 --version >/dev/null 2>&1 && alias python=python2 &&
echo "Alias python2 as python"
+57
View File
@@ -0,0 +1,57 @@
#!/bin/bash
# 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
SrsStreamConverterSummaryColor="\${YELLOW}(Disabled) "; if [[ $SRS_STREAM_CASTER == YES ]]; then SrsStreamConverterSummaryColor="\${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
SrsGperfMDSummaryColor="\${GREEN}(Disabled) "; if [[ $SRS_GPERF_MD == YES ]]; then SrsGperfMDSummaryColor="\${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
SrsValgrindSummaryColor="\${YELLOW}(Disabled) "; if [[ $SRS_VALGRIND == YES ]]; then SrsValgrindSummaryColor="\${GREEN}"; 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}The build summary:\${BLACK}"
echo -e " \${BLACK}+------------------------------------------------------------------------------------\${BLACK}"
echo -e " \${GREEN}For SRS benchmark, gperf, gprof and valgrind, please read:\${BLACK}"
echo -e " \${GREEN} https://www.jianshu.com/p/6d4a89359352\${BLACK}"
echo -e " \${BLACK}+------------------------------------------------------------------------------------\${BLACK}"
echo -e " |\${GREEN}The main server usage: ./objs/srs -c conf/srs.conf, start the srs server\${BLACK}"
echo -e " | ${SrsHlsSummaryColor}About HLS, please read https://ossrs.net/lts/zh-cn/docs/v4/doc/delivery-hls\${BLACK}"
echo -e " | ${SrsDvrSummaryColor}About DVR, please read https://ossrs.net/lts/zh-cn/docs/v4/doc/dvr\${BLACK}"
echo -e " | ${SrsSslSummaryColor}About SSL, please read https://ossrs.net/lts/zh-cn/docs/v4/doc/rtmp-handshake\${BLACK}"
echo -e " | ${SrsTranscodeSummaryColor}About transcoding, please read https://ossrs.net/lts/zh-cn/docs/v4/doc/ffmpeg\${BLACK}"
echo -e " | ${SrsIngestSummaryColor}About ingester, please read https://ossrs.net/lts/zh-cn/docs/v4/doc/ingest\${BLACK}"
echo -e " | ${SrsHttpCallbackSummaryColor}About http-callback, please read https://ossrs.net/lts/zh-cn/docs/v4/doc/http-callback\${BLACK}"
echo -e " | ${SrsHttpServerSummaryColor}Aoubt http-server, please read https://ossrs.net/lts/zh-cn/docs/v4/doc/http-server\${BLACK}"
echo -e " | ${SrsHttpApiSummaryColor}About http-api, please read https://ossrs.net/lts/zh-cn/docs/v4/doc/http-api\${BLACK}"
echo -e " | ${SrsStreamConverterSummaryColor}About stream-caster, please read https://ossrs.net/lts/zh-cn/docs/v4/doc/streamer\${BLACK}"
echo -e " | ${SrsValgrindSummaryColor}About VALGRIND, please read https://github.com/ossrs/state-threads/issues/2\${BLACK}"
echo -e " \${BLACK}+------------------------------------------------------------------------------------\${BLACK}"
echo -e "\${GREEN}binaries, please read https://ossrs.net/lts/zh-cn/docs/v4/doc/install\${BLACK}"
echo "You can:"
echo " ./objs/srs -c conf/srs.conf"
echo " to start the srs server, with config conf/srs.conf."
END
+199
View File
@@ -0,0 +1,199 @@
# generate utest Makefile
#
# params:
# $SRS_OBJS the objs directory to store the Makefile. ie. ./objs
# $SRS_OBJS the objs directory for Makefile. ie. objs
#
# $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}/${SRS_PLATFORM}/utest/Makefile
# create dir for Makefile
mkdir -p ${SRS_OBJS}/${SRS_PLATFORM}/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/{Platform}/gtest
GTEST_DIR=../3rdparty/gtest/googletest
# Whether enable C++11 or higher versions.
# For linux, always use C++11 for gtest required, see https://github.com/google/googletest
# For cygwin64, ignore because it use -std=gnu++11 by default.
SRS_CPP_VERSION="-std=c++11"
if [[ $SRS_CYGWIN64 == YES ]]; then SRS_CPP_VERSION="-std=gnu++11"; fi
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 = .
# C++ compiler
CXX = ${SRS_TOOL_CXX}
# Flags passed to the preprocessor.
CPPFLAGS += -I\$(GTEST_DIR)/include
# Flags passed to the C++ compiler.
CXXFLAGS += ${CXXFLAGS} ${UTEST_EXTRA_DEFINES}
CXXFLAGS += -Wno-unused-private-field -Wno-unused-command-line-argument
CXXFLAGS += ${SRS_CPP_VERSION}
# 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
if [[ "${item:0:1}" == "/" ]]; then
echo -n "-I${item} " >> ${FILE}
else
echo -n "-I${SRS_TRUNK_PREFIX}/${item} " >> ${FILE}
fi
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
if [[ "${item:0:1}" == "/" ]]; then
echo -n "${item} " >> ${FILE}
else
echo -n "${SRS_TRUNK_PREFIX}/${item} " >> ${FILE}
fi
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.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 '!';
+53
View File
@@ -0,0 +1,53 @@
listen 1935;
max_connections 1000;
daemon off;
srs_log_tank console;
http_server {
enabled on;
listen 8080;
dir ./objs/nginx/html;
}
http_api {
enabled on;
listen 8080;
}
stats {
network 0;
}
rtc_server {
enabled on;
# Listen at udp://8000
listen 8000;
#
# The $CANDIDATE means fetch from env, if not configed, use * as default.
#
# The * means retrieving server IP automatically, from all network interfaces,
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#config-candidate
candidate $CANDIDATE;
}
vhost __defaultVhost__ {
rtc {
enabled on;
}
http_remux {
enabled on;
mount [vhost]/[app]/[stream].flv;
}
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/livestream;
}
}
}
+53
View File
@@ -0,0 +1,53 @@
# SRT config.
listen 1935;
max_connections 1000;
daemon off;
srs_log_tank console;
http_api {
enabled on;
listen 8080;
}
http_server {
enabled on;
listen 8080;
dir ./objs/nginx/html;
}
srt_server {
enabled on;
listen 10080;
maxbw 1000000000;
connect_timeout 4000;
peerlatency 0;
recvlatency 0;
latency 0;
tsbpdmode off;
tlpktdrop off;
sendbuf 2000000;
recvbuf 2000000;
}
# @doc https://github.com/ossrs/srs/issues/1147#issuecomment-577607026
vhost __defaultVhost__ {
srt {
enabled on;
srt_to_rtmp on;
}
http_remux {
enabled on;
mount [vhost]/[app]/[stream].flv;
}
}
# For SRT to use vhost.
vhost srs.srt.com.cn {
}
stats {
network 0;
disk sda sdb xvda xvdb;
}
+66
View File
@@ -0,0 +1,66 @@
listen 1935;
max_connections 1000;
daemon off;
srs_log_tank console;
http_server {
enabled on;
listen 8080;
dir ./objs/nginx/html;
}
http_api {
enabled on;
listen 8080;
}
stats {
network 0;
}
rtc_server {
enabled on;
# Listen at udp://8000
listen 8000;
#
# The $CANDIDATE means fetch from env, if not configed, use * as default.
#
# The * means retrieving server IP automatically, from all network interfaces,
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#config-candidate
candidate $CANDIDATE;
}
srt_server {
enabled on;
listen 10080;
maxbw 1000000000;
connect_timeout 4000;
peerlatency 0;
recvlatency 0;
latency 0;
tsbpdmode off;
tlpktdrop off;
sendbuf 2000000;
recvbuf 2000000;
}
vhost __defaultVhost__ {
rtc {
enabled on;
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#rtmp-to-rtc
rtmp_to_rtc on;
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#rtc-to-rtmp
rtc_to_rtmp on;
}
http_remux {
enabled on;
mount [vhost]/[app]/[stream].flv;
}
hls {
enabled on;
}
srt {
enabled on;
srt_to_rtmp on;
}
}
+79
View File
@@ -0,0 +1,79 @@
listen 1935;
pid ./objs/srs.pid;
srs_log_tank console;
srs_log_level trace;
max_connections 1000;
daemon off;
http_api {
enabled on;
listen 1985;
crossdomain on;
raw_api {
enabled on;
allow_reload on;
allow_query on;
allow_update on;
}
}
# for SRS1.
http_stream {
enabled on;
listen 8080;
dir ./objs/nginx/html;
}
vhost __defaultVhost__ {
# for SRS1.
http {
enabled on;
mount [vhost]/hls;
dir ./objs/nginx/html/hls;
}
# for SRS1.
refer github.com github.io;
refer_publish github.com github.io;
refer_play github.com github.io;
# for SRS2
publish_1stpkt_timeout 20000;
publish_normal_timeout 7000;
# for SRS2
mr {
enabled off;
latency 350;
}
# for SRS1
mode remote;
origin 127.0.0.1:1935 localhost:1935;
token_traverse off;
vhost same.edge.srs.com;
debug_srs_upnode off;
# for SRS1
forward 127.0.0.1:1936 127.0.0.1:1937;
# for SRS1
time_jitter full;
# for SRS2
mix_correct off;
#for SRS1
atc on;
atc_auto on;
# for SRS2
mw_latency 100;
# for SRS1
gop_cache off;
queue_length 10;
# for SRS2
send_min_interval 10.0;
reduce_sequence_header on;
}
+37
View File
@@ -0,0 +1,37 @@
# 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_server {
enabled on;
listen 8080;
}
rtc_server {
enabled on;
listen 8000; # UDP port
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#config-candidate
candidate $CANDIDATE;
}
vhost __defaultVhost__ {
hls {
enabled on;
}
http_remux {
enabled on;
mount [vhost]/[app]/[stream].flv;
}
rtc {
enabled on;
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#rtmp-to-rtc
rtmp_to_rtc on;
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#rtc-to-rtmp
rtc_to_rtmp on;
}
}
+17
View File
@@ -0,0 +1,17 @@
# no-daemon and write log to console config for srs.
# @see full.conf for detail config.
listen 1935 [::]:1935;
max_connections 1000;
daemon off;
srs_log_tank console;
http_api {
enabled on;
listen 1985;
}
http_server {
enabled on;
listen 8080;
}
vhost __defaultVhost__ {
}
+23
View File
@@ -0,0 +1,23 @@
# the config for srs to delivery dash
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/sample-dash
# @see full.conf for detail config.
listen 1935;
max_connections 1000;
daemon off;
srs_log_tank console;
http_server {
enabled on;
listen 8080;
dir ./objs/nginx/html;
}
vhost __defaultVhost__ {
dash {
enabled on;
dash_fragment 10;
dash_update_period 10;
dash_window_size 3;
dash_path ./objs/nginx/html;
dash_mpd_file [app]/[stream].mpd;
}
}
+22
View File
@@ -0,0 +1,22 @@
# the config for srs demo
# @see full.conf for detail config.
listen 19350;
max_connections 1000;
daemon off;
srs_log_tank console;
pid ./objs/srs.demo.19350.pid;
vhost __defaultVhost__ {
enabled on;
play {
gop_cache on;
}
hls {
enabled on;
hls_path ./objs/nginx/html/forward;
hls_fragment 5;
hls_window 30;
}
}
+205
View File
@@ -0,0 +1,205 @@
# the config for srs demo
# @see full.conf for detail config.
listen 1935;
max_connections 1000;
daemon off;
srs_log_tank console;
pid ./objs/srs.demo.pid;
chunk_size 60000;
max_connections 2000;
http_api {
enabled on;
listen 1985;
}
http_server {
enabled on;
listen 8080;
dir ./objs/nginx/html;
}
vhost __defaultVhost__ {
enabled on;
gop_cache on;
}
vhost demo.srs.com {
chunk_size 60000;
enabled on;
gop_cache on;
queue_length 30;
forward {
enabled on;
destination 127.0.0.1:19350;
}
hls {
enabled on;
hls_path ./objs/nginx/html;
hls_fragment 5;
hls_window 30;
}
http_hooks {
enabled on;
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 libfdk_aac;
abitrate 45;
asample_rate 44100;
achannels 2;
aparams {
}
output rtmp://127.0.0.1:[port]/[app]/[stream]_[engine]?vhost=[vhost];
}
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 libfdk_aac;
abitrate 40;
asample_rate 44100;
achannels 2;
aparams {
}
output rtmp://127.0.0.1:[port]/[app]/[stream]_[engine]?vhost=[vhost];
}
}
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/livestream?vhost=[vhost];
}
}
}
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 libfdk_aac;
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/demo?vhost=[vhost];
}
}
}
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;
}
}
+40
View File
@@ -0,0 +1,40 @@
# docker config for srs.
# @see full.conf for detail config.
listen 1935;
max_connections 1000;
# For docker, please use docker logs to manage the logs of SRS.
# See https://docs.docker.com/config/containers/logging/
srs_log_tank console;
daemon off;
http_api {
enabled on;
listen 1985;
}
http_server {
enabled on;
listen 8080;
dir ./objs/nginx/html;
}
rtc_server {
enabled on;
listen 8000;
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#config-candidate
candidate $CANDIDATE;
}
vhost __defaultVhost__ {
hls {
enabled on;
}
http_remux {
enabled on;
mount [vhost]/[app]/[stream].flv;
}
rtc {
enabled on;
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#rtmp-to-rtc
rtmp_to_rtc on;
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#rtc-to-rtmp
rtc_to_rtmp on;
}
}
+15
View File
@@ -0,0 +1,15 @@
# the config for srs to dvr in session mode
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/dvr
# @see full.conf for detail config.
listen 1935;
max_connections 1000;
daemon off;
srs_log_tank console;
vhost __defaultVhost__ {
dvr {
enabled on;
dvr_path ./objs/nginx/html/[app]/[stream].[timestamp].mp4;
dvr_plan session;
}
}
+18
View File
@@ -0,0 +1,18 @@
# the config for srs to dvr in custom path.
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/dvr#custom-path
# @see https://ossrs.io/lts/en-us/docs/v4/doc/dvr#custom-path
# @see full.conf for detail config.
listen 1935;
max_connections 1000;
daemon off;
srs_log_tank console;
vhost __defaultVhost__ {
dvr {
enabled on;
dvr_path ./objs/nginx/html/[app]/[stream]/[2006]/[01]/[02]/[15].[04].[05].[999].flv;
dvr_plan segment;
dvr_duration 30;
dvr_wait_keyframe on;
}
}
+17
View File
@@ -0,0 +1,17 @@
# the config for srs to dvr in segment mode
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/dvr
# @see full.conf for detail config.
listen 1935;
max_connections 1000;
daemon off;
srs_log_tank console;
vhost __defaultVhost__ {
dvr {
enabled on;
dvr_path ./objs/nginx/html/[app]/[stream].[timestamp].flv;
dvr_plan segment;
dvr_duration 30;
dvr_wait_keyframe on;
}
}
+15
View File
@@ -0,0 +1,15 @@
# the config for srs to dvr in session mode
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/dvr
# @see full.conf for detail config.
listen 1935;
max_connections 1000;
daemon off;
srs_log_tank console;
vhost __defaultVhost__ {
dvr {
enabled on;
dvr_path ./objs/nginx/html/[app]/[stream].[timestamp].flv;
dvr_plan session;
}
}
+24
View File
@@ -0,0 +1,24 @@
# the config for srs origin-edge cluster
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/edge
# @see full.conf for detail config.
listen 1935;
max_connections 1000;
pid objs/edge.pid;
daemon off;
srs_log_tank console;
http_server {
enabled on;
listen 8080;
dir ./objs/nginx/html;
}
vhost __defaultVhost__ {
cluster {
mode remote;
origin 127.0.0.1:19350;
}
http_remux {
enabled on;
mount [vhost]/[app]/[stream].flv;
}
}
+15
View File
@@ -0,0 +1,15 @@
# the config for srs for token traverse authentication
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/drm
# @see full.conf for detail config.
listen 1935;
max_connections 1000;
daemon off;
srs_log_tank console;
vhost __defaultVhost__ {
cluster {
mode remote;
origin 127.0.0.1:19350;
token_traverse on;
}
}
+15
View File
@@ -0,0 +1,15 @@
# the config for srs origin-edge cluster
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/edge
# @see full.conf for detail config.
listen 1935;
max_connections 1000;
pid objs/edge2.pid;
daemon off;
srs_log_tank console;
vhost __defaultVhost__ {
cluster {
mode remote;
origin 127.0.0.1:19350;
}
}
+14
View File
@@ -0,0 +1,14 @@
# the config for srs to support nginx-rtmp exec.
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/nginx-exec
# @see full.conf for detail config.
listen 1935;
max_connections 1000;
daemon off;
srs_log_tank console;
vhost __defaultVhost__ {
exec {
enabled on;
publish ./objs/ffmpeg/bin/ffmpeg -f flv -i [url] -c copy -y ./[stream].flv;
}
}
+29
View File
@@ -0,0 +1,29 @@
# the config for srs use ffmpeg to transcode
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/sample-ffmpeg
# @see full.conf for detail config.
listen 1935;
max_connections 1000;
daemon off;
srs_log_tank console;
vhost __defaultVhost__ {
transcode {
enabled on;
ffmpeg ./objs/ffmpeg/bin/ffmpeg;
engine ff {
enabled on;
vfilter {
}
vcodec libx264;
vthreads 4;
vprofile main;
vpreset medium;
vparams {
}
acodec libfdk_aac;
aparams {
}
output rtmp://127.0.0.1:[port]/[app]/[stream]_[engine]?vhost=[vhost];
}
}
}
+34
View File
@@ -0,0 +1,34 @@
listen 1935;
max_connections 1000;
daemon on; disable_daemon_for_docker off; srs_log_tank file;
http_api {
enabled on;
listen 1985;
}
http_server {
enabled on;
listen 8080;
dir ./objs/nginx/html;
}
rtc_server {
enabled on;
listen 8000; # UDP port
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#config-candidate
candidate $CANDIDATE;
}
vhost __defaultVhost__ {
hls {
enabled on;
}
http_remux {
enabled on;
mount [vhost]/[app]/[stream].flv;
}
rtc {
enabled on;
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#rtmp-to-rtc
rtmp_to_rtc off;
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#rtc-to-rtmp
rtc_to_rtmp off;
}
}
+15
View File
@@ -0,0 +1,15 @@
# the config for srs to forward to slave service
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/sample-forward
# @see full.conf for detail config.
listen 1935;
max_connections 1000;
pid ./objs/srs.backend.pid;
daemon off;
srs_log_tank console;
vhost __defaultVhost__ {
forward {
enabled on;
backend http://127.0.0.1:8085/api/v1/forward;
}
}
+15
View File
@@ -0,0 +1,15 @@
# the config for srs to forward
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/sample-forward
# @see full.conf for detail config.
listen 1935;
max_connections 1000;
pid ./objs/srs.master.pid;
daemon off;
srs_log_tank console;
vhost __defaultVhost__ {
forward {
enabled on;
destination 127.0.0.1:19350;
}
}
+11
View File
@@ -0,0 +1,11 @@
# the config for srs to forward
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/sample-forward
# @see full.conf for detail config.
listen 19350;
max_connections 1000;
pid ./objs/srs.slave.pid;
daemon off;
srs_log_tank console;
vhost __defaultVhost__ {
}
+2735
View File
File diff suppressed because it is too large Load Diff
+53
View File
@@ -0,0 +1,53 @@
listen 1935;
max_connections 1000;
daemon off;
srs_log_tank console;
stream_caster {
enabled on;
caster gb28181;
output rtmp://127.0.0.1/live/[stream];
listen 9000;
sip {
enabled off;
}
}
http_server {
enabled on;
listen 8080;
dir ./objs/nginx/html;
}
http_api {
enabled on;
listen 1985;
}
stats {
network 0;
}
rtc_server {
enabled on;
listen 8000; # UDP port
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#config-candidate
candidate $CANDIDATE;
}
vhost __defaultVhost__ {
rtc {
enabled on;
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#rtmp-to-rtc
rtmp_to_rtc on;
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#rtc-to-rtmp
rtc_to_rtmp on;
}
http_remux {
enabled on;
mount [vhost]/[app]/[stream].flv;
}
hls {
enabled on;
}
}
+56
View File
@@ -0,0 +1,56 @@
listen 1935;
max_connections 1000;
daemon off;
srs_log_tank console;
stream_caster {
enabled on;
caster gb28181;
output rtmp://127.0.0.1/live/[stream];
listen 9000;
sip {
enabled on;
listen 5060;
# @see https://ossrs.net/lts/zh-cn/docs/v5/doc/gb28181#config-candidate
candidate $CANDIDATE;
}
}
http_server {
enabled on;
listen 8080;
dir ./objs/nginx/html;
}
http_api {
enabled on;
listen 1985;
}
stats {
network 0;
}
rtc_server {
enabled on;
listen 8000; # UDP port
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#config-candidate
candidate $CANDIDATE;
}
vhost __defaultVhost__ {
rtc {
enabled on;
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#rtmp-to-rtc
rtmp_to_rtc on;
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#rtc-to-rtmp
rtc_to_rtmp on;
}
http_remux {
enabled on;
mount [vhost]/[app]/[stream].flv;
}
hls {
enabled on;
}
}
+15
View File
@@ -0,0 +1,15 @@
# the config for srs origin-edge cluster
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/edge
# @see full.conf for detail config.
listen 19351;
max_connections 1000;
pid objs/edge1.pid;
daemon off;
srs_log_tank console;
vhost __defaultVhost__ {
cluster {
mode remote;
origin 127.0.0.1:19350;
}
}
+15
View File
@@ -0,0 +1,15 @@
# the config for srs origin-edge cluster
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/edge
# @see full.conf for detail config.
listen 19352;
max_connections 1000;
pid objs/edge2.pid;
daemon off;
srs_log_tank console;
vhost __defaultVhost__ {
cluster {
mode remote;
origin 127.0.0.1:19350;
}
}
+16
View File
@@ -0,0 +1,16 @@
# the config for srs to delivery hds
# @see full.conf for detail config.
listen 1935;
max_connections 1000;
daemon off;
srs_log_tank console;
vhost __defaultVhost__ {
hds {
enabled on;
hds_fragment 10;
hds_window 60;
hds_path ./objs/nginx/html;
}
}
+26
View File
@@ -0,0 +1,26 @@
listen 1935;
max_connections 1000;
daemon off;
srs_log_tank console;
srt_server {
enabled on;
listen 10080;
}
http_api {
enabled on;
listen 1985;
}
http_server {
enabled on;
listen 8080;
}
vhost __defaultVhost__ {
srt {
enabled on;
srt_to_rtmp on;
}
http_remux {
enabled on;
mount [vhost]/[app]/[stream].flv;
}
}
+26
View File
@@ -0,0 +1,26 @@
listen 1935;
max_connections 1000;
daemon off;
srs_log_tank console;
srt_server {
enabled on;
listen 10080;
}
http_api {
enabled on;
listen 1985;
}
http_server {
enabled on;
listen 8080;
}
vhost __defaultVhost__ {
srt {
enabled on;
srt_to_rtmp on;
}
http_remux {
enabled on;
mount [vhost]/[app]/[stream].ts;
}
}
+21
View File
@@ -0,0 +1,21 @@
# the config for srs to delivery hls
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/sample-hls
# @see full.conf for detail config.
listen 1935;
max_connections 1000;
daemon off;
srs_log_tank console;
http_server {
enabled on;
listen 8080;
dir ./objs/nginx/html;
}
vhost __defaultVhost__ {
hls {
enabled on;
hls_path ./objs/nginx/html;
hls_fragment 10;
hls_window 60;
}
}
+39
View File
@@ -0,0 +1,39 @@
# Note that this is for NGINX server, not SRS.
worker_processes 3;
events {
worker_connections 10240;
}
http {
# For Proxy Cache.
proxy_cache_path /tmp/nginx-cache levels=1:2 keys_zone=srs_cache:8m max_size=1000m inactive=600m;
proxy_temp_path /tmp/nginx-cache/tmp;
server {
listen 8081;
# For Proxy Cache.
proxy_cache_valid 404 10s;
proxy_cache_lock on;
proxy_cache_lock_age 300s;
proxy_cache_lock_timeout 300s;
proxy_cache_min_uses 1;
location ~ /.+/.*\.(m3u8)$ {
proxy_pass http://127.0.0.1:8080$request_uri;
# For Proxy Cache.
proxy_cache srs_cache;
proxy_cache_key $scheme$proxy_host$uri$args;
proxy_cache_valid 200 302 10s;
}
location ~ /.+/.*\.(ts)$ {
proxy_pass http://127.0.0.1:8080$request_uri;
# For Proxy Cache.
proxy_cache srs_cache;
proxy_cache_key $scheme$proxy_host$uri;
proxy_cache_valid 200 302 60m;
}
}
}
+18
View File
@@ -0,0 +1,18 @@
listen 1935;
max_connections 1000;
daemon off;
srs_log_tank console;
http_server {
enabled on;
listen 8080;
}
vhost __defaultVhost__ {
hls {
enabled on;
# Note that it will make NGINX edge cache always missed, so never enable HLS streaming if use NGINX edges.
hls_ctx off;
hls_ts_ctx off;
}
}
+20
View File
@@ -0,0 +1,20 @@
# the config for srs to delivery realtime RTMP stream
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/sample-realtime
# @see full.conf for detail config.
listen 1935;
max_connections 1000;
daemon off;
srs_log_tank console;
http_server {
enabled on;
listen 8080;
dir ./objs/nginx/html;
}
vhost __defaultVhost__ {
hls {
enabled on;
hls_fragment 2;
hls_window 10;
}
}
+20
View File
@@ -0,0 +1,20 @@
# the config for srs to remux rtmp to aac live stream.
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/delivery-http-flv
# @see full.conf for detail config.
listen 1935;
max_connections 1000;
daemon off;
srs_log_tank console;
http_server {
enabled on;
listen 8080;
dir ./objs/nginx/html;
}
vhost __defaultVhost__ {
http_remux {
enabled on;
fast_cache 30;
mount [vhost]/[app]/[stream].aac;
}
}
+21
View File
@@ -0,0 +1,21 @@
listen 1935;
max_connections 1000;
daemon off;
srs_log_tank console;
http_api {
enabled on;
listen 1985;
auth {
enabled on;
username admin;
password admin;
}
}
http_server {
enabled on;
listen 8080;
dir ./objs/nginx/html;
}
vhost __defaultVhost__ {
}
+38
View File
@@ -0,0 +1,38 @@
# main 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_server {
enabled on;
listen 8080;
dir ./objs/nginx/html;
}
rtc_server {
enabled on;
listen 8000; # UDP port
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#config-candidate
candidate $CANDIDATE;
}
vhost __defaultVhost__ {
hls {
enabled on;
}
http_remux {
enabled on;
mount [vhost]/[app]/[stream].flv;
}
rtc {
enabled on;
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#rtmp-to-rtc
rtmp_to_rtc off;
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#rtc-to-rtmp
rtc_to_rtmp off;
}
}
+38
View File
@@ -0,0 +1,38 @@
# main 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 8080;
}
http_server {
enabled on;
listen 8080;
dir ./objs/nginx/html;
}
rtc_server {
enabled on;
listen 8000; # UDP port
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#config-candidate
candidate $CANDIDATE;
}
vhost __defaultVhost__ {
hls {
enabled on;
}
http_remux {
enabled on;
mount [vhost]/[app]/[stream].flv;
}
rtc {
enabled on;
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#rtmp-to-rtc
rtmp_to_rtc off;
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#rtc-to-rtmp
rtc_to_rtmp off;
}
}
+50
View File
@@ -0,0 +1,50 @@
# main 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 8080;
https {
enabled on;
listen 8088;
key ./conf/server.key;
cert ./conf/server.crt;
}
}
http_server {
enabled on;
listen 8080;
dir ./objs/nginx/html;
https {
enabled on;
listen 8088;
key ./conf/server.key;
cert ./conf/server.crt;
}
}
rtc_server {
enabled on;
listen 8000; # UDP port
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#config-candidate
candidate $CANDIDATE;
}
vhost __defaultVhost__ {
hls {
enabled on;
}
http_remux {
enabled on;
mount [vhost]/[app]/[stream].flv;
}
rtc {
enabled on;
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#rtmp-to-rtc
rtmp_to_rtc off;
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#rtc-to-rtmp
rtc_to_rtmp off;
}
}
+26
View File
@@ -0,0 +1,26 @@
# main 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;
raw_api {
enabled on;
allow_reload on;
}
}
http_server {
enabled on;
listen 8080;
dir ./objs/nginx/html;
}
stats {
network 0;
disk sda sdb xvda xvdb;
}
vhost __defaultVhost__ {
}
+19
View File
@@ -0,0 +1,19 @@
# the config for srs to remux rtmp to flv live stream.
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/delivery-http-flv
# @see full.conf for detail config.
listen 1935;
max_connections 1000;
daemon off;
srs_log_tank console;
http_server {
enabled on;
listen 8080;
dir ./objs/nginx/html;
}
vhost __defaultVhost__ {
http_remux {
enabled on;
mount [vhost]/[app]/[stream].flv;
}
}
+24
View File
@@ -0,0 +1,24 @@
# the config for srs to remux rtmp to flv live stream.
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/delivery-http-flv
# @see full.conf for detail config.
listen 19351;
max_connections 1000;
pid objs/srs.flv.19351.pid;
daemon off;
srs_log_tank console;
http_server {
enabled on;
listen 8081;
dir ./objs/nginx/html;
}
vhost __defaultVhost__ {
cluster {
mode remote;
origin 127.0.0.1;
}
http_remux {
enabled on;
mount [vhost]/[app]/[stream].flv;
}
}
+24
View File
@@ -0,0 +1,24 @@
# the config for srs to remux rtmp to flv live stream.
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/delivery-http-flv
# @see full.conf for detail config.
listen 19352;
max_connections 1000;
pid objs/srs.flv.19352.pid;
daemon off;
srs_log_tank console;
http_server {
enabled on;
listen 8082;
dir ./objs/nginx/html;
}
vhost __defaultVhost__ {
cluster {
mode remote;
origin 127.0.0.1;
}
http_remux {
enabled on;
mount [vhost]/[app]/[stream].flv;
}
}
+25
View File
@@ -0,0 +1,25 @@
# the config for srs http heartbeat, report its info to api-server
# @see full.conf for detail config.
listen 1935;
max_connections 1000;
daemon off;
srs_log_tank console;
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__ {
}
+23
View File
@@ -0,0 +1,23 @@
# the config for srs to delivery hls
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/sample-hls
# @see full.conf for detail config.
listen 1935;
max_connections 1000;
daemon off;
srs_log_tank console;
http_server {
enabled on;
listen 8080;
dir ./objs/nginx/html;
}
vhost __defaultVhost__ {
hls {
enabled on;
hls_fragment 10;
hls_window 60;
hls_path ./objs/nginx/html;
hls_m3u8_file [app]/[stream].m3u8;
hls_ts_file [app]/[stream]-[seq].ts;
}
}
+16
View File
@@ -0,0 +1,16 @@
# http-hooks or http-callbacks config for srs.
# @see full.conf for detail config.
listen 1935;
max_connections 1000;
daemon off;
srs_log_tank console;
vhost __defaultVhost__ {
http_hooks {
enabled on;
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;
}
}
+20
View File
@@ -0,0 +1,20 @@
# the config for srs to remux rtmp to mp3 live stream.
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/delivery-http-flv
# @see full.conf for detail config.
listen 1935;
max_connections 1000;
daemon off;
srs_log_tank console;
http_server {
enabled on;
listen 8080;
dir ./objs/nginx/html;
}
vhost __defaultVhost__ {
http_remux {
enabled on;
fast_cache 30;
mount [vhost]/[app]/[stream].mp3;
}
}
+19
View File
@@ -0,0 +1,19 @@
# the config for srs to serve as http server
# @see full.conf for detail config.
listen 1935;
max_connections 1000;
daemon off;
srs_log_tank console;
http_server {
enabled on;
listen 8080;
dir ./objs/nginx/html;
}
vhost ossrs.net {
http_static {
enabled on;
mount [vhost]/;
dir ./objs/nginx/html;
}
}
+19
View File
@@ -0,0 +1,19 @@
# the config for srs to remux rtmp to ts live stream.
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/delivery-http-flv
# @see full.conf for detail config.
listen 1935;
max_connections 1000;
daemon off;
srs_log_tank console;
http_server {
enabled on;
listen 8080;
dir ./objs/nginx/html;
}
vhost __defaultVhost__ {
http_remux {
enabled on;
mount [vhost]/[app]/[stream].ts;
}
}
+55
View File
@@ -0,0 +1,55 @@
listen 1935;
max_connections 1000;
daemon off;
srs_log_tank console;
http_server {
enabled on;
listen 8080;
dir ./objs/nginx/html;
https {
enabled on;
listen 8088;
key ./conf/server.key;
cert ./conf/server.crt;
}
}
http_api {
enabled on;
listen 1985;
https {
enabled on;
listen 1990;
key ./conf/server.key;
cert ./conf/server.crt;
}
}
stats {
network 0;
}
rtc_server {
enabled on;
listen 8000; # UDP port
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#config-candidate
candidate $CANDIDATE;
}
vhost __defaultVhost__ {
hls {
enabled on;
}
http_remux {
enabled on;
mount [vhost]/[app]/[stream].flv;
}
rtc {
enabled on;
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#rtmp-to-rtc
rtmp_to_rtc off;
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#rtc-to-rtmp
rtc_to_rtmp off;
}
}
+25
View File
@@ -0,0 +1,25 @@
# the config for srs to remux rtmp to flv live stream.
# @see https://github.com/ossrs/srs/issues/1657#issuecomment-722971676
# @see full.conf for detail config.
listen 1935;
max_connections 1000;
daemon off;
srs_log_tank console;
http_server {
enabled on;
listen 8080;
dir ./objs/nginx/html;
https {
enabled on;
listen 8088;
key ./conf/server.key;
cert ./conf/server.crt;
}
}
vhost __defaultVhost__ {
http_remux {
enabled on;
mount [vhost]/[app]/[stream].flv;
}
}
+29
View File
@@ -0,0 +1,29 @@
# the config for srs to delivery hls
# @see https://github.com/ossrs/srs/issues/1657#issuecomment-722971676
# @see full.conf for detail config.
listen 1935;
max_connections 1000;
daemon off;
srs_log_tank console;
http_server {
enabled on;
listen 8080;
dir ./objs/nginx/html;
https {
enabled on;
listen 8088;
key ./conf/server.key;
cert ./conf/server.crt;
}
}
vhost __defaultVhost__ {
hls {
enabled on;
hls_fragment 10;
hls_window 60;
hls_path ./objs/nginx/html;
hls_m3u8_file [app]/[stream].m3u8;
hls_ts_file [app]/[stream]-[seq].ts;
}
}
+17
View File
@@ -0,0 +1,17 @@
# http-hooks or https-callbacks config for srs.
# @see https://github.com/ossrs/srs/issues/1657#issuecomment-720889906
# @see full.conf for detail config.
listen 1935;
max_connections 1000;
daemon off;
srs_log_tank console;
vhost __defaultVhost__ {
http_hooks {
enabled on;
on_publish https://127.0.0.1:443/api/v1/streams;
on_unpublish https://127.0.0.1:443/api/v1/streams;
on_play https://127.0.0.1:443/api/v1/sessions;
on_stop https://127.0.0.1:443/api/v1/sessions;
}
}
+52
View File
@@ -0,0 +1,52 @@
listen 1935;
max_connections 1000;
daemon off;
srs_log_tank console;
http_server {
enabled on;
listen 8080;
dir ./objs/nginx/html;
https {
enabled on;
listen 8088;
key ./conf/server.key;
cert ./conf/server.crt;
}
}
http_api {
enabled on;
listen 1985;
https {
enabled on;
listen 1990;
key ./conf/server.key;
cert ./conf/server.crt;
}
}
stats {
network 0;
}
rtc_server {
enabled on;
listen 8000; # UDP port
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#config-candidate
candidate $CANDIDATE;
}
vhost __defaultVhost__ {
rtc {
enabled on;
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#rtmp-to-rtc
rtmp_to_rtc off;
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#rtc-to-rtmp
rtc_to_rtmp off;
}
http_remux {
enabled on;
mount [vhost]/[app]/[stream].flv;
}
}
+52
View File
@@ -0,0 +1,52 @@
listen 1935;
max_connections 1000;
daemon off;
srs_log_tank console;
http_server {
enabled on;
listen 8080;
dir ./objs/nginx/html;
https {
enabled on;
listen 8088;
key ./conf/server.key;
cert ./conf/server.crt;
}
}
http_api {
enabled on;
listen 1985;
https {
enabled on;
listen 1990;
key ./conf/server.key;
cert ./conf/server.crt;
}
}
stats {
network 0;
}
rtc_server {
enabled on;
listen 8000; # UDP port
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#config-candidate
candidate $CANDIDATE;
}
vhost __defaultVhost__ {
rtc {
enabled on;
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#rtmp-to-rtc
rtmp_to_rtc on;
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#rtc-to-rtmp
rtc_to_rtmp on;
}
http_remux {
enabled on;
mount [vhost]/[app]/[stream].flv;
}
}
+55
View File
@@ -0,0 +1,55 @@
listen 1935;
max_connections 1000;
daemon off;
srs_log_tank console;
http_server {
enabled on;
listen 8080;
dir ./objs/nginx/html;
https {
enabled on;
listen 8088;
key ./conf/server.key;
cert ./conf/server.crt;
}
}
http_api {
enabled on;
listen 1985;
https {
enabled on;
listen 1990;
key ./conf/server.key;
cert ./conf/server.crt;
}
}
stats {
network 0;
}
rtc_server {
enabled on;
listen 8000; # UDP port
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#config-candidate
candidate $CANDIDATE;
}
vhost __defaultVhost__ {
hls {
enabled on;
}
http_remux {
enabled on;
mount [vhost]/[app]/[stream].flv;
}
rtc {
enabled on;
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#rtmp-to-rtc
rtmp_to_rtc off;
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#rtc-to-rtmp
rtc_to_rtmp off;
}
}
+20
View File
@@ -0,0 +1,20 @@
# include directive config for SRS.
# @see full.conf for detail config.
listen 1935;
max_connections 1000;
srs_log_tank console;
daemon off;
http_api {
enabled on;
listen 1985;
}
http_server {
enabled on;
listen 8080;
dir ./objs/nginx/html;
}
include ./conf/include.vhost.conf;
+9
View File
@@ -0,0 +1,9 @@
vhost include.srs.com {
hls {
enabled on;
}
http_remux {
enabled on;
mount [vhost]/[app]/[stream].flv;
}
}
+22
View File
@@ -0,0 +1,22 @@
# use ffmpeg to ingest file/stream/device to SRS
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/sample-ingest
# @see full.conf for detail config.
listen 1935;
max_connections 1000;
daemon off;
srs_log_tank console;
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/livestream?vhost=[vhost];
}
}
}
+28
View File
@@ -0,0 +1,28 @@
# use ffmpeg to ingest file/stream/device to SRS
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/sample-ingest
# @see full.conf for detail config.
listen 1935;
max_connections 1000;
daemon off;
srs_log_tank console;
vhost __defaultVhost__ {
ingest {
enabled on;
input {
type stream;
url rtsp://admin:12345678@192.168.2.21:554/Streaming/Channels/501?transportmode=unicast;
}
ffmpeg ./objs/ffmpeg/bin/ffmpeg;
engine {
enabled on;
perfile {
rtsp_transport tcp;
}
vcodec copy;
acodec copy;
output rtmp://127.0.0.1:[port]/live/livestream?vhost=[vhost];
}
}
}
+28
View File
@@ -0,0 +1,28 @@
# Live streaming config for SRS.
# @see full.conf for detail config.
listen 1935;
max_connections 1000;
srs_log_tank console;
daemon off;
http_api {
enabled on;
listen 1985;
}
http_server {
enabled on;
listen 8080;
dir ./objs/nginx/html;
}
vhost __defaultVhost__ {
hls {
enabled on;
}
http_remux {
enabled on;
mount [vhost]/[app]/[stream].flv;
}
}
+39
View File
@@ -0,0 +1,39 @@
# 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;
daemon off;
http_api {
enabled on;
listen 1985;
}
http_server {
enabled on;
listen 8080;
dir ./objs/nginx/html;
}
rtc_server {
enabled on;
listen 8000; # UDP port
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#config-candidate
candidate $CANDIDATE;
}
vhost __defaultVhost__ {
hls {
enabled on;
}
http_remux {
enabled on;
mount [vhost]/[app]/[stream].flv;
}
rtc {
enabled on;
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#rtmp-to-rtc
rtmp_to_rtc off;
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#rtc-to-rtmp
rtc_to_rtmp off;
}
}
+19
View File
@@ -0,0 +1,19 @@
listen 1935;
max_connections 1000;
daemon off;
srs_log_tank console;
http_server {
enabled on;
listen 8080;
dir ./objs/nginx/html;
}
vhost __defaultVhost__ {
http_remux {
enabled on;
mount [vhost]/[app]/[stream].flv;
}
hls {
enabled on;
hls_acodec mp3;
}
}
+15
View File
@@ -0,0 +1,15 @@
listen 1935;
max_connections 1000;
daemon off;
srs_log_tank console;
http_server {
enabled on;
listen 8080;
dir ./objs/nginx/html;
}
vhost __defaultVhost__ {
http_remux {
enabled on;
mount [vhost]/[app]/[stream].mp3;
}
}
+32
View File
@@ -0,0 +1,32 @@
listen 1935;
max_connections 1000;
daemon off;
srs_log_tank console;
http_server {
enabled on;
listen 8080;
dir ./objs/nginx/html;
}
rtc_server {
enabled on;
listen 8000; # UDP port
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#config-candidate
candidate $CANDIDATE;
}
vhost __defaultVhost__ {
http_remux {
enabled on;
mount [vhost]/[app]/[stream].flv;
}
hls {
enabled on;
hls_acodec mp3;
}
rtc {
enabled on;
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#rtmp-to-rtc
rtmp_to_rtc on;
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#rtc-to-rtmp
rtc_to_rtmp on;
}
}
+15
View File
@@ -0,0 +1,15 @@
listen 1935;
max_connections 1000;
daemon off;
srs_log_tank console;
http_server {
enabled on;
listen 8080;
dir ./objs/nginx/html;
}
vhost __defaultVhost__ {
http_remux {
enabled on;
mount [vhost]/[app]/[stream].ts;
}
}
+39
View File
@@ -0,0 +1,39 @@
# Note that this is for NGINX server, not SRS.
worker_processes 1;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
server {
listen 80;
listen 443 ssl http2;
server_name _;
ssl_certificate /usr/local/srs/conf/server.crt;
ssl_certificate_key /usr/local/srs/conf/server.key;
# For SRS homepage, console and players
# http://r.ossrs.net/console/
# http://r.ossrs.net/players/
location ~ ^/(console|players)/ {
proxy_pass http://127.0.0.1:8080/$request_uri;
}
# For SRS streaming, for example:
# http://r.ossrs.net/live/livestream.flv
# http://r.ossrs.net/live/livestream.m3u8
location ~ ^/.+/.*\.(flv|m3u8|ts|aac|mp3)$ {
proxy_pass http://127.0.0.1:8080$request_uri;
}
# For SRS backend API for console.
# For SRS WebRTC publish/play API.
location ~ ^/(api|rtc)/ {
proxy_pass http://127.0.0.1:1985$request_uri;
}
}
}
+24
View File
@@ -0,0 +1,24 @@
# 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_server {
enabled on;
listen 8080;
}
vhost __defaultVhost__ {
hls {
enabled off;
}
http_remux {
enabled on;
mount [vhost]/[app]/[stream].flv;
}
}
+15
View File
@@ -0,0 +1,15 @@
# the config for srs origin-edge cluster
# @see https://ossrs.io/lts/en-us/docs/v4/doc/origin-cluster
# @see full.conf for detail config.
listen 1935;
max_connections 1000;
pid objs/edge.pid;
daemon off;
srs_log_tank console;
vhost __defaultVhost__ {
cluster {
mode remote;
origin 127.0.0.1:19351 127.0.0.1:19350;
}
}
+20
View File
@@ -0,0 +1,20 @@
# the config for srs origin-origin cluster
# @see https://ossrs.io/lts/en-us/docs/v4/doc/origin-cluster
# @see full.conf for detail config.
listen 19350;
max_connections 1000;
daemon off;
srs_log_tank console;
pid ./objs/origin.cluster.serverA.pid;
http_api {
enabled on;
listen 9090;
}
vhost __defaultVhost__ {
cluster {
mode local;
origin_cluster on;
coworkers 127.0.0.1:9091 127.0.0.1:9092;
}
}
+20
View File
@@ -0,0 +1,20 @@
# the config for srs origin-origin cluster
# @see https://ossrs.io/lts/en-us/docs/v4/doc/origin-cluster
# @see full.conf for detail config.
listen 19351;
max_connections 1000;
daemon off;
srs_log_tank console;
pid ./objs/origin.cluster.serverB.pid;
http_api {
enabled on;
listen 9091;
}
vhost __defaultVhost__ {
cluster {
mode local;
origin_cluster on;
coworkers 127.0.0.1:9090 127.0.0.1:9092;
}
}
+20
View File
@@ -0,0 +1,20 @@
# the config for srs origin-origin cluster
# @see https://ossrs.io/lts/en-us/docs/v4/doc/origin-cluster
# @see full.conf for detail config.
listen 19352;
max_connections 1000;
daemon off;
srs_log_tank console;
pid ./objs/origin.cluster.serverC.pid;
http_api {
enabled on;
listen 9092;
}
vhost __defaultVhost__ {
cluster {
mode local;
origin_cluster on;
coworkers 127.0.0.1:9090 127.0.0.1:9091;
}
}
+20
View File
@@ -0,0 +1,20 @@
# the config for srs origin-edge cluster
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/edge
# @see full.conf for detail config.
listen 19350;
max_connections 1000;
pid ./objs/origin.pid;
daemon off;
srs_log_tank console;
http_server {
enabled on;
listen 8081;
dir ./objs/nginx/html;
}
vhost __defaultVhost__ {
http_remux {
enabled on;
mount [vhost]/[app]/[stream].flv;
}
}
+22
View File
@@ -0,0 +1,22 @@
# the config for isolated origin server to reuse port.
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/reuse-port
# @see full.conf for detail config.
listen 1935;
max_connections 1000;
pid ./objs/origin.hls.only1.pid;
daemon off;
srs_log_tank console;
http_server {
enabled on;
listen 8080;
dir ./objs/nginx/html;
}
vhost __defaultVhost__ {
hls {
enabled on;
hls_path ./objs/nginx/html;
hls_fragment 10;
hls_window 60;
}
}
+22
View File
@@ -0,0 +1,22 @@
# the config for isolated origin server to reuse port.
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/reuse-port
# @see full.conf for detail config.
listen 1935;
max_connections 1000;
pid ./objs/origin.hls.only2.pid;
daemon off;
srs_log_tank console;
http_server {
enabled on;
listen 8080;
dir ./objs/nginx/html;
}
vhost __defaultVhost__ {
hls {
enabled on;
hls_path ./objs/nginx/html;
hls_fragment 10;
hls_window 60;
}
}
+44
View File
@@ -0,0 +1,44 @@
# 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_server {
enabled on;
listen 8080;
}
rtc_server {
enabled on;
listen 8000; # UDP port
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#config-candidate
candidate $CANDIDATE;
}
# Prometheus exporter config.
exporter {
enabled on;
listen 9972;
label cn-beijing;
tag cn-edge;
}
vhost __defaultVhost__ {
hls {
enabled on;
}
http_remux {
enabled on;
mount [vhost]/[app]/[stream].flv;
}
rtc {
enabled on;
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#rtmp-to-rtc
rtmp_to_rtc on;
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#rtc-to-rtmp
rtc_to_rtmp on;
}
}
+45
View File
@@ -0,0 +1,45 @@
# push HTTP FLV to SRS.
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/streamer#push-http-flv-to-srs
# @see full.conf for detail config.
listen 1935;
max_connections 1000;
daemon off;
srs_log_tank console;
stream_caster {
enabled on;
caster flv;
output rtmp://127.0.0.1/[app]/[stream];
listen 8936;
}
http_server {
enabled on;
listen 8080;
dir ./objs/nginx/html;
}
http_api {
enabled on;
listen 1985;
}
rtc_server {
enabled on;
listen 8000; # UDP port
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#config-candidate
candidate $CANDIDATE;
}
vhost __defaultVhost__ {
rtc {
enabled on;
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#rtmp-to-rtc
rtmp_to_rtc on;
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#rtc-to-rtmp
rtc_to_rtmp on;
}
http_remux {
enabled on;
mount [vhost]/[app]/[stream].flv;
}
hls {
enabled on;
}
}

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