Commit Graph

7015 Commits

Author SHA1 Message Date
winlin
758906353c Enable default configure test. 2025-10-28 10:04:53 -04:00
Haibo Chen(陈海博)
ef048b0d65
RTC: Fix DVR missing first 4-6 seconds by initializing rate from SDP (#4541)
for issue #4418, #4151, #4076 .DVR Missing First Few Seconds of
Audio/Video

### Root Cause
When recording WebRTC streams to FLV files using DVR, the first 4-6
seconds of audio/video are missing. This occurs because:

1. **Packets are discarded before A/V sync is available**: The
RTC-to-RTMP conversion pipeline actively discards all RTP packets when
avsync_time <= 0.
2. **Original algorithm requires 2 RTCP SR packets**: The previous
implementation needed to receive two RTCP Sender Report (SR) packets
before it could calculate the rate for audio/video synchronization
timestamp conversion.
3. **Delay causes packet loss**: Since RTCP SR packets typically arrive
every 2-3 seconds, waiting for 2 SRs means 4-6 seconds of packets are
discarded before A/V sync becomes available.
4. **Audio SR arrives slower than video SR**: As reported in the issue,
video RTCP SR packets arrive much faster than audio SR packets. This
asymmetry causes audio packets to be discarded for a longer period,
resulting in the audio loss observed in DVR recordings.

### Solution
1. **Initialize rate from SDP**: Use the sample rate from SDP (Session
Description Protocol) to calculate the initial rate immediately when the
track is created.
Audio (Opus): 48000 Hz → rate = 48 (RTP units per millisecond)
Video (H.264/H.265): 90000 Hz → rate = 90 (RTP units per millisecond)
2. **Enable immediate A/V sync:** With the SDP rate available,
cal_avsync_time() can calculate valid timestamps from the very first RTP
packet, eliminating packet loss.
3. **Smooth transition to precise rate**: After receiving the 2nd RTCP
SR, update to the precisely calculated rate based on actual RTP/NTP
timestamp mapping.

## Configuration

Added new configuration option `init_rate_from_sdp` in the RTC vhost
section:

```nginx
vhost rtc.vhost.srs.com {
    rtc {
        # Whether initialize RTP rate from SDP sample rate for immediate A/V sync.
        # When enabled, the RTP rate (units per millisecond) is initialized from the SDP
        # sample rate (e.g., 90 for video 90kHz, 48 for audio 48kHz) before receiving
        # 2 RTCP SR packets. This allows immediate audio/video synchronization.
        # The rate will be updated to a more precise value after receiving the 2nd SR.
        # Overwrite by env SRS_VHOST_RTC_INIT_RATE_FROM_SDP for all vhosts.
        # Default: off
        init_rate_from_sdp off;
    }
}
```

**⚠️ Important Note**: This config defaults to **off** because:
-  When **enabled**: Fixes the audio loss problem (no missing first 4-6
seconds)
-  When **enabled**: VLC on macOS cannot play the video properly
-  Other platforms work fine (Windows, Linux)
-  FFplay works fine on all platforms

Users experiencing audio loss in DVR recordings can enable this option
if they don't need VLC macOS compatibility. We're investigating the VLC
macOS issue to make this feature safe to enable by default in the
future.

---------

Co-authored-by: winlin <winlinvip@gmail.com>
Co-authored-by: OSSRS-AI <winlinam@gmail.com>
2025-10-28 09:33:40 -04:00
winlin
550760f2d0 HLS/DASH: Fix dispose to skip unpublish when not enabled, and add forbidden directory protection to SrsPath::unlink. v7.0.111 2025-10-27 08:14:48 -04:00
OSSRS-AI
3dc7b405ca AI: HTTP-FLV: Enforce minimum 10ms sleep to prevent CPU busy-wait when mw_latency=0. v7.0.110 (#3963) 2025-10-26 20:17:46 -04:00
OSSRS-AI
547b0c0ed5 AI: Edge: Fix stream names with dots being incorrectly truncated in source URL generation. v7.0.109 (#4011) 2025-10-26 18:44:12 -04:00
OSSRS-AI
19b603a0d7 AI: HTTPS: Handle SSL_ERROR_ZERO_RETURN as graceful connection closure. v7.0.108 (#4036) 2025-10-26 17:45:06 -04:00
OSSRS-AI
5fc1f2d2e5 AI: API: Add clients field to on_play/on_stop webhooks and total field to HTTP API. v7.0.107 (#4147) 2025-10-26 16:28:22 -04:00
winlin
1d9105396d Update guideline for AI about sanitizer. 2025-10-26 16:28:02 -04:00
OSSRS-AI
4ae9871285 AI: Remove deprecated SrsRtcPublisherAsync and SrsRtcPlayerAsync use WHIP/WHEP. 2025-10-26 10:00:05 -04:00
OSSRS-AI
51ab6403a3 AI: WebRTC: Fix camera/microphone not released after closing publisher. v7.0.106 (#4261) 2025-10-26 08:43:53 -04:00
OSSRS-AI
9eae868e91 AI: Build: Improve dependency checking to report all missing dependencies at once. v7.0.105 (#4293) 2025-10-25 22:21:09 -04:00
OSSRS-AI
6590871ca8 AI: HLS: Support hls_master_m3u8_path_relative for reverse proxy compatibility. v7.0.104 (#4338) 2025-10-25 21:10:21 -04:00
OSSRS-AI
b7828e1fba API: Remove minimum limit of 10 for count parameter in /api/v1/streams and /api/v1/clients. v7.0.103 (#4358) 2025-10-25 19:44:03 -04:00
OSSRS-AI
d9ea25b441 AI: Update conf description for multiple ep for callback. #4421 2025-10-24 22:22:14 -04:00
Haibo Chen(陈海博)
8f1578e0e3
Refactor: Rename ide/ directory to cmake/ for better clarity (#4539)
This PR renames the trunk/ide/ directory to trunk/cmake/ to better
reflect its actual purpose. The directory contains CMake build
configuration files used by multiple IDEs (CLion, VSCode), not
IDE-specific files.

* Directory rename: trunk/ide/ → trunk/cmake/
* Build output location: trunk/ide/vscode-build/ → trunk/cmake/build/
* CMakeLists.txt: Moved from trunk/ide/srs_clion/CMakeLists.txt to
trunk/cmake/CMakeLists.txt
2025-10-23 20:38:48 -04:00
OSSRS-AI
2fb216e86d AI: Refine utest file rules. 2025-10-23 09:44:28 -04:00
winlin
2893f43327 Compress guideline for AI. 2025-10-23 07:30:53 -04:00
OSSRS-AI
2810d32d60 AI: Only support AAC/MP3/Opus audio codec. v7.0.102 (#4516) 2025-10-22 22:08:25 -04:00
OSSRS-AI
0c9868b4a2 AI: Fix AAC audio sample rate reporting in API. v7.0.101 (#4518) 2025-10-22 21:28:45 -04:00
OSSRS-AI
8fd92d1598 AI: Add utest to cover forwarding module. #4531 2025-10-21 23:33:29 -04:00
Winlin
845e0287c0
Forward: Reject RTMPS destinations with clear error message. v7.0.100 (#4537)
SRS forward feature only supports plain RTMP protocol, not RTMPS (RTMP over SSL/TLS). This is by design - SRS SSL is server-side only (accepting connections), not client-side (initiating connections). The forward feature uses SrsSimpleRtmpClient which has no SSL handshake or encryption capabilities for outgoing connections.

Changes:
1. Add RTMPS URL detection in SrsForwarder::initialize()
2. Return ERROR_NOT_SUPPORTED error when RTMPS destination is detected
3. Add unit test to verify RTMPS URLs are properly rejected
4. Add FAQ section to .augment-guidelines explaining the limitation

For users who need to forward to RTMPS destinations (e.g., AWS IVS), the recommended solution is to use FFmpeg with SRS HTTP Hooks:
- on_publish event: Automatically start FFmpeg to relay stream to RTMPS destination
- on_unpublish event: Automatically stop FFmpeg process when stream ends

This provides a fully automated, production-ready RTMPS relay solution without adding complexity to SRS core.

Related: #4536

---------

Co-authored-by: OSSRS-AI <winlinam@gmail.com>
2025-10-20 08:03:07 -04:00
OSSRS-AI
4e35b6cacc AI: Add utest to cover signal manager 2025-10-19 22:46:06 -04:00
OSSRS-AI
341c0c000c AI: Add workflow utest for http stream. 2025-10-19 21:55:45 -04:00
OSSRS-AI
ce7ac11eae AI: Add workflow test for HTTP conn 2025-10-19 19:10:52 -04:00
OSSRS-AI
35d0e3d7c7 AI: Add workflow utest for SRT conn 2025-10-19 13:23:20 -04:00
OSSRS-AI
2913d5b827 AI: Refine utests. 2025-10-18 23:12:59 -04:00
OSSRS-AI
f86c1348b1 AI: Add workflow utest for RTMP conn 2025-10-18 22:13:15 -04:00
OSSRS-AI
054d3a3563 AI: Add workflow utest for rtc conn. 2025-10-17 21:55:29 -04:00
OSSRS-AI
8b76e1f6d2 AI: Add workflow utest for rtc publisher 2025-10-17 09:23:47 -04:00
Haibo Chen(陈海博)
0d43ed5dd6
HLS: Fix a iterator bug in hls_ctx cleanup function. v6.0.182 v7.0.99 (#4534)
Co-authored-by: OSSRS-AI <winlinam@gmail.com>
2025-10-17 07:16:42 -04:00
winlin
3f706f9c37 Refine utest mock. 2025-10-16 10:57:31 -04:00
OSSRS-AI
c9fe296342 AI: Add utest to cover 3 streams play stream. 2025-10-16 10:30:05 -04:00
OSSRS-AI
ed120ba88b AI: Add utest to manually verify rtc play workflow 2025-10-16 10:16:31 -04:00
Haibo Chen(陈海博)
abaffdd4b9
fix crash issue caused by reload configuration file. v7.0.98 (#4530)
fix crash issue caused by reload configuration file, which occurs when a
vhost is added/removed in the new configuration.

Introduced by https://github.com/ossrs/srs/pull/4458

see https://github.com/ossrs/srs/issues/4529
2025-10-16 07:30:16 -04:00
Jack Lau
6f526284a3
RTC2RTMP: fix illegal memory access. v7.0.97 (#4520)
Regression since 20f6cd595c

The early code might meet bridge is empty when
there is no bridge(e.x. rtc to rtc). Then srs_freep will free the brige.

Remove this code that seems redundant.

---------

Co-authored-by: Jacob Su <suzp1984@gmail.com>
Signed-off-by: Jack Lau <jacklau1222@qq.com>
2025-10-15 10:16:03 -04:00
OSSRS-AI
44c3dab79e AI: Add utest to cover heatbeat. 2025-10-15 09:59:45 -04:00
OSSRS-AI
223202f121 AI: Add utest to cover version query 2025-10-15 09:11:04 -04:00
OSSRS-AI
5d01393307 AI: Add utest to cover process module 2025-10-15 07:52:46 -04:00
OSSRS-AI
315ae2cd3a AI: Add utest to cover encoder module. 2025-10-14 22:31:16 -04:00
winlin
1bc18509a2 Disable sanitizer by default to fix memory leak. #4364 v7.0.96 2025-10-14 20:32:37 -04:00
winlin
bf7e93140b Refine access specifier for utest. 2025-10-13 22:26:38 -04:00
winlin
31e191e9e3 Init ST after daemon started. 2025-10-13 10:00:51 -04:00
winlin
123df8a75a Make RTMP listen optional. 2025-10-13 09:39:11 -04:00
winlin
1606c3d713 Fix utest failed. 2025-10-13 09:23:57 -04:00
OSSRS-AI
6846f8e893 AI: Add utest to cover recv thread module 2025-10-12 23:10:38 -04:00
OSSRS-AI
a3f8d13c0a AI: Fix utest fail bug. 2025-10-11 23:50:48 -04:00
OSSRS-AI
ef2bb34569 AI: Add utest to cover http module 2025-10-11 22:13:00 -04:00
OSSRS-AI
e8ac08dfa2 AI: Add utest to cover caster flv module. 2025-10-11 12:39:22 -04:00
OSSRS-AI
4004ddb5c0 AI: Add test to cover app caster module 2025-10-11 10:18:52 -04:00
OSSRS-AI
b239975458 AI: Add utest to cover encoder module 2025-10-11 08:22:34 -04:00
OSSRS-AI
c6c6f38ed7 AI: Add utest to cover the rtc server. 2025-10-10 23:52:26 -04:00
OSSRS-AI
604f9450fc AI: Add utest to cover srt module. 2025-10-10 22:48:09 -04:00
OSSRS-AI
af655c53c5 AI: Fix blackbox test bug for DVR. 2025-10-10 17:48:48 -04:00
OSSRS-AI
ae2ba44df4 AI: Add utest to cover hooks module. 2025-10-10 11:43:24 -04:00
OSSRS-AI
afeea8aed5 AI: Add utest to cover listener module. 2025-10-10 09:50:19 -04:00
OSSRS-AI
de3d5bd1f5 AI: Add utest to cover dash module. 2025-10-09 22:34:26 -04:00
OSSRS-AI
646b833757 AI: Add utest to cover the rtc network module. 2025-10-09 09:20:00 -04:00
OSSRS-AI
3919e86cc0 AI: Add utest to cover gb module. 2025-10-08 22:48:13 -04:00
OSSRS-AI
f0d713e574 AI: Add utest to cover dvr module. 2025-10-08 09:56:17 -04:00
OSSRS-AI
8ed07e37b4 AI: Add utest to cover edge module. 2025-10-07 21:05:18 -04:00
OSSRS-AI
94dde8e370 AI: Add utest to cover rtsp module. 2025-10-07 10:10:58 -04:00
OSSRS-AI
809d77b662 AI: Add utest to cover srt module. 2025-10-06 23:35:26 -04:00
OSSRS-AI
1509fde2da AI: Add utest to cover api module. 2025-10-06 11:42:50 -04:00
OSSRS-AI
3948f0d4fe AI: Add utest to cover app http module. 2025-10-05 21:55:49 -04:00
OSSRS-AI
b5664747ac AI: Add utest to cover app rtmp module. 2025-10-04 22:21:45 -04:00
OSSRS-AI
cdfe82357e AI: Add utest to cover app server module. 2025-10-04 09:06:03 -04:00
winlin
71302c4a77 SRT: Default to request for VLC. #4515 2025-10-03 15:27:03 -04:00
OSSRS-AI
702a58df6a AI: Improve coverage for app rtmp module. 2025-10-03 10:10:57 -04:00
OSSRS-AI
fc6a851d5f SRT: Support configurable default_streamid option. v6.0.180 v7.0.95 (#4515) 2025-10-01 22:05:15 -04:00
OSSRS-AI
3f876d324e AI: Improve the coverage for app hls module. 2025-10-01 21:09:29 -04:00
winlin
df3c776580 AI: Improve converage for app rtc module. 2025-09-29 11:17:07 -04:00
Winlin
c7821b4770
For Edge, only support RTMP or HTTP-FLV. v7.0.94 (#4513) 2025-09-27 19:35:34 -04:00
OSSRS-AI
c0fc8cb093 AI: Improve converage for app rtc module. 2025-09-27 09:40:57 -04:00
Haibo Chen(陈海博)
ea14caeee5
rename HEVC-related mux functions to enhance consistency and readability. (#4506) 2025-09-22 07:48:40 -04:00
Haibo Chen(陈海博)
2dfa54e21b
improve blackbox test for rtsp. v7.0.93 (#4505)
Co-authored-by: winlin <winlinvip@gmail.com>
2025-09-21 23:36:49 -04:00
OSSRS-AI
a1dd73545a AI: Improve coverage of app module. 2025-09-21 15:39:53 -04:00
winlin
10c0b66c0f Fix WHIP with transcoding bug. v7.0.92 (#4495) 2025-09-21 08:58:22 -04:00
OSSRS-AI
ca261fe955 AI: Improve coverage for app module. 2025-09-20 21:57:14 -04:00
Jacob Su
f4c54ab9a5
fix rtsp compiling warning. v7.0.91 (#4504)
## steps to produce:

1. ./configure --rtsp=off
2. make

---------

Co-authored-by: winlin <winlinvip@gmail.com>
2025-09-20 11:38:07 -04:00
Winlin
20f6cd595c
AI: Refine RTMP/SRT/RTC bridge. v7.0.90 (#4503)
This PR refactors the stream bridge architecture in SRS to improve code
organization, type safety, and maintainability by replacing the generic
ISrsStreamBridge interface with protocol-specific bridge classes and
target interfaces.

1. New Target Interface Architecture:

- Introduces  ISrsFrameTarget for AV frame consumers (RTMP sources)
- Introduces  ISrsRtpTarget for RTP packet consumers (RTC sources)
- Introduces ISrsSrtTarget for SRT packet consumers (SRT sources)

2. Protocol-Specific Bridge Classes:

- SrsRtmpBridge: Converts RTMP frames to RTC/RTSP protocols
-  SrsSrtBridge: Converts SRT packets to RTMP/RTC protocols
-  SrsRtcBridge: Converts RTC packets to RTMP protocol

3. Simplified Bridge Management:

- Removes the generic SrsCompositeBridge chain pattern
- Each source type now uses its appropriate bridge type directly

With this improvement, you are able to implement very complex bridge and
protocol converting, for example, you can bridge RTMP to RTC with opus
audio when you support enhanced RTMP with opus.

Another plan is to support bridging RTC to RTSP, directly without
converting RTP to media frame packet, but directly deliver RTP packet
from RTC source to RTSP source.

---------

Co-authored-by: OSSRS-AI <winlinam@gmail.com>
2025-09-19 21:50:28 -04:00
Winlin
e999de09ea AI: Add utests to cover app rtc module. (#4498)
Co-authored-by: OSSRS-AI <winlinam@gmail.com>
2025-09-18 11:30:28 -04:00
Winlin
04b88e889f AI: Improve coverage of app by utest (#4494)
Co-authored-by: OSSRS-AI <winlinam@gmail.com>
2025-09-17 21:51:07 -04:00
Winlin
b39aae1447 AI: Cover protocol HTTP/HTTPS/RTMP/RTC by utests. (#4493)
Co-authored-by: OSSRS-AI <winlinam@gmail.com>
2025-09-16 22:21:07 -04:00
winlin
49594b1846 Update stable version to SRS 6.0 2025-09-15 11:23:02 -04:00
Winlin
5b27c3fa7a RTC2RTMP: Fix sequence number wraparound assertion crashes. v6.0.177 v7.0.89 (#4491)
The issue occurred when srs_rtp_seq_distance(start, end) + 1 resulted in
values <= 0
due to sequence number wraparound (e.g., when end < start). This caused
assertion
failures and server crashes.

SrsRtcFrameBuilder::check_frame_complete(): Added validation to return
false
  for invalid sequence ranges instead of asserting.

However, it maybe cause converting RTC to RTMP stream failure, because
this issue
should be caused by the problem of sequence number of RTP, which means
there potentially
be stream problem in RTC stream. Even so, changing assert to warning
logs is better,
because SRS should not crash when stream is corrupt.

---------

Co-authored-by: OSSRS-AI <winlinam@gmail.com>
2025-09-15 11:02:30 -04:00
winlin
6eed395f2a Improve coverage for protocol.
Co-authored-by: OSSRS-AI <winlinam@gmail.com>
2025-09-15 10:07:13 -04:00
Winlin
4247bd1f90 Improve coverage for kernel. v7.0.88 (#4489)
Co-authored-by: OSSRS-AI <winlinam@gmail.com>
2025-09-14 21:57:12 -04:00
Winlin
fadc1215af
AI: Add utests for kernel and protocol. v7.0.87 (#4488)
Co-authored-by: OSSRS-AI <winlinam@gmail.com>
2025-09-14 08:35:36 -04:00
Winlin
d4d1d5d8b5
AI: Move some app files to kernel. v7.0.86 (#4486)
Co-authored-by: OSSRS-AI <winlinam@gmail.com>
2025-09-13 10:26:47 -04:00
Winlin
2384f3fb06
AI: Fix naming problem for app module. v7.0.85 (#4485)
Co-authored-by: OSSRS-AI <winlinam@gmail.com>
2025-09-12 19:44:43 -04:00
Jacob Su
a6d14eb09a
SRT2RTMP: fix srt bridge hevc to rtmp error. v7.0.84 (#4446)
try to fix #4428.

## Cause

rtmp do not support hevc, rtmp enhanced do.

## How to reproduce

1. start srs.
   `./objs/srs -c conf/srt.conf`
2. publish hevc (h.265) stream to srs by srt.
`ffmpeg -re -i ./doc/source.flv -c:v libx265 -crf 28 -preset medium -c:a
copy -pes_payload_size 0 -f mpegts
'srt://127.0.0.1:10080?streamid=#!::r=live/livestream,m=publish'`
3. probe the rtmp stream
   `ffprobe rtmp://localhost/live/livestream`

## About the Failed BlackBox test
The failed blackbox test: `TestSlow_SrtPublish_RtmpPlay_HEVC_Basic`
`TestSlow_SrtPublish_HttpFlvPlay_HEVC_Basic`

### Cause: 

The ffmpeg 5 is used to record a piece of video (DRV), the ffmpeg will
transcode the enhanced flv format to TS format, but ffmpeg 5 don't
support enhanced rtmp (or flv) in this case.

The solution is to replace the ffmpeg to version 7 in those 2 test
cases.

### why not upgrade ffmpeg to version 7?

The black tests dependency on ffmpeg 5 will fail, and there are a few of
them are not easy to resolve in ffmpeg 7.

---------

Co-authored-by: winlin <winlinvip@gmail.com>
2025-09-09 21:10:04 -04:00
Winlin
3a29e5c550
AI: Fix naming issue for protocol module. v7.0.83 (#4482)
Co-authored-by: OSSRS-AI <winlinam@gmail.com>
2025-09-09 21:06:45 -04:00
Winlin
8f87d4092b
AI: Fix naming problem in kernel module. v7.0.82 (#4479)
Co-authored-by: OSSRS-AI <winlinam@gmail.com>
2025-09-07 21:09:08 -04:00
Winlin
7c1e87ef5c
AI: Add more utests for kernel module. v7.0.81 (#4478)
This PR significantly enhances the kernel module by adding comprehensive
unit test coverage and improving interface design for core buffer and
load balancer components.

- **ISrsDecoder**: New interface for decoding/deserialization operations
- **ISrsLbRoundRobin**: Extracted interface from concrete
SrsLbRoundRobin class for better abstraction
- **Enhanced Documentation**: Added comprehensive inline documentation
for ISrsEncoder, ISrsCodec, SrsBuffer, and SrsBitBuffer classes

---------

Co-authored-by: OSSRS-AI <winlinam@gmail.com>
2025-09-06 12:39:46 -04:00
Winlin
8976ce4c8d
AI: Support anonymous coroutine with code block. v7.0.80 (#4475)
This PR introduces anonymous coroutine macros for easier coroutine
creation and improves the State Threads (ST) mutex and condition
variable handling in SRS.

- **Added coroutine macros**: `SRS_COROUTINE_GO`, `SRS_COROUTINE_GO2`,
`SRS_COROUTINE_GO_CTX`, `SRS_COROUTINE_GO_CTX2`
- **Added `SrsCoroutineChan`**: Channel for sharing data between
coroutines with coroutine-safe operations
- **Simplified coroutine creation**: Go-like syntax for creating
anonymous coroutines with code blocks

---------

Co-authored-by: Jacob Su <suzp1984@gmail.com>
Co-authored-by: OSSRS-AI <winlinam@gmail.com>
2025-09-06 08:10:49 -04:00
Winlin
8f09c4186e
WebRTC: Fix race condition in RTC nack timer callbacks. v7.0.79 (#4474)
See [WebRTC: Fix race condition in RTC publish timer
callbacks.](421ab6c3fb)
v7.0.76 (https://github.com/ossrs/srs/pull/4470)
2025-09-05 09:58:19 -04:00
why
57e1622e81
WebRTC: Fix NACK recovered packets not being added to receive queue. v7.0.78 (#4467)
Fixes a bug in WebRTC NACK packet recovery mechanism where recovered
packets were being discarded instead of processed.

In `SrsRtcRecvTrack::on_nack()`, when a retransmitted packet arrived
(found in NACK receiver), the method would:
1.  Remove the packet from NACK receiver (correct)
2.  Return early without adding the packet to RTP queue (BUG)

This caused recovered packets to be lost, defeating the purpose of the
NACK mechanism and potentially causing media quality issues.

Restructured the control flow in `on_nack()` to ensure both new and
recovered packets reach the packet insertion logic:

- **Before**: Early return for recovered packets → packets discarded
- **After**: Conditional NACK management + unified packet processing →
all packets queued

Closes #3820

---------

Co-authored-by: Haibo Chen <495810242@qq.com>
Co-authored-by: OSSRS-AI <winlinam@gmail.com>
2025-09-04 08:07:36 -04:00
Winlin
6720e96745
Upgrade HTTP parser from http-parser to llhttp. v7.0.77 (#4469)
This PR modernizes SRS's HTTP handling by upgrading from the legacy
http-parser library to the more performant and actively maintained
llhttp library.

* Replace http-parser with llhttp: Migrated from the deprecated
http-parser to llhttp for better performance and maintenance
* API compatibility: Updated all HTTP parsing logic to use llhttp APIs
while maintaining backward compatibility
* Simplified URL parsing: Replaced complex http-parser URL parsing with
custom simple parser implementation
Enhanced error handling: Improved error reporting with llhttp's better
error context and positioning


---------

Co-authored-by: OSSRS-AI <winlinam@gmail.com>
2025-09-03 20:12:59 -04:00
Winlin
421ab6c3fb
WebRTC: Fix race condition in RTC publish timer callbacks. v7.0.76 (#4470)
WebRTC RTC publish streams use timer callbacks (`SrsRtcPublishRtcpTimer`
and `SrsRtcPublishTwccTimer`) that can cause race conditions in SRS's
coroutine-based architecture. The timer callbacks are heavy functions
that may trigger coroutine switches, during which the timer object can
be freed by another coroutine, leading to use-after-free crashes.

The race condition occurs because:
1. Timer callbacks (`on_timer`) perform heavy operations that can yield
control
2. During coroutine switches, other coroutines may destroy the timer
object
3. When control returns, the callback continues executing on a freed
object

Fixes potential crashes in WebRTC RTC publish streams under high
concurrency.
2025-09-03 19:45:24 -04:00
Winlin
d9fe2c458c AI: GB28181: Remove embedded SIP server and enforce external SIP usage. v7.0.75 (#4466)
This PR removes the embedded GB28181 SIP server implementation from SRS
and enforces the use of external SIP servers for production deployments.

The embedded SIP server depended on the deprecated `http-parser`
library. With the planned migration to `llhttp` (which doesn't support
SIP parsing), maintaining the embedded SIP server would require
significant additional work. Since external SIP servers are already the
recommended approach for production, removing the embedded
implementation simplifies the codebase and eliminates this dependency.

Eliminated `srs_gb28181_test` from CI workflow.

Removed SIP configuration validation tests.

---------

Co-authored-by: OSSRS-AI <winlinam@gmail.com>
Co-authored-by: haibo.chen <495810242@qq.com>
2025-09-02 09:59:40 -04:00