SRT: Enable tlpktdrop by default to prevent 100% CPU usage. v7.0.133 (#4587) (#4601)

This commit is contained in:
OSSRS-AI
2025-12-04 09:47:01 -05:00
committed by GitHub
parent e970ad26fd
commit a83c9026f9
12 changed files with 100 additions and 26 deletions

View File

@@ -13,7 +13,7 @@ architecture:
origin_cluster:
v6_mesh: "DEPRECATED - C++ MESH mode, RTMP only"
v7_proxy: "RECOMMENDED - Go-based proxy (github.com/ossrs/proxy-go), all protocols, better scaling"
v7_proxy: "RECOMMENDED - Go-based proxy (https://github.com/ossrs/srsx/tree/main/proxy-go), all protocols, better scaling"
codebase_structure:
dirs: "trunk/src/{main,core,kernel,protocol,app}"

View File

@@ -2,5 +2,5 @@
Migrated to below repositoties:
* [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.
* [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.

View File

@@ -45,12 +45,12 @@ Please see [Protocols](#protocols) for details.
## Build
To build the proxy server, you need to have Go 1.18+ installed. Then, you can build the proxy
To build the proxy server, you need to have Go 1.18+ installed. Then, you can build the proxy
server by below command, and get the executable binary `./srs-proxy`:
```bash
git clone https://github.com/ossrs/proxy-go.git
cd proxy-go && make
git clone https://github.com/ossrs/srsx.git
cd srsx/proxy-go && make
```
> Note: You can also download the dependencies by running `go mod download` before building.

View File

@@ -269,13 +269,37 @@ srt_server {
peerlatency 0;
recvlatency 0;
latency 0;
tlpktdrop off;
tlpktdrop on;
tsbpdmode off;
}
```
> Note: If you still experience screen glitches with the above settings, please refer to the [FFmpeg patch](https://github.com/FFmpeg/FFmpeg/commit/9099046cc76c9e3bf02f62a237b4d444cdaf5b20).
## Too-Late Packet Drop
The `tlpktdrop` (Too-Late Packet Drop) setting controls whether SRT discards packets that arrive later than the configured latency window.
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.
**Recommended configuration:**
```
srt_server {
enabled on;
listen 10080;
tlpktdrop on;
}
```
**Key points:**
* `tlpktdrop on` does NOT disable retransmission entirely. Packets within the latency window will still be retransmitted.
* With `tlpktdrop on`, if the network has severe jitter, some late packets may be dropped, causing minor video glitches.
* The trade-off is: occasional glitches (with `tlpktdrop on`) vs. potential server hang (with `tlpktdrop off` + `tsbpdmode on`).
For more details, see [#4587](https://github.com/ossrs/srs/issues/4587).
## Video codec
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.

View File

@@ -91,27 +91,58 @@ For a detailed interpretation, please see Welcome to SRS: Mission, Vision, and V
## Release 7.0
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.
Code name: Kai. Named by TOC member [Haibo Chen](https://github.com/duiniuluantanqin). Planned for release by the end of 2026.
> 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.
- [x] Support for Proxy Cluster, allowing more stream paths. [#4158](https://github.com/ossrs/srs/pull/4158)
- [ ] 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)
- [ ] HLS protocol support for fMP4. [#4159](https://github.com/ossrs/srs/pull/4159)
- [ ] Support for RTSP protocol playback. [#4333](https://github.com/ossrs/srs/pull/4333)
- [x] Proxy Cluster - Support for more stream paths. [#4158](https://github.com/ossrs/srs/pull/4158)
- [ ] 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)
- [ ] HLS fMP4 - HLS protocol support for fMP4. [#4159](https://github.com/ossrs/srs/pull/4159)
- [ ] RTSP Playback - Support for RTSP protocol playback. [#4333](https://github.com/ossrs/srs/pull/4333)
## Release 6.0
Development codename: Hang. It is planned for release by the end of 2025.
Development codename: Hang. Named by TOC [John](https://github.com/xiaozhihong). Released on December 3, 2024, now the stable version replacing SRS 5.0.
> Note: The development codename Hang is named by TOC [John](https://github.com/xiaozhihong), and the specific meaning
> Note: The development codename Hang is named by TOC [John](https://github.com/xiaozhihong), and the specific meaning
> is left for everyone to appreciate and ponder.
- [x] Supports HEVC encoding format, including protocols like RTMP, HTTP-FLV, HTTP-TS, HLS, and SRT. [#465](https://github.com/ossrs/srs/issues/465)
- [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)
- [x] Supports IP whitelisting for HTTP-FLV, HLS, WebRTC, and SRT. [#3902](https://github.com/ossrs/srs/pull/3902)
- [x] Added Basic Authentication feature for HTTP API. [#3458](https://github.com/ossrs/srs/pull/3458)
- [x] GB28181 protocol supports external SIP servers. [#4101](https://github.com/ossrs/srs/pull/4101), [srs-sip](https://github.com/ossrs/srs-sip)
**HEVC/H.265 Support (Major Feature)**
- [x] HEVC over RTMP/HTTP-FLV - Full H.265 support for RTMP and HTTP-FLV streaming. [#465](https://github.com/ossrs/srs/issues/465)
- [x] HEVC over HLS - H.265 support in HLS delivery.
- [x] HEVC over HTTP-TS - H.265 support for MPEG-TS streaming.
- [x] HEVC over SRT - H.265 support for SRT protocol.
- [x] HEVC DVR to MP4 - Record H.265 streams to MP4 format.
- [x] HEVC DVR to FLV - Record H.265 streams to FLV fragments.
**WebRTC Enhancements**
- [x] WHEP Support - WebRTC-HTTP Egress Protocol for playback.
- [x] OPUS Stereo SDP option - Support for stereo audio in WebRTC.
- [x] Configurable AAC to Opus bitrate - Customize transcoding bitrate.
**Security & Authentication**
- [x] IP Whitelist - Security support for HTTP-FLV, HLS, WebRTC, and SRT. [#3902](https://github.com/ossrs/srs/pull/3902)
- [x] Basic Authentication - HTTP API authentication feature. [#3458](https://github.com/ossrs/srs/pull/3458)
**SRT Improvements**
- [x] Upgraded libsrt to v1.5.3 - Latest SRT library version.
- [x] Configurable default_streamid - Customizable SRT stream IDs.
- [x] Reduced SRT-to-RTC latency - Down to 200ms.
**HLS Features**
- [x] Kick-off HLS clients - Ability to disconnect HLS clients.
**Other Improvements**
- [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)
- [x] GB28181 protocol - Support for external SIP servers. [#4101](https://github.com/ossrs/srs/pull/4101), [srs-sip](https://github.com/ossrs/srs-sip)
SRS 6.0 was released at 2024.12, see [6.0-r0](https://github.com/ossrs/srs/releases/tag/v6.0-r0).
# Release 5.0

View File

@@ -723,13 +723,15 @@ srt_server {
# Overwrite by env SRS_SRT_SERVER_TSBPDMODE
# default: on
tsbpdmode off;
# The tlpkdrop means too-late Packet Drop
# SRT sender side will pack timestamp in each packet, When the network is congested,
# The tlpkdrop means too-late Packet Drop.
# SRT sender side will pack timestamp in each packet. When the network is congested,
# the packet will drop if latency is bigger than the configuration in both sender side and receiver side.
# And on the sender side, it also will be dropped because latency is bigger than configuration.
# Note: It's strongly recommended to keep this on. When off with tsbpdmode on, it may cause
# buffer overflow and 100% CPU usage due to retransmission storms. See https://github.com/ossrs/srs/issues/4587
# Overwrite by env SRS_SRT_SERVER_TLPKTDROP
# default: on
tlpktdrop off;
tlpktdrop on;
# The send buffer size of SRT.
# Overwrite by env SRS_SRT_SERVER_SENDBUF
# default: 8192 * (1500-28)

View File

@@ -28,7 +28,11 @@ srt_server {
recvlatency 0;
latency 0;
tsbpdmode off;
tlpktdrop off;
# Whether to enable too-late packet drop.
# When enabled, packets arriving later than the latency window will be dropped,
# which prevents buffer overflow and 100% CPU usage caused by retransmission storms.
# See https://github.com/ossrs/srs/issues/4587
tlpktdrop on;
sendbuf 2000000;
recvbuf 2000000;
default_streamid "#!::r=live/livestream,m=publish";

View File

@@ -28,7 +28,11 @@ srt_server {
recvlatency 0;
latency 0;
tsbpdmode off;
tlpktdrop off;
# Whether to enable too-late packet drop.
# When enabled, packets arriving later than the latency window will be dropped,
# which prevents buffer overflow and 100% CPU usage caused by retransmission storms.
# See https://github.com/ossrs/srs/issues/4587
tlpktdrop on;
sendbuf 2000000;
recvbuf 2000000;
payloadsize 1316;

View File

@@ -28,7 +28,11 @@ srt_server {
recvlatency 0;
latency 0;
tsbpdmode off;
tlpktdrop off;
# Whether to enable too-late packet drop.
# When enabled, packets arriving later than the latency window will be dropped,
# which prevents buffer overflow and 100% CPU usage caused by retransmission storms.
# See https://github.com/ossrs/srs/issues/4587
tlpktdrop on;
sendbuf 2000000;
recvbuf 2000000;
payloadsize 1316;

View File

@@ -28,7 +28,11 @@ srt_server {
recvlatency 0;
latency 0;
tsbpdmode off;
tlpktdrop off;
# Whether to enable too-late packet drop.
# When enabled, packets arriving later than the latency window will be dropped,
# which prevents buffer overflow and 100% CPU usage caused by retransmission storms.
# See https://github.com/ossrs/srs/issues/4587
tlpktdrop on;
sendbuf 2000000;
recvbuf 2000000;
default_streamid "#!::r=live/livestream,m=request";

View File

@@ -7,6 +7,7 @@ The changelog for SRS.
<a name="v7-changes"></a>
## SRS 7.0 Changelog
* v7.0, 2025-12-04, SRT: Enable tlpktdrop by default to prevent 100% CPU usage. v7.0.133 (#4587)
* v7.0, 2025-12-03, AI: WebRTC: Fix audio-only WHIP publish without SSRC. v7.0.132 (#4570)
* v7.0, 2025-11-30, SRT: Support default_mode config for short streamid format. v7.0.131
* v7.0, 2025-11-28, SRT: Fix player not exiting when publisher disconnects. v7.0.130 (#4591)

View File

@@ -9,6 +9,6 @@
#define VERSION_MAJOR 7
#define VERSION_MINOR 0
#define VERSION_REVISION 132
#define VERSION_REVISION 133
#endif