Commit Graph

448 Commits (f8319d6b6d2eabb73240d24b8e941d3790f1c013)

Author SHA1 Message Date
Haibo Chen 65ad907fe4
GB28181: Support external SIP server. v6.0.144 (#4101)
For #3369 to support an external powerful SIP server, do not use the
embedded SIP server of SRS.
For more information, detailed steps, system architecture, and
background explanation, please see
https://ossrs.net/lts/zh-cn/docs/v6/doc/gb28181#external-sip

---------

Co-authored-by: Jacob Su <suzp1984@gmail.com>
Co-authored-by: winlin <winlinvip@gmail.com>
6 months ago
Jacob Su baf22d01c1
Refine config directive token parsing. v6.0.135 (#4042)
make sure one directive token don't span more than two lines.

try to fix #2228

---------

Co-authored-by: winlin <winlinvip@gmail.com>
7 months ago
Winlin 1f9309ae25
SmartPtr: Support load test for source by srs-bench. v6.0.130 (#4097)
1. Add live benchmark support in srs-bench, which only connects and
disconnects without any media transport, to test source creation and
disposal and verify source memory leaks.
2. SmartPtr: Support cleanup of HTTP-FLV stream. Unregister the HTTP-FLV
handler for the pattern and clean up the objects and resources.
3. Support benchmarking RTMP/SRT with srs-bench by integrating the gosrt
and oryx RTMP libraries.
4. Refine SRT and RTC sources by using a timer to clean up the sources,
following the same strategy as the Live source.

---------

Co-authored-by: Haibo Chen <495810242@qq.com>
Co-authored-by: Jacob Su <suzp1984@gmail.com>
7 months ago
Jacob Su 1656391c67
RTC: Support dropping h.264 SEI from NALUs. v5.0.213 v6.0.125 (#4057)
try to fix #4052.

---------

Co-authored-by: winlin <winlinvip@gmail.com>
8 months ago
winlin 427104f1da Release v5.0-r2, 5.0 release2, v5.0.210, 163515 lines. 10 months ago
Winlin 84b184dd53
System: Disable feature that obtains versions and check features status. v5.0.209 v6.0.115 (#3990)
See https://github.com/ossrs/srs/issues/2424

---------

Co-authored-by: john <hondaxiao@tencent.com>
11 months ago
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 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
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
Mr. Li add0f369c5 Fix RBSP issue, where 0x03 should be removed. v5.0.178 v6.0.75 (#3597)
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>
1 year ago
Winlin aa5ec87fcb
Support HTTP-API for fetching reload result. v5.0.176 v6.0.71 (#3779)
## Reload Error Ignore

During a Reload, several stages will be passed through:
1. Parsing new configurations: Parse.
2. Transforming configurations: Transform.
3. Applying configurations: Apply.

Previously, any error at any stage would result in a direct exit, making
the system completely dependent on configuration checks:

```bash
./objs/srs -c conf/srs.conf -t
echo $?
#0
```

Optimized to: If an error occurs before applying the configuration, it
can be ignored. If an error occurs during the application of the
configuration, some of the configuration may have already taken effect,
leading to unpredictable behavior, so SRS will exit directly.

## Reload Fetch API

Added a new HTTP API to query the result of the reload.

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

```bash
curl http://localhost:1985/api/v1/raw?rpc=reload-fetch
```

```json
{
  "code": 0,
  "data": {
    "err": 0,
    "msg": "Success",
    "state": 0,
    "rid": "0s6y0n9"
  }
}

{
  "code": 0,
  "data": {
    "err": 1023,
    "msg": "code=1023(ConfigInvalid) : parse file : parse buffer containers/conf/srs.release-local.conf : root parse : parse dir : parse include buffer containers/data/config/srs.vhost.conf : read token, line=0, state=0 : line 3: unexpected end of file, expecting ; or \"}\"",
    "state": 1,
    "rid": "0g4z471"
  }
}
```

This way, you can know if the last reload of the system was successful.

---------

Co-authored-by: Haibo Chen <495810242@qq.com>
1 year ago
chundonglinlin 3fa4f66648
WebRTC: Support config the bitrate of transcoding AAC to Opus. v5.0.167, v6.0.60 (#3515)
---------

Co-authored-by: john <hondaxiao@tencent.com>
2 years ago
Haibo Chen 7ba59c3635
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>
2 years ago
Haibo Chen 771ae0a1a6
API: Support HTTP basic authentication for API. v6.0.4, v5.0.152 (#3458)
Co-authored-by: winlin <winlin@vip.126.com>
Co-authored-by: john <hondaxiao@tencent.com>
2 years ago
MarkCao 8fde0366fb
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.

---------

Co-authored-by: winlin <winlin@vip.126.com>
Co-authored-by: chundonglinlin <chundonglinlin@163.com>
2 years ago
chundonglinlin ef90da352e
H265: Support HEVC over SRT.(#465) v6.0.20 (#3366)
* H265: Refine demux vps/sps/pps interface for SRT and GB.
* H265: Support HEVC over SRT.(#465)
* UTest: add hevc vps/sps/pps utest.
* SRT: fix mpegts.js play hevc http-flv error.
* UTest: add HTTP-TS and HTTP-FLV blackbox test.
* Update release v6.0.20

Co-authored-by: Winlin <winlin@vip.126.com>
Co-authored-by: Haibo Chen <495810242@qq.com>
Co-authored-by: john <hondaxiao@tencent.com>
2 years ago
Winlin 498ce72af8 SRS5: Config: Support better env name for prefixed with srs (#3370)
* Actions: Fix github action warnings.

* Forward: Bind the context id of source or stream.

* Config: Support better env names.

PICK a4e7427433

Co-authored-by: pengfei.ma <pengfei.ma@ctechm.com>
Co-authored-by: Haibo Chen <495810242@qq.com>
2 years ago
Winlin f06a2d61f7 SRS5: DVR: Support blackbox test based on hooks. v5.0.132 (#3365)
PICK e655948e96
2 years ago
winlin 4045971dea SRS5: Refine default config file for SRS. v5.0.120
1. Docker use srs.conf and env variables.
2. Show help if run SRS without any options.
3. Do not guess config file, use whatever from user.

PICK 07a9a005d5
2 years ago
winlin d5bf0ba2da TS: Support disable audio or video to make mpegts.js happy. v6.0.9 (#465) (#939) 2 years ago
Winlin a36cb57949
FLV: Support set default has_av and disable guessing. v5.0.110 (#3311)
* FLV: Support set default has_av and disable guessing. v5.0.110

1. Support config default has_audio and has_video.
2. Support disable guessing has_audio or has_video.

* FLV: Reset to false if start to guess has_av.

* FLV: Add regression test for FLV header av metadata.
2 years ago
Winlin 4551200e95
FLV: Drop packet if header flag is not matched. v5.0.109 (#3306)
1. Ignore audo or video packets if FLV header disable it.
2. Run: Add regression test config and run for IDEA.
3. Test: Refine regression test to allow no audio/video for FLV
4. Config: Whether drop packet if not match header.
2 years ago
mapengfei53 c7b7921712
Config: Add utest for configuring with ENV variables. v5.0.100 (#3284)
* Config: Add utest for configuring with ENV variables.

Co-authored-by: pengfei.ma <pengfei.ma@ctechm.com>
Co-authored-by: winlin <winlin@vip.126.com>
2 years ago
Winlin fdbfe59784
Config: Add ENV tips for config. 5.0.97 (#3278) 2 years ago
Winlin 13918ed81f
For #3236: Live: Change gop cache limits to 2500. v5.0.94 (#3273) 2 years ago
stone ec76512e42
Live: Limit cached max frames by gop_cache_max_frames (#3236)
* add gop_cache_max_frames

* Live: Limit cached max frames by gop_cache_max_frames. v5.0.93

Co-authored-by: wanglei <wanglei@unicloud.com>
Co-authored-by: winlin <winlin@vip.126.com>
2 years ago
john 7d9dc69ae1
SRT: Support encrypt, with utest (#3223)
* SRT: support encrypt, with utest

* SRT: refine set srt option error log
2 years ago
Winlin 2d1ba46e37
Fix #3218: Log: Follow Java/log4j log level specs. v5.0.83 (#3219)
1. Support Java/log4j log level text.
2. Support configuring by `--log-new-level=on` which is enabled by default.
3. Support `--log-new-level=off` to use SRS 4.0 log level for compatibility.
2 years ago
winlin 7ddabd2cc2 Config: Remove space of directive. 2 years ago
mapengfei53 dd563d45ca
Config: Support overwrote by environment variables. (#3200)
Co-authored-by: pengfei.ma <pengfei.ma@ctechm.com>
2 years ago
winlin c12deded98 GB28181: Fix bug for parsing GB to RTC. 2 years ago
Winlin 5a420ece3b
GB28181: Support GB28181-2016 protocol. v5.0.74 (#3201)
01. Support GB config as StreamCaster.
02. Support disable GB by --gb28181=off.
03. Add utests for SIP examples.
04. Wireshark plugin to decode TCP/9000 as rtp.rfc4571
05. Support MPEGPS program stream codec.
06. Add utest for PS stream codec.
07. Decode MPEGPS packet stream.
08. Carry RTP and PS packet as helper in PS message.
09. Support recover from error mode.
10. Support process by a pack of PS/TS messages.
11. Add statistic for recovered and msgs dropped.
12. Recover from err position fastly.
13. Define state machine for GB session.
14. Bind context to GB session.
15. Re-invite when media disconnected.
16. Update GitHub actions with GB28181.
17. Support parse CANDIDATE by env or pip.
18. Support mux GB28181 to RTMP.
19. Support regression test by srs-bench.
2 years ago
mapengfei53 eb04f92176
Config: Support overwrote by environment variables. (#3197)
* Support overwrite by environment virable.

* modify duplicated code

* Config: Add stat for envrionment config.

* Config: Fix utest fail.

Co-authored-by: pengfei.ma <pengfei.ma@ctechm.com>
Co-authored-by: winlin <winlin@vip.126.com>
2 years ago
chundonglinlin 9525511032
Exporter: Listen at port 9972 for Prometheus exporter. (#3195) 2 years ago
winlin 173c683566 GB28181: Refine SRS listeners without wrapper. 2 years ago
winlin 5f8da02ee7 API: Refine stat and config for prometheus exporter. 2 years ago
chundonglinlin 981cab40d3
API: support metrics for prometheus.(#2899) (#3189)
* API: support metrics for prometheus.

* Metrics: optimize metrics statistics info.

* Refine: remove redundant code.

* Refine: fix metrics srs_streams param.

* Metrics: add major param.

* Metrics: refine params and metric comments.

* For #2899: API: Support exporter for Prometheus. v5.0.67

Co-authored-by: winlin <winlin@vip.126.com>
2 years ago
winlin d4898bec3c APM: Check endpoint port and team. 2 years ago
winlin 3e2f8622f8 APM: Support distributed tracing by Tencent Cloud APM. v5.0.63 2 years ago
winlin 625069af7f WebRTC: Extract SrsRtcNetwork layer for UDP/TCP. 2 years ago
winlin 770d959148 WebRTC: Support config, listener and SDP for TCP transport. 2 years ago
winlin 38c3d9f1a7 Config: Refine config file, nothing changed. 2 years ago
winlin 84c96076a9 Merge branch '4.0release' into develop 2 years ago
winlin 4a225c5640 For #307: WebRTC: Support use domain name as CANDIDATE. v4.0.259 2 years ago
winlin 783aea7ac3 Fix #1405: Support guessing IBMF first. v5.0.58 2 years ago
winlin e027d28c4d HLS: Support disable hls_ts_ctx. 2 years ago
winlin 7d47017a00 Ingest: Still use -re for stream to ingest HLS better. 2 years ago
winlin 6a108fab6d Fix #2837: Callback: Support stream_url and stream_id. v5.0.55 2 years ago
winlin 457738f6eb Fix #2881: HTTP: Support merging api to server. v5.0.47 2 years ago