92 lines
2.1 KiB
Plaintext
92 lines
2.1 KiB
Plaintext
listen 1935;
|
||
max_connections 1000;
|
||
daemon off;
|
||
srs_log_tank console;
|
||
|
||
# 全局优化配置
|
||
# 减少缓冲区大小,降低延迟
|
||
mr_enabled off;
|
||
# 启用快速启动
|
||
fast_cache 10;
|
||
# 优化TCP配置
|
||
tcp_nodelay on;
|
||
|
||
http_server {
|
||
enabled on;
|
||
listen 8080;
|
||
dir ./objs/nginx/html;
|
||
# 启用跨域支持
|
||
crossdomain on;
|
||
}
|
||
|
||
http_api {
|
||
enabled on;
|
||
listen 1985;
|
||
# 启用跨域支持
|
||
crossdomain on;
|
||
}
|
||
|
||
stats {
|
||
network 0;
|
||
}
|
||
|
||
vhost __defaultVhost__ {
|
||
# RTMP 配置 - 优化延迟
|
||
rtmp {
|
||
enabled on;
|
||
# 减少缓冲区大小,降低延迟
|
||
chunk_size 4096;
|
||
}
|
||
|
||
# HLS 配置 - 优化延迟
|
||
hls {
|
||
enabled on;
|
||
hls_path ./objs/nginx/html;
|
||
# 减少分片时长,降低延迟
|
||
hls_fragment 2;
|
||
hls_window 6;
|
||
# 启用低延迟模式
|
||
hls_dispose 30;
|
||
}
|
||
|
||
# HTTP-FLV 配置 - 低延迟播放
|
||
http_remux {
|
||
enabled on;
|
||
mount [vhost]/[app]/[stream].flv;
|
||
# 启用快速启动
|
||
fast_cache 10;
|
||
}
|
||
|
||
# 转码配置(可选)
|
||
transcode {
|
||
enabled off;
|
||
}
|
||
|
||
# 播放配置 - 优化延迟
|
||
play {
|
||
# 减少GOP缓存
|
||
gop_cache off;
|
||
# 启用时间校正
|
||
time_jitter full;
|
||
# 减少队列长度
|
||
queue_length 10;
|
||
}
|
||
|
||
# 发布配置 - 优化延迟
|
||
publish {
|
||
# 减少首帧等待时间
|
||
firstpkt_timeout 20000;
|
||
# 减少正常包超时
|
||
normal_timeout 5000;
|
||
}
|
||
|
||
# HTTP Hooks: 推流/播放事件回调到 Node API,Node API 再转发到 Java 后端
|
||
http_hooks {
|
||
enabled on;
|
||
on_publish http://api-server:3001/api/srs/on_publish;
|
||
on_unpublish http://api-server:3001/api/srs/on_unpublish;
|
||
on_play http://api-server:3001/api/srs/on_play;
|
||
on_stop http://api-server:3001/api/srs/on_stop;
|
||
}
|
||
}
|