Commit Graph

8668 Commits (55610cf68904e5b90edb7dd810c5d56c63aff915)
 

Author SHA1 Message Date
Winlin 7209b73660
WHIP: Fix bug for converting WHIP to RTMP/HLS. v5.0.208 v6.0.113 (#3920)
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>
1 year ago
Winlin 22c2469414
Upgrade hls.js and set in low latency mode. v6.0.112 (#3924)
HLS typically has a delay of around 30 seconds, roughly comprising three
segments, each lasting 10 seconds. We can reduce the delay to about 5
seconds by lowering the segment duration to 2 seconds and starting
playback from the last segment, achieving a stable delay.

Of course, this requires setting the OBS's GOP to 1 second, and the
profile to baseline, preset to fast, and tune to zerolatency.
Additionally, updating a few configurations in the hls.js player is
necessary, such as setting it to start playback from the last segment,
setting the maximum buffer, and initiating accelerated playback to
reduce latency.

---------

Co-authored-by: chundonglinlin <chundonglinlin@163.com>
Co-authored-by: john <hondaxiao@tencent.com>
1 year ago
Jay 4ca7684e36
RTC: Fix video and audio track pt_ is not change in player before publisher. v5.0.207 v6.0.111 (#3925)
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>
1 year ago
john 77af3dc8c4
Configure: print enabled/disable sanitizer. v5.0.206 v6.0.110 (#3923)
---------

Co-authored-by: chundonglinlin <chundonglinlin@163.com>
1 year ago
winlin d7248bbb0e Update the template for issues. 1 year ago
winlin 2a2da2253f Switch to 2013-2024. v6.0.109 1 year ago
Haibo Chen 8f70206a3b
Enhancing the compatibility of options.sh. v5.0.204 v6.0.108 (#3916)
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>
1 year ago
chundonglinlin 804ef3f98c
Forward: when unpublish crash caused by uninitialized forward connection. v6.0.107 (#3914)
Description
A crash occurs when a forward relay connection has not been established
and an unpublish event is triggered simultaneously. For instance, if DVR
and forward are configured with a specified DVR path that already
exists, initiating a stream will trigger a crash.

Objective
Fix the crash caused by the forward mechanism.

Additional Information
For detailed reproduction steps, please refer to issue #3901.

---------

Co-authored-by: john <hondaxiao@tencent.com>
1 year ago
winlin 360aaaf9e4 Fix version bug. 1 year ago
Winlin 1b99fcbe79
A demo for SRT proxy. (#3869)
See https://www.figma.com/file/kItb5HWOI4HimjDp62pas3/SRT-Proxy
1 year ago
Winlin ad7ddde318
Fix DO droplet link bug. 1 year ago
Laurentiu 2f95f2ae6a
Typo: line 263 - srs_app_srt_conn.cpp. v6.0.106 (#3854)
regards,
laur
---------

Co-authored-by: john <hondaxiao@tencent.com>
Co-authored-by: Haibo Chen <495810242@qq.com>
1 year ago
john 15601b4b2a
RTC: Support OPUS stereo SDP option. v5.0.203 v6.0.105 (#3910)
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`
1 year ago
Haibo Chen 6d56c407c6
Security: Support IP whitelist for HTTP-FLV, HLS, WebRTC, and SRT. v5.0.202 v6.0.104 (#3902)
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>
1 year ago
Haibo Chen 1b34fc4d4e
fix 'sed' error in options.sh. v5.0.201 v6.0.103 (#3891)
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>
1 year ago
john 3e463a8e56
Fix opus delay options, use ffmpeg-opus in docker test. v6.0.102 (#3883)
The `ffmpeg-opus` tool allows you to control the delay using the
`opus_delay` option. The minimum delay can be set to 2.5ms. However, in
practice, you cannot set it this low. You need to set at least 10 frames
to allow the audio encoder to lookahead. Otherwise, the sound will be
distorted.

---------

Co-authored-by: chundonglinlin <chundonglinlin@163.com>
1 year ago
winlin 470a373a68 Release v6.0-d3, 6.0 dev3, v6.0.101, 167560 lines. 1 year ago
Winlin 8865ddd4bb
Change the hls_aof_ratio to 2.1. v5.0.200 v6.0.101 (#3886)
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>
1 year ago
john 24235d8b6a
Fix the test fail when enable ffmpeg-opus. v6.0.100 (#3868)
1. After enabling FFmpeg opus, the transcoding time for each opus packet
is around 4ms.
2. To speed up case execution, our test publisher sends 400 opus packets
at intervals of 1ms.
3. After the publisher starts, wait for 30ms, then the player starts.
4. Due to the lengthy processing time for each opus packet, SRS
continuously receives packets from the publisher, so it doesn't switch
coroutines and can't accept the player's connection.
5. Only after all opus packets are processed will it accept the player
connection. Therefore, the player doesn't receive any data, leading to
the failure of the case.

---------

Co-authored-by: winlin <winlinvip@gmail.com>
1 year ago
Haibo Chen a2324a620a
Support configure with --extra-ldflags. v5.0.199 v6.0.99 (#3879)
1. add --extra-ldflags
2. support  commas in configure file
3. support link system library for utest

```
./configure --extra-ldflags=-Wl,-z,now
```
1 year ago
Haibo Chen 4372e32f72
Don't compile libopus when enable sys-ffmpeg. v5.0.198 v6.0.98 (#3851) 1 year ago
winlin b8734cb462 Disable ffmpeg-opus by default. v6.0.97 1 year ago
chundonglinlin e7b629cd39
RTC: Refine FFmpeg opus audio noisy issue. v5.0.197 v6.0.97 (#3852)
### Description

When converting between AAC and Opus formats (aac2opus or opus2aac), the
`av_frame_get_buffer` API is frequently called.

### Objective

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.

### Additional Note

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>
1 year ago
chundonglinlin 4a100616fc
Support build without cache to test if actions fail. v5.0.196 v6.0.96 (#3858)
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>
1 year ago
winlin 1840476fe0 Update README for v5.0-b6, 5.0 beta6, v5.0.195 1 year ago
john 9238f09b0b
RTC: Fix FFmpeg opus audio noisy issue. v5.0.195 v6.0.95 (#3845)
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>
1 year ago
chundonglinlin 9b07d840ed
WebRTC: TCP transport should use read_fully instead of read. v5.0.194 v6.0.94 (#3847)
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>
1 year ago
winlin 29eff1a242 Refine LICENSE. 1 year ago
winlin 9a6f5f04f5 Refine LICENSE. 1 year ago
Haibo Chen 9183e05ef0
Added system library option for ffmpeg, srtp, srt libraries. v5.0.193 v6.0.93 (#3846)
---------

Co-authored-by: john <hondaxiao@tencent.com>
1 year ago
Winlin 4e7c075559
Disable asan by default. v5.0.192 v6.0.92 (#3840)
---------

Co-authored-by: john <hondaxiao@tencent.com>
1 year ago
Winlin bb94d0ff2f
Support set the ice-ufrag and ice-pwd for connectivity check. v5.0.191 v6.0.91 (#3837)
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>
1 year ago
Winlin a458c9c68d
Refine docker detect mechenism. v5.0.190 v6.0.90 (#3758)
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>
1 year ago
VampireAchao c91e3a36c2
Refactor: Update the badge to SRS. (#3841) 1 year ago
Haibo Chen 0649a6d400
Fix bug for upgrading to OpenSSL 3.0. v5.0.189 v6.0.89 (#3827)
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>
1 year ago
Winlin 40e5962bec
SRT: Fix the missing config mss. v5.0.188 v6.0.88 (#3825)
---------

Co-authored-by: john <hondaxiao@tencent.com>
1 year ago
Winlin a1e4f61dd3
Solve the problem of inaccurate HLS TS duration. v5.0.187 v6.0.87 (#3824)
1. The comment on the ratio configuration says it can affect the slice
duration, but there is no effect after configuring it.
2. The default hls_td_ratio is 1.5, and after setting it to 1, the
duration is still slightly more than 10 seconds.
3. Even if the GOP is an integer, like 1 second, the slice is still a
non-integer, like 0.998 seconds, which seems a bit unreliable.
4. In the duration of the TS in the m3u8 file, it is one frame less than
the duration of the slice.
5. Set hls_dispose to 120s to dispose HLS files when no stream.
6. Use docker.conf for docker.

Before this patch:

```
#EXTINF:10.983, no desc
livestream-0.ts?hls_ctx=3p095hq0
```

After this patch:

```
#EXTINF:10.000, no desc
livestream-0.ts?hls_ctx=3p095hq0
```

Note: If the fragment is set to 10 seconds, but the GOP size cannot be
divided by 10, such as not 1, 2, 5, or 10, then the duration of ts will
still be more than 10 seconds.


---------

Co-authored-by: john <hondaxiao@tencent.com>
1 year ago
Winlin d10e16e335
Use new cache image name. v6.0.86 (#3815)
---------

Co-authored-by: john <hondaxiao@tencent.com>
1 year ago
winlin 411ae5aff7 Update README, use docker by default. 1 year ago
winlin 1f6565ec9b Update contributors. 1 year ago
winlin f4d75543a7 Release v6.0-d2, 6.0 dev2, v6.0.85, 167509 lines. 1 year ago
Haibo Chen ca155a5b58
Turn off the related utests H265 option. v6.0.85 (#3811)
Turn off related unit tests when the H265 option is also turned off.

---------

Co-authored-by: john <hondaxiao@tencent.com>
1 year ago
winlin 42bd4a9fb8 Update the ISSUE TEMPALTE. 1 year ago
Winlin a52080171d
Change dev code for John. v6.0.84 (#3810)
Update dev code for SRS 6.0, see
https://ossrs.io/lts/en-us/product#release-60

---------

Co-authored-by: john <hondaxiao@tencent.com>
1 year ago
terrencetang2023 5b31225d7c
Build: Check __GLIBC__ for OpenHarmony to fix build fail. v6.0.83 (#3777)
When I compile on OpenHarmony, I encounter an error at the
pthread_setname_np function:
```
./src/app/srs_app_threads.cpp:53:10: error: functions that differ only in their return type cannot be overloaded
void pthread_setname_np(pthread_t trd, const char* name) {
/data/local/ohos-sdk/linux/native/llvm/bin/../../sysroot/usr/include/pthread.h:379:5: note: previous declaration is here
int pthread_setname_np(pthread_t, const char *);
```

Our libc is using musl-libc and has no defined __GLIBC__, so we wanted
to add a judgment that __GLIBC__ already defined.
1 year ago
Haibo Chen fbb8c16496
Build: Support sys-ssl for srt. v5.0.184 v6.0.82 (#3806)
support sys-ssl for srt

---------

Co-authored-by: john <hondaxiao@tencent.com>
1 year ago
Haibo Chen c5e067fb0b
Upgrade libsrt to v1.5.3. v5.0.183 v6.0.81 (#3808)
fix https://github.com/ossrs/srs/issues/3155
Build srt-1-fit fails with `standard attributes in middle of
decl-specifiers` on GCC 12,Arch Linux.

See https://github.com/Haivision/srt/releases/tag/v1.5.3
1 year ago
Winlin f9bba0a9b0
WebRTC: Support WHEP for play. v5.0.182 v6.0.80 (#3404)
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 #3581

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

See #3170


---------

Co-authored-by: Haibo Chen <495810242@qq.com>
Co-authored-by: john <hondaxiao@tencent.com>
Co-authored-by: ChenGH <chengh_math@126.com>
1 year ago
john 03d1d91f2f
Prevent the output of srt logs in utest. v5.0.181 v6.0.79 (#3807)
Prevent the output of srt logs in utest.

---------

Co-authored-by: chundonglinlin <chundonglinlin@163.com>
1 year ago
john 8c67889860
SRT: Log level to debug when no socket to accept. v5.0.180 v6.0.78 (#3696) 1 year ago