278 Commits

Author SHA1 Message Date
YuLi
6b16281ab0 fix: limit AMF decoder nesting depth (#4787)
### Motivation
- Prevent unbounded recursive-descent parsing in the AMF decoder that
allowed deeply nested AMF objects/arrays to exhaust the process stack
and cause a pre-auth remote DoS.

### Description
- Add an RAII depth guard `AMFDecoder::DepthGuard` and a per-decoder
`depth` counter with `kMaxDepth = 64` to `AMFDecoder` in
`src/Rtmp/amf.h`/`src/Rtmp/amf.cpp`.
- Instrument `load_object()`, `load_ecma()`, and `load_arr()` to create
a `DepthGuard` at entry so nesting is incremented and reliably
decremented on return or exception, and throw
`std::runtime_error("Maximum AMF nesting depth exceeded")` when the
limit is exceeded.
- Add `tests/test_amf.cpp` to assert that a 64-level nested AMF
container is accepted and a 65-level nested container is rejected with
the expected error.
- Keep non-nested parsing behavior unchanged; the guard only enforces a
maximum container nesting depth.

### Testing
- Configured the project with tests enabled using `cmake -S . -B build
-DENABLE_TESTS=ON`, which generated the `test_amf` target successfully.
- Built the test target with `cmake --build build --target test_amf` and
performed smoke compiles of modified sources, with `src/Rtmp/amf.cpp`
compiling to object (`/tmp/amf.o`) successfully.
- Compiled the new test source with `c++ -std=gnu++11 -c
tests/test_amf.cpp` successfully and verified `git diff --cached
--check` passed.

------
[Codex
Task](https://chatgpt.com/codex/cloud/tasks/task_e_6a63c9326b9883209c857c0f4fa5d0cc)
2026-07-27 22:56:18 +08:00
Miau Lightouch
a9e0e1a81e fix(webrtc): fix GStreamer WHEP interop (#4720)
## Summary

This PR fixes GStreamer interoperability issues during WebRTC/WHEP
negotiation with ZLMediaServer.

GStreamer could fail to establish the connection for two separate
reasons:

1. ZLMediaServer generated a non-compliant ICE `ufrag`. The generated
value contained `_`, which is not a valid ICE character, so GStreamer
rejected the SDP.
2. ZLMediaServer did not correctly handle `bundle-only` offers and could
answer an accepted bundled m-line with `port=0`, which caused the later
WHEP negotiation to fail.

## Changes

- Generate ICE `ufrag` values using ICE-compliant characters only.
- Preserve and handle `a=bundle-only` correctly during SDP parsing and
answer generation.
- Return `port=9` instead of `port=0` for accepted bundled m-lines.
- Add regression coverage for `bundle-only` SDP handling.
- URL-encode `delete_webrtc` query parameters in the returned `Location`
header so ICE-safe identifiers remain round-trippable over HTTP.

## Validation

- Built with WebRTC and SCTP enabled.
- Added regression test: `test_webrtc_regression`
- Verified:
  - ICE-safe identifier round-trip through `delete_webrtc`
  - `bundle-only` SDP answer generation
2026-04-21 11:37:08 +08:00
xia-chu
a59809047c 修复编译警告 2026-01-08 21:18:00 +08:00
xia-chu
c82dd75054 支持webrtc推流 2025-09-22 21:06:17 +08:00
肖锋
fd34b5526b feature:添加http head请求的支持 (#4321)
添加http head请求的支持
2025-06-30 20:46:18 +08:00
PioLing
9863f9c160 Add logo and version information to exe on windows (#4093) 2025-01-03 11:33:35 +08:00
xia-chu
87b42ab492 优化代码
除1024改成右移10位
2024-11-29 23:51:34 +08:00
xia-chu
4f8127f6f1 消除过多cmake警告 2024-11-29 20:14:32 +08:00
a839419160
78b00d9dc0 修复关闭mp4相关功能时test编译报错 (#4043) 2024-11-27 15:22:09 +08:00
Xiaofeng Wang
06ff8461c7 减少依赖影响范围 (#4039)
See #4034
2024-11-25 11:22:29 +08:00
a839419160
326b475beb 增加pcap解析工具(#4033 #4034) 2024-11-22 17:43:15 +08:00
alex
4152dcd409 AI automatically translates all comments in the code into English (#3917) 2024-09-19 14:53:50 +08:00
xia-chu
9463d1291d 修复编译警告 2024-07-21 19:47:36 +08:00
mtdxc
d735aa1797 Media tuple refactor (#3715)
Co-authored-by: cqm <cqm@97kid.com>
2024-07-14 09:32:41 +08:00
zhang2349
c72e576420 rtp server新增支持自定义vhost和app名称 (#3693)
代码来自https://github.com/ZLMediaKit/ZLMediaKit/pull/3446 , 增加了vhost
2024-07-09 10:42:10 +08:00
xiongziliang
77d2df1695 移除RtpSelector相关逻辑,优化代码结构 2024-06-09 10:52:10 +08:00
Dw9
d6f166c1f4 Push benchmark supports input from mp4 file (#3588) 2024-06-01 18:15:35 +08:00
xia-chu
af3ef996b0 Avoid build warnings in the main code 2024-03-30 14:59:28 +08:00
xia-chu
390c374086 Optimize the code
1. change param_strs to params
2. move params from MediaInfo to MediaTuple
3. passing MediaTuple as a parameter for some functions
2024-03-30 14:41:20 +08:00
xiongziliang
77400832ac Update ZLToolKit 2024-01-06 17:47:43 +08:00
xiongziliang
a106f8dfc0 Avoid blocking the poller thread 2023-12-31 22:10:13 +08:00
夏楚
bbe8f4a018 release 8.0 2023-12-09 16:23:51 +08:00
xiongziliang
c12a6f0aed 适配ZLToolKit 2023-12-02 19:49:28 +08:00
Jovial Young
a13b8417e5 修复rtmps默认端口不对导致无法推/拉流问题 (#2996)
在使用rtmps推流或者拉流时,端口被默认设置成了1935,正确的端口应该是443.
2023-11-19 14:37:04 +08:00
xia-chu
5b394fcff7 重写加载mp4文件推流rtsp/rtmp范例程序 2023-11-11 21:34:25 +08:00
xia-chu
a871fc1882 websocket服务器支持在创建器中指定消息类型
通过该修改可以更灵活的指定同端口下不同websocket服务的消息类型
2023-10-23 20:59:37 +08:00
Deepslient
67bc0273b4 Modify the readme description (#2859) 2023-10-12 14:38:45 +08:00
Nick
07a1a929ad 修复HLS点播时下载切片过快的bug (#2635 #2628)
Co-authored-by: xia-chu <771730766@qq.com>
2023-07-08 10:18:09 +08:00
夏楚
7e117b1c7f 新增支持http-flv播放器 (#2562) 2023-06-17 10:29:27 +08:00
johzzy
03770ff409 Replace the tuple (vhost/app/stream) with MediaTuple. (#2560) 2023-06-17 10:28:01 +08:00
xia-chu
64b8079ac1 优化函数命名风格
FindField改名为findSubString
2023-06-10 14:55:40 +08:00
xia-chu
af0ebf4633 优化Parser代码命名 2023-06-10 14:55:40 +08:00
Johnny
0232caf068 add MediaTuple 2023-05-30 11:01:27 +08:00
xia-chu
cdf97e7605 更新zltoolkit,适配最新代码 2023-04-28 22:04:09 +08:00
xiongziliang
c8a20f85f6 直接打印SockException类 2023-04-23 00:10:18 +08:00
xiongguangjie
c090fc3ea0 test_rtp avoid crash when exit 2023-04-07 23:34:41 +08:00
xiongguangjie
749ef33965 use poller input data avoid throw poll check 2023-04-07 23:09:10 +08:00
xia-chu
4cc2982a2c 重写jitter buffer算法,修复seq回环时可能丢包的bug 2023-03-11 10:17:31 +08:00
xiongziliang
9fdb3de8b2 优化rtp排序抖动缓存算法,提高webrtc/rtsp抗丢包性能 2023-03-06 00:31:11 +08:00
ziyue
a981ce8cb3 优化webrtc nack算法:#2249 2023-02-25 00:19:00 +08:00
老衲不出家
f05a9501fa Unified code style (#2137) 2022-12-02 14:43:06 +08:00
mtdxc
754073918a Header refactor (#2115)
* 优化MultiMediaSourceMuxer头文件包含

* 将MediaSinkDelegate和Demux移到MediaSink中

* MediaSource头文件重构, 独立出PacketCache.h
精简Frame和Track的头文件

* Rtmp头文件重构

* Rtsp头文件重构

* webrtc头文件重构

* 规范.h头文件包含,并将其移到.cpp中:
- 尽量不包含Common\config.h
- Util\File.h
- Rtsp/RtspPlayer.h
- Rtmp/RtmpPlayer.h

* 删除多余的Stamp.h和Base64包含
2022-11-29 11:07:13 +08:00
ziyue
68948288e0 TcpSession/UdpSession统一为Session类 2022-11-19 09:33:10 +08:00
xiongziliang
9bb6a2f828 全面整理转协议相关配置文件 2022-11-12 23:56:28 +08:00
xiongziliang
9498b96b95 确保rtp推流线程安全性 2022-10-30 21:36:35 +08:00
ziyue
0b355759de 整理webrtc相关代码命名空间 2022-09-18 21:03:05 +08:00
cqm
999e0b274e 简化代码:
- MediaSource引入shortUrl和getUrl来简化日志输出
- WebApi引入fillSockInfo
2022-09-07 11:47:15 +08:00
ziyue
35791aac89 优化代码,去除编译警告,修复拼写错误 2022-08-08 17:36:07 +08:00
ziyue
9c3b8a6a95 时间戳改为64位 2022-08-08 17:13:39 +08:00
ziyue
13dd8c699b 整理cmake 2022-08-01 16:12:52 +08:00