1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-02-12 11:21:52 +00:00
Commit graph

8540 commits

Author SHA1 Message Date
Jacob Su
cbb5edcc3c SrsContextId assignment can be improved without create a duplicated one. v5.0.175 (#3503)
SrsContextId object creation can be improved on `srs_protocol_log.cpp`,
No need to create one, then assign it back. It seems a common mistake
for Cpp programmers.

---------

Co-authored-by: john <hondaxiao@tencent.com>
2023-08-28 15:55:54 +08:00
Winlin
8d6b882034 HLS: Fix on_hls and hls_dispose critical zone issue. v5.0.174 (#3781)
on_hls and hls_dispose are two coroutines, with potential race
conditions. That is, during on_hls, if the API Server being accessed is
slower, it will switch to the hls_dispose coroutine to start cleaning
up. However, when the API Server is processing the slice, a situation
may occur where the slice does not exist, resulting in the following
log:

```
[2023-08-22 12:03:20.309][WARN][40][x5l48q7b][11] ignore task failed code=4005(HttpStatus)(Invalid HTTP status code) : callback on_hls http://localhost:2024/terraform/v1/hooks/srs/hls : http: post http://localhost:2024/terraform/v1/hooks/srs/hls with {"server_id":"vid-5d7dxn8","service_id":"cu153o7g","action":"on_hls","client_id":"x5l48q7b","ip":"172.17.0.1","vhost":"__defaultVhost__","app":"live","tcUrl":"srt://172.17.0.2/live","stream":"stream-44572-2739617660809856576","param":"secret=1ed8e0ffbc53439c8fc8da30ab8c19f0","duration":4.57,"cwd":"/usr/local/srs-stack/platform","file":"./objs/nginx/html/live/stream-44572-2739617660809856576-1.ts","url":"live/stream-44572-2739617660809856576-1.ts","m3u8":"./objs/nginx/html/live/stream-44572-2739617660809856576.m3u8","m3u8_url":"live/stream-44572-2739617660809856576.m3u8","seq_no":1,"stream_url":"/live/stream-44572-2739617660809856576","stream_id":"vid-0n9zoz3"}, status=500, res=invalid ts file ./objs/nginx/html/live/stream-44572-2739617660809856576-1.ts: stat ./objs/nginx/html/live/stream-44572-2739617660809856576-1.ts: no such file or directory
thread [40][x5l48q7b]: call() [./src/app/srs_app_hls.cpp:122][errno=11]
thread [40][x5l48q7b]: on_hls() [./src/app/srs_app_http_hooks.cpp:401][errno=11]
thread [40][x5l48q7b]: do_post() [./src/app/srs_app_http_hooks.cpp:638][errno=11]

[error] 2023/08/22 12:03:20.076984 [52][1001] Serve /terraform/v1/hooks/srs/hls failed, err is stat ./objs/nginx/html/live/stream-44572-2739617660809856576-1.ts: no such file or directory
invalid ts file ./objs/nginx/html/live/stream-44572-2739617660809856576-1.ts
main.handleOnHls.func1.1
	/g/platform/srs-hooks.go:684
main.handleOnHls.func1
	/g/platform/srs-hooks.go:720
net/http.HandlerFunc.ServeHTTP
	/usr/local/go/src/net/http/server.go:2084
net/http.(*ServeMux).ServeHTTP
	/usr/local/go/src/net/http/server.go:2462
net/http.serverHandler.ServeHTTP
	/usr/local/go/src/net/http/server.go:2916
net/http.(*conn).serve
	/usr/local/go/src/net/http/server.go:1966
runtime.goexit
	/usr/local/go/src/runtime/asm_amd64.s:1571
```

Similarly, when stopping the stream, on_hls will also be called to
handle the last slice. If the API Server is slower at this time, it will
enter hls_dispose and call unpublish repeatedly. Since the previous
unpublish is still blocked in on_hls, the following interference log
will appear:

```
[2023-08-22 12:03:18.748][INFO][40][6498088c] hls cycle to dispose hls /live/stream-44572-2739617660809856576, timeout=10000000ms
[2023-08-22 12:03:18.752][WARN][40][6498088c][115] flush audio ignored, for segment is not open.
[2023-08-22 12:03:18.752][WARN][40][6498088c][115] ignore the segment close, for segment is not open.
```

Although this log will not cause problems, it can interfere with
judgment.

The solution is to add an 'unpublishing' status. If it is in the
'unpublishing' status, then do not clean up the slices.

---------

Co-authored-by: Haibo Chen <495810242@qq.com>
2023-08-28 11:43:14 +08:00
Winlin
fdcff383ae Support include empty config file. v5.0.173 (#3768)
SRS supports including another configuration in the include package.
When generating configurations, we can only generate the changed
configurations, while the unchanged configurations are in the fixed
files, for example:

```nginx
listen 1935;
include server.conf;
```

In `server.conf`, we can manage the changing configurations with the
program:

```nginx
http_api { enabled on; }
```

However, during system initialization, we often create an empty
`server.conf`, and the content is generated only after the program
starts, so `server.conf` might be an empty file. This also makes it
convenient to use a script to confirm the existence of this file:

```bash
touch server.conf
```

Currently, SRS does not support empty configurations and will report an
error. This PR is to solve this problem, making it more convenient to
use include.

`TRANS_BY_GPT4`

---------

Co-authored-by: Haibo Chen <495810242@qq.com>
2023-08-28 10:58:37 +08:00
Winlin
20f238eb9a HLS: Support reload HLS asynchronously. v5.0.172 (#3782)
When reloading HLS, it directly operates unpublish and publish. At this
time, if HLS is pushed, an exception may occur.

The reason is that these two coroutines operated on the HLS object at
the same time, causing a null pointer.

Solution: Use asynchronous reload. During reload, only set variables and
let the message processing coroutine implement the reload.

---------

Co-authored-by: Haibo Chen <495810242@qq.com>
Co-authored-by: chundonglinlin <chundonglinlin@163.com>
2023-08-25 09:44:56 +08:00
terrencetang2023
df8c028054 Bugfix: Log format output type does not match. v5.0.171 (#3775)
A segmentation fault occurred on arm
https://github.com/ossrs/srs/issues/3714

---------

Co-authored-by: Haibo Chen <495810242@qq.com>
2023-08-22 09:39:47 +08:00
winlin
94a53431ff Update latest release to SRS 5.0 2023-08-02 15:01:09 +08:00
winlin
c3d265c07c Release v5.0-b3, 5.0 beta3, v5.0.170, 162704 lines. 2023-08-02 11:04:49 +08:00
winlin
939f6b484b HLS: Ignore empty NALU to avoid error. v5.0.170 2023-08-02 11:02:22 +08:00
Mr. Li
08147f81bf Bugfix: Eliminate the redundant declaration of the _srs_rtc_manager variable. v5.0.169 (#3699)
It is advised to eliminate any instances of _srs_rtc_manager that occur
multiple times.

---------

Co-authored-by: john <hondaxiao@tencent.com>
Co-authored-by: chundonglinlin <chundonglinlin@163.com>
2023-07-26 20:17:23 +08:00
john
c7851da464 API: Fix HTTPS callback issue using SNI in TLS client handshake. v5.0.168 (#3695)
---------

Co-authored-by: chundonglinlin <chundonglinlin@163.com>
2023-07-21 12:33:01 +08:00
chundonglinlin
e11b93d664 WebRTC: Support config the bitrate of transcoding AAC to Opus. v5.0.167, v6.0.60 (#3515)
---------

Co-authored-by: john <hondaxiao@tencent.com>
2023-07-18 11:11:49 +08:00
winlin
497ea2bc90 For #2508, Add platform information. 2023-07-11 07:01:31 +08:00
winlin
f61fd18f5e Fix release note issue. 2023-07-10 10:35:00 +08:00
winlin
4811dd76f8 Release v5.0-b2, 5.0 beta2, v5.0.166, 162520 lines. 2023-07-10 08:22:48 +08:00
chundonglinlin
29271a46d3 Compile: Fix typo for 3rdparty. v5.0.166, v6.0.59 (#3615)
---------

Co-authored-by: john <hondaxiao@tencent.com>
2023-07-10 08:22:34 +08:00
winlin
c6eddc72e9 Fix issue of srs-player failing to play HTTP-FLV. v5.0.165 2023-07-09 17:54:51 +08:00
winlin
cbcc41c156 Add new docker tag x.y.z for helm. 2023-07-02 17:19:27 +08:00
Winlin
6d679fd0e3 WHIP: Improve WHIP deletion by token verification. v5.0.164, v6.0.58 (#3595)
------

Co-authored-by: chundonglinlin <chundonglinlin@163.com>
2023-07-01 19:10:09 +08:00
wangzhen
17f0d1fefc BugFix: Resolve the problem of srs_error_t memory leak. v5.0.163, v6.0.57 (#3605)
---------

Co-authored-by: Haibo Chen <495810242@qq.com>
Co-authored-by: chundonglinlin <chundonglinlin@163.com>
2023-07-01 18:50:45 +08:00
Haibo Chen
3955d3fe55 Improve the usage of "transcode" in the "full.conf" file. v5.0.162, v6.0.56 (#3596)
---------

Co-authored-by: chundonglinlin <chundonglinlin@163.com>
Co-authored-by: john <hondaxiao@tencent.com>
2023-06-30 07:16:27 +08:00
panda
3a14bb4620 Upgrade jquery from 1.10.2 to 1.12.2 (#3571)
---------

Co-authored-by: chundonglinlin <chundonglinlin@163.com>
2023-06-30 06:29:50 +08:00
Winlin
883ef7513b Switch to 5.0 document, because it's beta now. (#3609)
------

Co-authored-by: john <hondaxiao@tencent.com>
2023-06-30 06:06:33 +08:00
Kazuo
596270feff H264: Fix H.264 ISOM reserved bit value. v5.0.161, v6.0.55 (#3551)
---------

Co-authored-by: chundonglinlin <chundonglinlin@163.com>
2023-06-22 06:37:43 +08:00
Haibo Chen
fbccdb92b7 Fix Permission Issue in depend.sh for OpenSSL Compilation. v5.0.160, v6.0.53 (#3592)
---------

Co-authored-by: john <hondaxiao@tencent.com>
2023-06-20 15:32:38 +08:00
john
ca46185ace Fix crash when process rtcp feedback message. v5.0.159, v6.0.52 (#3591)
---------

Co-authored-by: johzzy <hellojinqiang@gmail.com>
2023-06-20 13:21:42 +08:00
Winlin
5759025e43 WHIP: Add OBS support, ensuring compatibility with a unique SDP. v5.0.158, v6.0.51 (#3581)
1. Ignore SDP GROUP LS.
2. Support ice in global session info.
3. Support audio codec "OPUS" or "opus".

---------

Co-authored-by: Johnny <hellojinqiang@gmail.com>
2023-06-15 12:13:10 +08:00
winlin
1713a542ed Release v5.0-b1, 5.0 beta1, v5.0.157, 162494 lines. 2023-06-11 08:22:45 +08:00
panda
1e43bb6b9f Fix command injection in api-server for HTTP callback. v5.0.157, v6.0.48 2023-06-05 16:41:19 +08:00
Winlin
1545425e06 TEST: Upgrade pion to v3.2.9. (#3567)
------

Co-authored-by: chundonglinlin <chundonglinlin@163.com>
2023-06-05 11:43:41 +08:00
Winlin
900c4cdd97 DTLS: Use bio callback to get fragment packet. v5.0.156, v6.0.47 (#3565)
1. The MTU is effective, with the certificate being split into two DTLS records to comply with the limit.
2. The issue occurs when using BIO_get_mem_data, which retrieves all DTLS packets in a single call, even though each is smaller than the MTU.
3. An alternative callback is available for using BIO_new with BIO_s_mem.
4. Improvements to the MTU setting were made, including adding the DTLS_set_link_mtu function and removing the SSL_set_max_send_fragment function.
5. The handshake process was refined, calling SSL_do_handshake only after ICE completion, and using SSL_read to handle handshake messages.
6. The session close code was improved to enable immediate closure upon receiving an SSL CloseNotify or fatal message.

------

Co-authored-by: chundonglinlin <chundonglinlin@163.com>
2023-06-05 10:54:57 +08:00
chundonglinlin
79fd66d8e6 SSL: Fix SSL_get_error get the error of other coroutine. v5.0.156, v6.0.46 (#3513)
---------

Co-authored-by: john <hondaxiao@tencent.com>
Co-authored-by: winlin <winlin@vip.126.com>
2023-05-29 13:03:59 +08:00
winlin
9ffbefac1c Update release workflow and remove unnecessary scripts
1. Updated the release workflow for GitHub action.
2. Removed the script that updates the lh.ossrs.net and d.ossrs.net.
3. Only kept a demo script for updating r.ossrs.net.

Please note that this code has not been tested yet, but it is expected to work. The changes will be triggered in the next release.
2023-05-14 17:39:39 +08:00
winlin
6e77653cdc Release v5.0-b0, 5.0 beta0, v5.0.155, 162600 lines. 2023-05-14 13:07:56 +08:00
winlin
261bebcad1 Support the publishing of RTP plaintext packets using WHIP. v5.0.155 2023-05-14 12:50:35 +08:00
ChenGH
a570169a27 asan: Fix memory leak in asan by releasing global IPs when run_directly_or_daemon fails. v5.0.154, v6.0.44 (#3541)
- Resolved a memory leak issue in asan when run_directly_or_daemon fails
- Previously, global IP lists were not freed, causing asan to report memory leaks
- Updated the code to always free global IP lists, regardless of whether run_directly_or_daemon fails or succeeds

---------

Co-authored-by: chundonglinlin <chundonglinlin@163.com>
2023-05-14 12:25:48 +08:00
winlin
33db1584bf WHIP: Improve HTTP DELETE for notifying server unpublish event. v5.0.153 2023-05-12 15:27:03 +08:00
Winlin
d1e770c4e5 WHIP: Improve HTTP DELETE for notifying server unpublish event (#3539)
This PR improves the functionality of the HTTP DELETE method used by WHIP to notify the server when the client stops publishing. The URL is parsed from the location header returned by SRS, and the URL is refined with the addition of the action=delete parameter to ensure more accurate identification of the DELETE request.

Furthermore, SRS will disconnect and close the session, enabling the client to publish the stream again quickly and easily. This update eliminates the approximately 30-second waiting period previously required for republishing the stream after an unpublish event.

Overall, this update provides a more effective and efficient method for notifying the server about unpublish events and will enhance the workflow experience for users of the WHIP platform.

-------

Co-authored-by: Haibo Chen <495810242@qq.com>
Co-authored-by: ChenGH <chengh_math@126.com>
2023-05-12 15:25:26 +08:00
Haibo Chen
12f3a31175 API: Support HTTP basic authentication for API. v6.0.4, v5.0.152 (#3458)
PICK 771ae0a1a6

Co-authored-by: winlin <winlin@vip.126.com>
Co-authored-by: john <hondaxiao@tencent.com>
2023-04-01 12:48:33 +08:00
chundonglinlin
41decbae95 WebRTC: Error message carries the SDP when failed. v5.0.151, v6.0.39 (#3450)
PICK 571043ff3d

Co-authored-by: winlin <winlin@vip.126.com>
Co-authored-by: ChenGH <chengh_math@126.com>
2023-03-27 22:28:34 +08:00
Winlin
fdaab863dc WebRTC: Support configure CANDIDATE by env (#3470)
In dockerfile, we can set the default RTC candidate to env:

```
ENV SRS_RTC_SERVER_CANDIDATE=\$CANDIDATE
CMD ["./objs/srs", "-e"]
```

When starts a docker container, user can setup the candidate by env:

```
docker run --rm -it --env CANDIDATE=1.2.3.4 ossrs/srs:5
```

We should parse the content of SRS_RTC_SERVER_CANDIDATE as env variable name and parse it again.

PICK b34255c3d0

---------

Co-authored-by: chundonglinlin <chundonglinlin@163.com>
Co-authored-by: pengfei.ma <pengfei.ma@ctechm.com>
2023-03-27 19:25:20 +08:00
yashwardhan-jyani
6b2c6b3274 Remove unneccessary NULL check in srs_freep. v5.0.150, v6.0.38 (#3477)
PICK b574ad1a07

Co-authored-by: winlin <winlin@vip.126.com>
Co-authored-by: john <hondaxiao@tencent.com>
2023-03-25 12:10:17 +08:00
john
cd19667a34 RTC: Call on_play before create session, for it might be freed for timeout. v5.0.149, v6.0.37 (#3455)
PICK d8755711c1

Co-authored-by: winlin <winlin@vip.126.com>
Co-authored-by: ChenGH <chengh_math@126.com>
2023-03-25 11:45:59 +08:00
winlin
cdc65be447 Fix release workflow bug. 2023-03-23 13:58:58 +08:00
winlin
55fbee3304 Release v5.0-a5, 5.0 alpha5, v5.0.148, 162066 lines. 2023-03-23 10:35:01 +08:00
Winlin
5cc794b22d WHIP: Support DELETE resource for Larix Broadcaster. v5.0.148 v6.0.36 (#3427)
* WHIP: Support DELETE resource.
* Support push by Larix.
* FLV: Disable stash buffer for realtime.
* WHEP: Fix muted issue.

-------

Co-authored-by: chundonglinlin <chundonglinlin@163.com>
Co-authored-by: panda <542638787@qq.com>
2023-03-23 10:22:00 +08:00
Winlin
dfef94411f Support WHIP and WHEP player. v5.0.147 and v6.0.35 (#3460)
PICK c001acaae9

Co-authored-by: chundonglinlin <chundonglinlin@163.com>
Co-authored-by: panda <542638787@qq.com>
2023-03-21 08:51:42 +08:00
chundonglinlin
2f1d0ccd34 HttpConn: judge nb_chunk no memory address. (#3465)
Co-authored-by: john <hondaxiao@tencent.com>
2023-03-20 14:22:28 +08:00
Winlin
34c78a74fe WebRTC: Warning if no ideal profile. v6.0.33, v5.0.146 (#3446)
For WebRTC, SRS expect the h.264 codec is:

```
a=rtpmap:106 H264/90000
a=fmtp:106 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f
```

But sometimes, the device does not support the profile, for example only bellow:

```
a=fmtp:123 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e033
a=fmtp:122 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=420033
a=fmtp:121 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=640033
a=fmtp:120 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=4d0033
```

So we should warning user about the profile missmatch, because it might not work.

PICK a7514484a2

----------

Co-authored-by: chundonglinlin <chundonglinlin@163.com>
Co-authored-by: LiPeng <lipeng19811218@gmail.com>
2023-03-07 20:02:05 +08:00
Winlin
47aa42f1e2 Support configure for generic linux. v5.0.145, v6.0.32 (#3445)
If your OS is not CentOS, Ubuntu, macOS, cygwin64, run of configure will fail with:

```
Your OS Linux is not supported.
```

For other linux systems, we should support an option:

```
./configure --generic-linux=on
```

Please note that you might still fail for other issues while configuring or building.

PICK b31940a15a

-------

Co-authored-by: chundonglinlin <chundonglinlin@163.com>
Co-authored-by: ChenGH <chengh_math@126.com>
2023-03-07 19:12:06 +08:00
MarkCao
36a72282e6 Kickoff publisher when stream is idle, which means no players. v6.0.31, v5.0.144 (#3105)
For some use scenario, the publisher is invited when player want to view the stream:

1. Publisher connect to system, but does not publish any stream to SRS yet.
2. Player connect to system and start to request the stream.
3. System notifies publisher to publish stream to SRS.
4. Player play the stream from SRS.

Please notice that `system` means your business system, not SRS.

This is what we called `on-demand-live-streaming`, so when the last player stop to view the stream, what happends?

1. System needs to notify publisher to stop publish.
2. Or, SRS disconnect the publisher when idle(the last player stops playing).

This PR is for the solution 2, so that the cleanup is very simple, your system does not need to notify publisher to stop publish, because SRS has already disconnected the publihser.

PICK 8fde0366fb

---------

Co-authored-by: winlin <winlin@vip.126.com>
Co-authored-by: chundonglinlin <chundonglinlin@163.com>
2023-03-06 09:13:39 +08:00