Skip to content

Commit a83c902

Browse files
authored
SRT: Enable tlpktdrop by default to prevent 100% CPU usage. v7.0.133 (#4587) (#4601)
1 parent e970ad2 commit a83c902

File tree

12 files changed

+100
-26
lines changed

12 files changed

+100
-26
lines changed

.augment-guidelines

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ architecture:
1313

1414
origin_cluster:
1515
v6_mesh: "DEPRECATED - C++ MESH mode, RTMP only"
16-
v7_proxy: "RECOMMENDED - Go-based proxy (github.com/ossrs/proxy-go), all protocols, better scaling"
16+
v7_proxy: "RECOMMENDED - Go-based proxy (https://github.com/ossrs/srsx/tree/main/proxy-go), all protocols, better scaling"
1717

1818
codebase_structure:
1919
dirs: "trunk/src/{main,core,kernel,protocol,app}"

proxy/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22

33
Migrated to below repositoties:
44

5-
* [proxy-go](https://github.com/ossrs/proxy-go) An common proxy server for any media servers with RTMP/SRT/HLS/HTTP-FLV and WebRTC/WHIP/WHEP protocols support.
5+
* [srsx/proxy-go](https://github.com/ossrs/srsx/tree/main/proxy-go) An common proxy server for any media servers with RTMP/SRT/HLS/HTTP-FLV and WebRTC/WHIP/WHEP protocols support.
66

trunk/3rdparty/srs-docs/doc/origin-cluster.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@ Please see [Protocols](#protocols) for details.
4545

4646
## Build
4747

48-
To build the proxy server, you need to have Go 1.18+ installed. Then, you can build the proxy
48+
To build the proxy server, you need to have Go 1.18+ installed. Then, you can build the proxy
4949
server by below command, and get the executable binary `./srs-proxy`:
5050

5151
```bash
52-
git clone https://github.com/ossrs/proxy-go.git
53-
cd proxy-go && make
52+
git clone https://github.com/ossrs/srsx.git
53+
cd srsx/proxy-go && make
5454
```
5555

5656
> Note: You can also download the dependencies by running `go mod download` before building.

trunk/3rdparty/srs-docs/doc/srt.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,13 +269,37 @@ srt_server {
269269
peerlatency 0;
270270
recvlatency 0;
271271
latency 0;
272-
tlpktdrop off;
272+
tlpktdrop on;
273273
tsbpdmode off;
274274
}
275275
```
276276

277277
> Note: If you still experience screen glitches with the above settings, please refer to the [FFmpeg patch](https://github.com/FFmpeg/FFmpeg/commit/9099046cc76c9e3bf02f62a237b4d444cdaf5b20).
278278
279+
## Too-Late Packet Drop
280+
281+
The `tlpktdrop` (Too-Late Packet Drop) setting controls whether SRT discards packets that arrive later than the configured latency window.
282+
283+
When `tlpktdrop off` is combined with `tsbpdmode on`, the SRT receiver buffer can fill up with packets that cannot be recovered. Over time, iterating through this buffer to request retransmissions consumes 100% CPU, causing the server to become completely unresponsive - no new streams can be published, existing streams stop working, and even the HTTP API becomes unavailable.
284+
285+
**Recommended configuration:**
286+
287+
```
288+
srt_server {
289+
enabled on;
290+
listen 10080;
291+
tlpktdrop on;
292+
}
293+
```
294+
295+
**Key points:**
296+
297+
* `tlpktdrop on` does NOT disable retransmission entirely. Packets within the latency window will still be retransmitted.
298+
* With `tlpktdrop on`, if the network has severe jitter, some late packets may be dropped, causing minor video glitches.
299+
* The trade-off is: occasional glitches (with `tlpktdrop on`) vs. potential server hang (with `tlpktdrop off` + `tsbpdmode on`).
300+
301+
For more details, see [#4587](https://github.com/ossrs/srs/issues/4587).
302+
279303
## Video codec
280304

281305
Currently, H264 and HEVC encoding are supported. Since SRT protocol transfers media in MPEG-TS format, which already supports HEVC encoding (streamtype 0x24), SRT can naturally transmit HEVC encoded video without any modifications.

trunk/3rdparty/srs-docs/pages/product-en.md

Lines changed: 43 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -91,27 +91,58 @@ For a detailed interpretation, please see Welcome to SRS: Mission, Vision, and V
9191

9292
## Release 7.0
9393

94-
Code name: Kai. Named by TOC member [Haibo Chen](https://github.com/duiniuluantanqin). Expected to complete major development by the end of 2026 and officially release.
94+
Code name: Kai. Named by TOC member [Haibo Chen](https://github.com/duiniuluantanqin). Planned for release by the end of 2026.
9595

9696
> Code Name Story: I am Haibo Chen, a core maintainer of SRS and a TOC member. The code name Kai is inspired by my son Chen Kaiqi's name. As a father, I aim to set a good example by doing meaningful and interesting work. I appreciate the support and collaboration from everyone in the community, making it more vibrant and warm. This upgrade aims to provide users with more powerful features and a smoother experience, laying a strong foundation for SRS's future.
9797
98-
- [x] Support for Proxy Cluster, allowing more stream paths. [#4158](https://github.com/ossrs/srs/pull/4158)
99-
- [ ] WebRTC support for HEVC, recording HEVC to MP4 files, completing full HEVC support. [#4289](https://github.com/ossrs/srs/pull/4289), [#4349](https://github.com/ossrs/srs/pull/4349), [#4296](https://github.com/ossrs/srs/pull/4296)
100-
- [ ] HLS protocol support for fMP4. [#4159](https://github.com/ossrs/srs/pull/4159)
101-
- [ ] Support for RTSP protocol playback. [#4333](https://github.com/ossrs/srs/pull/4333)
98+
- [x] Proxy Cluster - Support for more stream paths. [#4158](https://github.com/ossrs/srs/pull/4158)
99+
- [ ] WebRTC HEVC - WebRTC support for HEVC, recording HEVC to MP4 files, completing full HEVC support. [#4289](https://github.com/ossrs/srs/pull/4289), [#4349](https://github.com/ossrs/srs/pull/4349), [#4296](https://github.com/ossrs/srs/pull/4296)
100+
- [ ] HLS fMP4 - HLS protocol support for fMP4. [#4159](https://github.com/ossrs/srs/pull/4159)
101+
- [ ] RTSP Playback - Support for RTSP protocol playback. [#4333](https://github.com/ossrs/srs/pull/4333)
102102

103103
## Release 6.0
104104

105-
Development codename: Hang. It is planned for release by the end of 2025.
105+
Development codename: Hang. Named by TOC [John](https://github.com/xiaozhihong). Released on December 3, 2024, now the stable version replacing SRS 5.0.
106106

107-
> Note: The development codename Hang is named by TOC [John](https://github.com/xiaozhihong), and the specific meaning
107+
> Note: The development codename Hang is named by TOC [John](https://github.com/xiaozhihong), and the specific meaning
108108
> is left for everyone to appreciate and ponder.
109109
110-
- [x] Supports HEVC encoding format, including protocols like RTMP, HTTP-FLV, HTTP-TS, HLS, and SRT. [#465](https://github.com/ossrs/srs/issues/465)
111-
- [x] Uses smart pointers (SrsUniquePtr and SrsSharedPtr) to improve memory management and fixes multiple memory leak issues. [#4089](https://github.com/ossrs/srs/pull/4089), [#4109](https://github.com/ossrs/srs/pull/4109)
112-
- [x] Supports IP whitelisting for HTTP-FLV, HLS, WebRTC, and SRT. [#3902](https://github.com/ossrs/srs/pull/3902)
113-
- [x] Added Basic Authentication feature for HTTP API. [#3458](https://github.com/ossrs/srs/pull/3458)
114-
- [x] GB28181 protocol supports external SIP servers. [#4101](https://github.com/ossrs/srs/pull/4101), [srs-sip](https://github.com/ossrs/srs-sip)
110+
**HEVC/H.265 Support (Major Feature)**
111+
112+
- [x] HEVC over RTMP/HTTP-FLV - Full H.265 support for RTMP and HTTP-FLV streaming. [#465](https://github.com/ossrs/srs/issues/465)
113+
- [x] HEVC over HLS - H.265 support in HLS delivery.
114+
- [x] HEVC over HTTP-TS - H.265 support for MPEG-TS streaming.
115+
- [x] HEVC over SRT - H.265 support for SRT protocol.
116+
- [x] HEVC DVR to MP4 - Record H.265 streams to MP4 format.
117+
- [x] HEVC DVR to FLV - Record H.265 streams to FLV fragments.
118+
119+
**WebRTC Enhancements**
120+
121+
- [x] WHEP Support - WebRTC-HTTP Egress Protocol for playback.
122+
- [x] OPUS Stereo SDP option - Support for stereo audio in WebRTC.
123+
- [x] Configurable AAC to Opus bitrate - Customize transcoding bitrate.
124+
125+
**Security & Authentication**
126+
127+
- [x] IP Whitelist - Security support for HTTP-FLV, HLS, WebRTC, and SRT. [#3902](https://github.com/ossrs/srs/pull/3902)
128+
- [x] Basic Authentication - HTTP API authentication feature. [#3458](https://github.com/ossrs/srs/pull/3458)
129+
130+
**SRT Improvements**
131+
132+
- [x] Upgraded libsrt to v1.5.3 - Latest SRT library version.
133+
- [x] Configurable default_streamid - Customizable SRT stream IDs.
134+
- [x] Reduced SRT-to-RTC latency - Down to 200ms.
135+
136+
**HLS Features**
137+
138+
- [x] Kick-off HLS clients - Ability to disconnect HLS clients.
139+
140+
**Other Improvements**
141+
142+
- [x] Smart pointers (SrsUniquePtr and SrsSharedPtr) - Improved memory management and fixed multiple memory leak issues. [#4089](https://github.com/ossrs/srs/pull/4089), [#4109](https://github.com/ossrs/srs/pull/4109)
143+
- [x] GB28181 protocol - Support for external SIP servers. [#4101](https://github.com/ossrs/srs/pull/4101), [srs-sip](https://github.com/ossrs/srs-sip)
144+
145+
SRS 6.0 was released at 2024.12, see [6.0-r0](https://github.com/ossrs/srs/releases/tag/v6.0-r0).
115146

116147
# Release 5.0
117148

trunk/conf/full.conf

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -723,13 +723,15 @@ srt_server {
723723
# Overwrite by env SRS_SRT_SERVER_TSBPDMODE
724724
# default: on
725725
tsbpdmode off;
726-
# The tlpkdrop means too-late Packet Drop
727-
# SRT sender side will pack timestamp in each packet, When the network is congested,
726+
# The tlpkdrop means too-late Packet Drop.
727+
# SRT sender side will pack timestamp in each packet. When the network is congested,
728728
# the packet will drop if latency is bigger than the configuration in both sender side and receiver side.
729729
# And on the sender side, it also will be dropped because latency is bigger than configuration.
730+
# Note: It's strongly recommended to keep this on. When off with tsbpdmode on, it may cause
731+
# buffer overflow and 100% CPU usage due to retransmission storms. See https://github.com/ossrs/srs/issues/4587
730732
# Overwrite by env SRS_SRT_SERVER_TLPKTDROP
731733
# default: on
732-
tlpktdrop off;
734+
tlpktdrop on;
733735
# The send buffer size of SRT.
734736
# Overwrite by env SRS_SRT_SERVER_SENDBUF
735737
# default: 8192 * (1500-28)

trunk/conf/srt.conf

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@ srt_server {
2828
recvlatency 0;
2929
latency 0;
3030
tsbpdmode off;
31-
tlpktdrop off;
31+
# Whether to enable too-late packet drop.
32+
# When enabled, packets arriving later than the latency window will be dropped,
33+
# which prevents buffer overflow and 100% CPU usage caused by retransmission storms.
34+
# See https://github.com/ossrs/srs/issues/4587
35+
tlpktdrop on;
3236
sendbuf 2000000;
3337
recvbuf 2000000;
3438
default_streamid "#!::r=live/livestream,m=publish";

trunk/conf/srt.shortstreamid.play.conf

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@ srt_server {
2828
recvlatency 0;
2929
latency 0;
3030
tsbpdmode off;
31-
tlpktdrop off;
31+
# Whether to enable too-late packet drop.
32+
# When enabled, packets arriving later than the latency window will be dropped,
33+
# which prevents buffer overflow and 100% CPU usage caused by retransmission storms.
34+
# See https://github.com/ossrs/srs/issues/4587
35+
tlpktdrop on;
3236
sendbuf 2000000;
3337
recvbuf 2000000;
3438
payloadsize 1316;

trunk/conf/srt.shortstreamid.publish.conf

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@ srt_server {
2828
recvlatency 0;
2929
latency 0;
3030
tsbpdmode off;
31-
tlpktdrop off;
31+
# Whether to enable too-late packet drop.
32+
# When enabled, packets arriving later than the latency window will be dropped,
33+
# which prevents buffer overflow and 100% CPU usage caused by retransmission storms.
34+
# See https://github.com/ossrs/srs/issues/4587
35+
tlpktdrop on;
3236
sendbuf 2000000;
3337
recvbuf 2000000;
3438
payloadsize 1316;

trunk/conf/srt.vlc.conf

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@ srt_server {
2828
recvlatency 0;
2929
latency 0;
3030
tsbpdmode off;
31-
tlpktdrop off;
31+
# Whether to enable too-late packet drop.
32+
# When enabled, packets arriving later than the latency window will be dropped,
33+
# which prevents buffer overflow and 100% CPU usage caused by retransmission storms.
34+
# See https://github.com/ossrs/srs/issues/4587
35+
tlpktdrop on;
3236
sendbuf 2000000;
3337
recvbuf 2000000;
3438
default_streamid "#!::r=live/livestream,m=request";

0 commit comments

Comments
 (0)