Files
ZLMediaKit/conf
taotaobujue 6676b8d8fc fix(webrtc): 修复异常 ICE 会话导致的端口资源泄漏 (#4782)
公网部署时,ICE 端口可能遭受恶意请求或扫描。异常会话长期不退出,
导致 UDP 会话、TURN relay 端口及关联资源无法及时释放,最终可能耗尽
可用端口。

- 增加 UDP ICE 会话空闲超时配置,自动关闭长期无数据的会话
- 完善 TURN Allocation 的创建、刷新、超时和主动释放流程
- 会话异常退出或销毁时清理 relay 端口、Permission 和 ChannelBind
- 为 relay 会话注册表增加并发保护,避免残留或竞态访问
- 使用弱引用解除会话对象之间的循环引用
- 修正 Allocation Mismatch 错误码为 437
- 补充 iceSessionTimeoutSec 配置及使用说明

Plan-Item: ICEBUGFIX

---------

Co-authored-by: xiongziliang <771730766@qq.com>
2026-09-20 21:49:18 +08:00
..
2024-03-16 22:56:32 +08:00
2026-03-15 15:10:51 +08:00
2023-12-09 16:23:51 +08:00

Key parameters that affect performance in the configuration file

1. Protocol enable flags (e.g., protocol.enable_hls, protocol.enable_rtsp)

Controls the protocol conversion flags. Disabling unnecessary protocols will save CPU and memory resources.

2. On-demand protocol flags (e.g., protocol.hls_demand, protocol.rtsp_demand)

Controls on-demand protocol generation. When both this and the specific protocol are enabled, it saves CPU and memory when there are no active viewers. However, the first viewer will lose the instant playback capability, impacting the initial experience.

3. protocol.paced_sender_ms

The interval for the smooth sending timer. This helps address playback stuttering caused by irregular data transmission from the source. When enabled, the timer uses data timestamps to pace the transmission, improving the viewing experience. However, this increases CPU and memory consumption. A shorter timer interval results in higher CPU usage but better smoothness. The recommended interval is between 30 and 100 milliseconds. For optimal results, use this feature in conjunction with setting protocol.modify_stamp to 2 (which suppresses timestamp jumps).

4. general.mergeWriteMS

Enables write coalescing, which reduces the number of system calls and the frequency of data sharing between threads during transmission. This significantly boosts forwarding performance but comes at the cost of increased playback latency and reduced transmission smoothness.

5. rtp_proxy.gop_cache

Enables the GOP (Group of Pictures) caching feature for the startSendRtp cascaded interface, designed to allow instant playback for cascading setups (e.g., GB28181). Note that this setting does not affect the instant playback capability of ZLMediaKit's external live streaming services. Enabling this option increases memory usage but has a minimal impact on the CPU. We recommend disabling it if you don't use the startSendRtp interface.

6. hls.fileBufSize

Tuning this parameter can improve the disk I/O performance when writing HLS streams.

7. record.fileBufSize

Tuning this parameter can improve the disk I/O performance when recording MP4 files.