Commit Graph

8543 Commits (5.0release)
 

Author SHA1 Message Date
john bd333fe7b4 fix typo about heartbeat. v5.0.220 ()
---------

Co-authored-by: Haibo Chen <495810242@qq.com>
Co-authored-by: john <hondaxiao@tencent.com>
Co-authored-by: winlin <winlinvip@gmail.com>

---------

Co-authored-by: john <hondaxiao@tencent.com>
john 5851fa05d2 fix ci error. v5.0.219 ()
Starting January 30th, 2025, GitHub Actions customers will no longer be
able to use v3 of
[actions/upload-artifact](https://github.com/actions/upload-artifact) or
[actions/download-artifact](https://github.com/actions/download-artifact).
Customers should update workflows to begin using [v4 of the artifact
actions](https://github.blog/2024-02-12-get-started-with-v4-of-github-actions-artifacts/).
Learn more:
https://github.blog/changelog/2024-04-16-deprecation-notice-v3-of-the-artifact-actions/

---------

Co-authored-by: john <hondaxiao@tencent.com>
Co-authored-by: winlin <winlinvip@gmail.com>

---------

Co-authored-by: john <hondaxiao@tencent.com>
john 4526a8b781 update copyright to 2025. v5.0.218 ()
update copyright to 2025

---------

Co-authored-by: john <hondaxiao@tencent.com>
Co-authored-by: winlin <winlinvip@gmail.com>
Haibo Chen 65ea140126 HLS: Fix error when stream has extension. v5.0.217 ()
---------

Co-authored-by: Jacob Su <suzp1984@gmail.com>
Co-authored-by: winlin <winlinvip@gmail.com>
Jacob Su b0e7f62ca7 RTC2RTMP: Fix screen sharing stutter caused by packet loss. v5.0.216 ()
1. Refer this commit, which contains the web demo to capture screen as
video stream through RTC.
2. Copy the `trunk/research/players/whip.html` and
`trunk/research/players/js/srs.sdk.js` to replace the `develop` branch
source code.
3. `./configure && make`
4. `./objs/srs -c conf/rtc2rtmp.conf`
5. open `http://localhost:8080/players/whip.html?schema=http`
6. check `Screen` radio option.
7. click `publish`, then check the screen to share.
8. play the rtmp live stream: `rtmp://localhost/live/livestream`
9. check the video stuttering.

When capture screen by the chrome web browser, which send RTP packet
with empty payload frequently, then all the cached RTP packets are
dropped before next key frame arrive in this case.

The OBS screen stream and camera stream do not have such problem.

><img width="581" alt="Screenshot 2024-08-28 at 2 49 46 PM"
src="https://github.com/user-attachments/assets/9557dbd2-c799-4dfd-b336-5bbf2e4f8fb8">

---------

Co-authored-by: winlin <winlinvip@gmail.com>
Winlin bfdbbb9be0 Heartbeat: Report ports for proxy server. v5.0.215 ()
The heartbeat of SRS is a timer that requests an HTTP URL. We can use
this heartbeat to report the necessary information for registering the
backend server with the proxy server.

```text
SRS(backend) --heartbeat---> Proxy server
```

A proxy server is a specialized load balancer for media servers. It
operates at the application level rather than the TCP level. For more
information about the proxy server, see issue .

Note that we will merge this PR into SRS 5.0+, allowing the use of SRS
5.0+ as the backend server, not limited to SRS 7.0. However, the proxy
server is introduced in SRS 7.0.

It's also possible to implement a registration service, allowing you to
use other media servers as backend servers. For example, if you gather
information about an nginx-rtmp server and register it with the proxy
server, the proxy will forward RTMP streams to nginx-rtmp. The backend
server is not limited to SRS.

---------

Co-authored-by: Jacob Su <suzp1984@gmail.com>
Winlin ad0d510ba2 Edge: Improve stability for state and fd closing. v5.0.214 ()
1. Should always stop coroutine before close fd, see , 
2. When edge forwarder coroutine quit, always set the error code.
3. Do not unpublish if invalid state.

---------

Co-authored-by: Jacob Su <suzp1984@gmail.com>
Jacob Su 313913737f RTC: Support dropping h.264 SEI from NALUs. v5.0.213 ()
try to fix .

---------

Co-authored-by: winlin <winlinvip@gmail.com>
Winlin 9995147704 RTMP: Do not response publish start message if hooks fail. v5.0.212 ()
Fix  SRS should not send the publish start message
`onStatus(NetStream.Publish.Start)` if hooks fail, which causes OBS to
repeatedly reconnect.

Note that this fix does not send an RTMP error message when publishing
fails, because neither OBS nor FFmpeg process this specific error
message; they only display a general error.

Apart from the order of messages, nothing else has been changed.
Previously, we sent the publish start message
`onStatus(NetStream.Publish.Start)` before the HTTP hook `on_publish`;
now, we have modified it to send this message after the HTTP hook.
Jacob Su 299a542f10 Support x509 certification chiain in single pem file. v5.0.211 ()
Fix  There is an API `SSL_use_certificate_chain_file`, which can load the
certification chain and also single certificate.

---------

Co-authored-by: winlin <winlinvip@gmail.com>
winlin d9cc57a3f3 Release v5.0-r2, 5.0 release2, v5.0.210, 163515 lines.
Winlin c75c9840d5 Merge pull request from GHSA-gv9r-qcjc-5hj7
* Filter JSONP callback function name. v5.0.210,v6.0.121

* Add utest.

* Refine utest
john ee6a68d24c System: Disable feature that obtains versions and check features status. v5.0.209 ()
See https://github.com/ossrs/srs/issues/2424

---------

Co-authored-by: john <hondaxiao@tencent.com>
winlin f32c8c31c0 Release v5.0-r1, 5.0 release1, v5.0.208, 163441 lines.
john 732569f792 WHIP: Fix bug for converting WHIP to RTMP/HLS. v5.0.208 ()
1. When converting RTC to RTMP, it is necessary to synchronize the audio
and video timestamps. When the synchronization status changes, whether
it is unsynchronized or synchronized, print logs to facilitate
troubleshooting of such issues.
2. Chrome uses the STAP-A packet, which means a single RTP packet
contains SPS/PPS information. OBS WHIP, on the other hand, sends SPS and
PPS in separate RTP packets. Therefore, SPS and PPS are in two
independent RTP packets, and SRS needs to cache these two packets.

---------

Co-authored-by: john <hondaxiao@tencent.com>
john ba150beb0f RTC: Fix video and audio track pt_ is not change in player before publisher. v5.0.207 ()
For WebRTC:
when player before publisher, it will happen track pt didn't change.

 - At source change step, change track pt

---------

Co-authored-by: mingche.tsai <w41203208.work@gmail.com>
Co-authored-by: john <hondaxiao@tencent.com>
john 96a8d17573 Configure: print enabled/disable sanitizer. v5.0.206 ()
---------

Co-authored-by: chundonglinlin <chundonglinlin@163.com>
winlin 55026a4fc7 Release v5.0-r0, 5.0 release0, v5.0.205, 163363 lines.
winlin e15fb07916 Switch to 2013-2024. v5.0.205
Haibo Chen ef5d216dbc Enhancing the compatibility of options.sh. v5.0.204 ()
Accommodate certain complex parameters that include the "=" character,
for example.
`configure --extra-flags="-O2 -D_FORTIFY_SOURCE=2"`

---------

Co-authored-by: john <hondaxiao@tencent.com>
winlin 4aef9bb6af Fix version bug.
john 43d15ed3d8 RTC: Support OPUS stereo SDP option. v5.0.203 ()
In an SDK that supports RTC Opus stereo, the parameter "stereo=1" may
appear. SRS (Spatial Reference System) needs to handle this correctly
and return an answer to enable WebRTC stereo support.

---------

`TRANS_BY_GPT4`
john 52b01b14e9 Security: Support IP whitelist for HTTP-FLV, HLS, WebRTC, and SRT. v5.0.202 ()
Security is the built-in IP whitelist feature of SRS, which allows and
denies certain IP and IP range users. Previously, it only supported
RTMP, but this PR now supports HTTP-FLV, HLS, WebRTC, SRT, and other
protocols.

See https://ossrs.io/lts/en-us/docs/v6/doc/security as example.

---------

Co-authored-by: john <hondaxiao@tencent.com>
john 0808be18ad fix 'sed' error in options.sh. v5.0.201 ()
The `-` character, when placed in the middle of a regular expression, is
interpreted as a range. It must be placed at the beginning or end to be
interpreted as a literal character.

---------

`TRANS_BY_GPT4`

---------

Co-authored-by: john <hondaxiao@tencent.com>
winlin f1b419df4c Release v5.0-b7, 5.0 beta7, v5.0.200, 163305 lines.
Winlin a1901b5213 Change the hls_aof_ratio to 2.1. v5.0.200 ()
In pure audio mode, there are no keyframes. Therefore, we can only rely
on the length of the slice to determine whether it should be output.
`hls_aof_ratio` is the coefficient that, once reached, will generate a
new slice.

In scenarios with video, if the `hls_aof_ratio` is too small, for
example 1.2, and the GOP (Group of Pictures) is 10 seconds, then a slice
will definitely be generated at 12 seconds. At this point, if there are
no keyframes, it will cause the next slice to start with a non-keyframe.

A safer coefficient is twice the GOP (Group of Pictures). This way, it
won't trigger incorrectly and prevent the individual transcoding of a ts
segment file.

---------

Co-authored-by: Haibo Chen <495810242@qq.com>
Haibo Chen 4e4cce867b Support configure with --extra-ldflags. v5.0.199 ()
1. add --extra-ldflags
2. support  commas in configure file
3. support link system library for utest

```
./configure --extra-ldflags=-Wl,-z,now
```
Haibo Chen 316f4641ac Don't compile libopus when enable sys-ffmpeg. v5.0.198 ()
chundonglinlin f1db76011b RTC: Refine FFmpeg opus audio noisy issue. v5.0.197 ()
When converting between AAC and Opus formats (aac2opus or opus2aac), the
`av_frame_get_buffer` API is frequently called.

The goal is to optimize the code logic and reduce the frequent
allocation and deallocation of memory.

In the case of aac2opus, av_frame_get_buffer is still frequently called.
In the case of opus2aac, the goal is to avoid calling
av_frame_get_buffer and reduce memory allocations.

Before calling the `av_audio_fifo_read` API, use
`av_frame_make_writable` to check if the frame is writable. If it is not
writable, create a new frame.

---------

Co-authored-by: john <hondaxiao@tencent.com>
chundonglinlin 35f479c6bc Support build without cache to test if actions fail. v5.0.196 ()
By default, caching is enabled during compilation, which means that data
is cached in Docker. This helps to avoid compiling third-party
dependency libraries. However, sometimes when updating third-party
libraries, it's necessary to disable caching to temporarily verify if
the pipeline can succeed. Therefore, a configure option should be added.
When this option is enabled, the compilation cache will not be used, and
all third-party libraries will be compiled from scratch.

---------

Co-authored-by: winlin <winlinvip@gmail.com>
winlin fb7a000f47 Release v5.0-b6, 5.0 beta6, v5.0.195, 163303 lines.
john 268bac58bd RTC: Fix FFmpeg opus audio noisy issue. v5.0.195 ()
Follow the example in FFmpeg's doc, before calling the API
`avcodec_send_frame`, always use `av_frame_alloc` to create a new frame.

---------

Co-authored-by: Haibo Chen <495810242@qq.com>
chundonglinlin d51cabb4b7 WebRTC: TCP transport should use read_fully instead of read. v5.0.194 ()
SRS supports TCP WebRTC by reading 2 bytes of length, like `read(buf,
2)`. However, in some cases, it might receive 1 byte, causing subsequent
data to be incorrect and making it unable to push or play streams.

---------

Co-authored-by: john <hondaxiao@tencent.com>
john a9223ebe47 Added system library option for ffmpeg, srtp, srt libraries. v5.0.193 ()
---------

Co-authored-by: john <hondaxiao@tencent.com>
john 56a4ca3f7e Disable asan by default. v5.0.192 ()
---------

Co-authored-by: john <hondaxiao@tencent.com>
john ba33bb8f8b Support set the ice-ufrag and ice-pwd for connectivity check. v5.0.191 ()
Checking the HTTPS API or UDP connectivity for WHIP tests can be
difficult. For example, if the UDP port isn't available but the API is
fine, OBS only says it can't connect to the server. It's hard to see the
HTTPS API response or check if the UDP port is available.

This feature lets you set the ice username and password in SRS. You can
then send a STUN request using nc and see the response, making it easier
to check UDP port connectivity.

1. Use curl to test the WHIP API, including ice-frag and ice-pwd
queries.
2. Use nc to send a STUN binding request to test UDP connectivity.
3. If both the API and UDP are working, you should get a STUN response.

---------

Co-authored-by: john <hondaxiao@tencent.com>
john 3da81e4b75 Refine docker detect mechenism. v5.0.190 ()
When using Docker, logs are usually printed to console (stdout and
stderr). However, since Docker detection occurs late, after log
initialization, the default log output may be incorrect. In Docker, logs
may still be written to a file instead of the console as expected.

Additionally, the Dockerfile has been improved with a new environment
variable `SRS_IN_DOCKER=on` to clearly indicate a Docker environment. If
automatic Docker detection fails, the configuration will be read, and
this variable will correctly inform SRS that it's in a Docker
environment.

Lastly, the default configuration values have been improved for Docker
environments. By default, `SRS_LOG_TANK=console` and daemon mode is
disabled.

---------

Co-authored-by: john <hondaxiao@tencent.com>
肖志宏 ef7fe1b186 Fix bug for upgrading to OpenSSL 3.0. v5.0.189 ()
The fix is for the DH_set_length error. As shown in lines 2-5, OpenSSL
3.0 added a check for length, which allowed this issue to be exposed.
```
1 if (dh->params.q == NULL) {
2       /* secret exponent length, must satisfy 2^(l-1) <= p */
3        if (dh->length != 0
4            && dh->length >= BN_num_bits(dh->params.p))
5            goto err;
6        l = dh->length ? dh->length : BN_num_bits(dh->params.p) - 1;
7        if (!BN_priv_rand_ex(priv_key, l, BN_RAND_TOP_ONE,
8                             BN_RAND_BOTTOM_ANY, 0, ctx))
9            goto err;
        ... ...
    }
```

---------

Co-authored-by: john <hondaxiao@tencent.com>
肖志宏 53ebf58583 SRT: Fix the missing config mss. v5.0.188 ()
---------

Co-authored-by: john <hondaxiao@tencent.com>
john 75c9c5a849 Solve the problem of inaccurate HLS TS duration. v5.0.187 ()
肖志宏 8b80566f78 Use new cache image name. v5.0.186
winlin ed0be6c7dc Release v5.0-b5, 5.0 beta5, v5.0.185, 163254 lines.
Haibo Chen 4455065246
Cherry-pick from develop, for srt utest. v5.0.185 ()
Haibo Chen 3ddacdb47b Build: Support sys-ssl for srt. v5.0.184 ()
support sys-ssl for srt

---------

Co-authored-by: john <hondaxiao@tencent.com>
winlin 632d457194 Upgrade libsrt to v1.5.3. v5.0.183 ()
Winlin 389a62ee3a WebRTC: Support WHEP for play. v5.0.182 ()
RFC for WHIP: https://datatracker.ietf.org/doc/draft-ietf-wish-whip/

RFC for WHEP: https://datatracker.ietf.org/doc/draft-murillo-whep/

Please note that SRS 5.0 already had WHIP support. I didn't write a
document about WHIP, because WHIP is not a RFC right now, but there are
clues in
[srs-unity](https://github.com/ossrs/srs-unity#usage-publisher). SRS
WHIP url for publisher:
`http://localhost:1985/rtc/v1/whip/?app=live&stream=livestream`

This PR is for WHEP, the url for player is
`http://localhost:1985/rtc/v1/whep/?app=live&stream=livestream`

PS: There is a great PR for OBS to have WHIP support, see
https://github.com/obsproject/obs-studio/pull/7926 and 

PS: WHIP for FFmpeg https://github.com/ossrs/ffmpeg-webrtc/pull/1

See 

---------

Co-authored-by: Haibo Chen <495810242@qq.com>
Co-authored-by: john <hondaxiao@tencent.com>
Co-authored-by: ChenGH <chengh_math@126.com>
john 456f5d64a9 Prevent the output of srt logs in utest. v5.0.181 ()
Prevent the output of srt logs in utest.

---------

Co-authored-by: chundonglinlin <chundonglinlin@163.com>
john 21ae618c48 SRT: Log level to debug when no socket to accept. v5.0.180 ()
Winlin bc0a516fd1 Support FFmpeg timecode, fix AMF0 parsing failed. v5.0.179 ()
Please see https://github.com/ossrs/srs/issues/3803 for detail:

1. When using FFmpeg with the `-map 0` option, there may be a 4-byte
timecode in the AMF0 Data.
2. SRS should be able to handle this packet without causing a parsing
error, as it's generally expected to be an AMF0 string, not a 4-byte
timecode.
3. Disregard the timecode since SRS doesn't utilize it.

See [Error submitting a packet to the muxer: Broken pipe, Error muxing a
packet](https://trac.ffmpeg.org/ticket/10565)

---------

Co-authored-by: john <hondaxiao@tencent.com>
Mr. Li b352fd0cfe Fix RBSP issue, where 0x03 should be removed. v5.0.178 ()
ISO_IEC_14496-10-AVC-2012.pdf, page 65
7.4.1.1 Encapsulation of an SODB within an RBSP (informative)

... 00 00 03 xx, the 03 byte should be drop where xx represents any 2
bit pattern: 00, 01, 10, or 11.

---------

Co-authored-by: john <hondaxiao@tencent.com>
Co-authored-by: chundonglinlin <chundonglinlin@163.com>
Co-authored-by: winlin <winlin@vip.126.com>