Commit Graph

691 Commits (develop)

Author SHA1 Message Date
ChenGH 13597d1b7f
update copyright to 2025. v5.0.218 v6.0.159 v7.0.21 (#4271)
update copyright to 2025

---------

Co-authored-by: john <hondaxiao@tencent.com>
Co-authored-by: winlin <winlinvip@gmail.com>
2 weeks ago
Jacob Su 101382afd0
RTC2RTMP: Fix screen sharing stutter caused by packet loss. v5.0.216 v6.0.157 v7.0.18 (#4160)
## How to reproduce?

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.

## Cause
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.

## Add screen stream to WHIP demo

><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>
4 months ago
Winlin 8f48a0e2d1
ASAN: Support coroutine context switching and stack tracing (#4153)
For coroutine, we should use `__sanitizer_start_switch_fiber` which
similar to`VALGRIND_STACK_REGISTER`, see
https://github.com/google/sanitizers/issues/189#issuecomment-1346243598
for details. If not fix this, asan will output warning:

```
==72269==WARNING: ASan is ignoring requested __asan_handle_no_return: stack type: default top: 0x00016f638000; bottom 0x000106bec000; size: 0x000068a4c000 (1755627520)
False positive error reports may follow
For details see https://github.com/google/sanitizers/issues/189
```

It will cause asan failed to get the stack, see
`research/st/asan-switch.cpp` for example:

```
==71611==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x000103600733 at pc 0x0001009d3d7c bp 0x000100b4bd40 sp 0x000100b4bd38
WRITE of size 1 at 0x000103600733 thread T0
    #0 0x1009d3d78 in foo(void*) asan-switch.cpp:13
```

After fix this issue, it should provide the full stack when crashing:

```
==73437==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x000103300733 at pc 0x000100693d7c bp 0x00016f76f550 sp 0x00016f76f548
WRITE of size 1 at 0x000103300733 thread T0
    #0 0x100693d78 in foo(void*) asan-switch.cpp:13
    #1 0x100693df4 in main asan-switch.cpp:23
    #2 0x195aa20dc  (<unknown module>)
```

For primordial coroutine, if not set the stack by
`st_set_primordial_stack`, then the stack is NULL and asan can't get the
stack tracing. Note that it's optional and only make it fail to display
the stack information, no other errors.

---

Co-authored-by: john <hondaxiao@tencent.com>
5 months ago
Winlin ff6a608099
ST: Replace macros with explicit code for better understanding. v7.0.7 (#4149)
Improvements for ST(State Threads):

1. ST: Use g++ for CXX compiler.
2. ST: Remove macros for clist.
3. ST: Remove macros for global thread and vp.
4. ST: Remove macros for vp queue operations.
5. ST: Remove macros for context switch.
6. ST: Remove macros for setjmp/longjmp.
7. ST: Remove macro for stack pad.
8. ST: Refine macro for valgrind.

---------

Co-authored-by: Jacob Su <suzp1984@gmail.com>
5 months ago
Jacob Su 3e1a4e4439
Player: Fix empty img tag occupy 20px size in safari. v6.0.142 (#4029)
the html img tag occupy 20px size in safari. 

427104f1da/trunk/research/players/rtc_player.html (L19)

> <img width="1011" alt="Screenshot 2024-04-17 at 9 17 07 AM"
src="https://github.com/ossrs/srs/assets/2757043/79a4edf8-5bbf-4300-8817-039088f13283">


(ignore the img css warning: `auto\9;` it's another problem, I will file
another PR.)

but, the empty img tag just occupy 1px size in chrome. So I guess it's a
html compatible problem.

> <img width="608" alt="Screenshot 2024-04-17 at 9 46 33 AM"
src="https://github.com/ossrs/srs/assets/2757043/40cb2eb6-3a6d-4bb7-9b17-51c5fd6d2272">

---------

`TRANS_BY_GPT4`

---------

Co-authored-by: winlin <winlinvip@gmail.com>
6 months ago
Winlin 7ab012c60f
SmartPtr: Support detect memory leak by valgrind. v6.0.132 (#4102)
1. Support detect memory leak by valgrind.
2. Free the http handler entry.
3. Free the stack of ST.

---

Co-authored-by: Jacob Su <suzp1984@gmail.com>
7 months ago
Winlin ff91757a3a
ST: Research adds examples that demos pthread and helloworld. v6.0.118 (#3989)
1. `trunk/research/st/exceptions.cpp` About exceptions with ST, works
well on linux and mac, not work on cygwin.
2. `trunk/research/st/pthreads.cpp` About pthreads with ST, works well
on all platforms.
3. `trunk/research/st/hello.cpp` Hello world, without ST, works well on
all platforms.
4. `trunk/research/st/hello-world.cpp` Hello world, with ST, works well
on all platforms.
5. `trunk/research/st/hello-st.cpp` A very simple version for hello
world with ST, works well on all platforms.
10 months ago
Winlin 26f4ab9923
WebRTC: Add support for A/V only WHEP/WHEP player. v6.0.116 (#3964)
---------

Co-authored-by: john <hondaxiao@tencent.com>
11 months 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
Winlin 1b99fcbe79
A demo for SRT proxy. (#3869)
See https://www.figma.com/file/kItb5HWOI4HimjDp62pas3/SRT-Proxy
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
VampireAchao c91e3a36c2
Refactor: Update the badge to SRS. (#3841) 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
Winlin 6f42ca67cb
Support SRS Stack token for authentication. v6.0.74 (#3794)
When accessing the SRS Stack, you should log in and use a token for each
request, or utilize the HTTP API with a secret Bearer token included in
every request. The SRS Stack HTTP API proxies both /api/v1 and /rtc/v1
to the SRS HTTP API while ensuring secure authentication. Additionally,
there is a console in the SRS Stack that requires the same token to
request the SRS Stack HTTP API, which is then proxied to the SRS HTTP
API.

The SRS Stack runs SRS with the HTTP API listening at 127.0.0.1:1985 on
the local loopback interface, allowing only the SRS Stack to access it
without authentication. All other users must login and access the SRS
Stack through its interface, rather than directly accessing the SRS HTTP
API within the SRS Stack.

---------

Co-authored-by: panda <542638787@qq.com>
1 year ago
panda 30c2f50cae
Upgrade jquery from 1.10.2 to 1.12.2 (#3571)
---------

Co-authored-by: chundonglinlin <chundonglinlin@163.com>
2 years ago
panda 1d878c2daa Fix command injection in api-server for HTTP callback. v5.0.157, v6.0.48 2 years ago
chundonglinlin c0e931ae7a
Replace sprintf with snprintf to eliminate compile warnings. v6.0.45 (#3534)
* Replaced all occurrences of sprintf with snprintf to address deprecation warnings
* Ensured proper buffer size is passed to snprintf to prevent potential buffer overflows
* Ran tests to confirm that the changes do not introduce any new issues or regressions

---------

Co-authored-by: ChenGH <chengh_math@126.com>
2 years ago
Winlin 26aabe413d
RTMP: Support enhanced RTMP specification for HEVC. v6.0.42 (#3495)
* RTMP: Support enhanced RTMP specification for HEVC,  v6.0.42.
* Player: Upgrade mpegts.js to support it.

Enhanced RTMP specification: https://github.com/veovera/enhanced-rtmp

First, start SRS `v6.0.42+` with HTTP-TS support:

```bash
./objs/srs -c conf/http.ts.live.conf
```

Then, you can use [OBS 29.1+](https://github.com/obsproject/obs-studio/releases) to push HEVC via RTMP.
Start OBS with the following settings in the `Settings > Stream` tab:

* Server: `rtmp://localhost/live`
* Stream Key: `livestream`
* Encoder: Please select the HEVC hardware encoder.

Finally, open the player http://localhost:8080/players/srs_player.html?stream=livestream.ts

Or use VLS or ffplay to play `http://localhost:8080/live/livestream.ts`

---------

Co-authored-by: chundonglinlin <chundonglinlin@163.com>
2 years ago
Winlin 363e0c2a6e
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>
2 years ago
Winlin c001acaae9
Support WHIP and WHEP player. v5.0.147 and v6.0.35 (#3460)
Co-authored-by: chundonglinlin <chundonglinlin@163.com>
Co-authored-by: panda <542638787@qq.com>
2 years ago
panda 81566868bf
Rewrite research/api-server code by Go, remove Python. (#3382)
* support api-server golang

* Update release to v6.0.18 and v5.0.137

Co-authored-by: winlin <winlin@vip.126.com>
Co-authored-by: chundonglinlin <chundonglinlin@163.com>
Co-authored-by: ChenGH <chengh_math@126.com>
2 years ago
simon1tan1 dbc8e8ca87 Console: Not needed, just a number is enough for EN. (#3380)
Co-authored-by: Haibo Chen <495810242@qq.com>
2 years ago
winlin 4bfc4de710 SRS5: MP3: Upgrade mpegts.js to support HTTP-TS with mp3. v5.0.126 (#296)
PICK 02a18b328c
2 years ago
winlin ead49e747b MP3: Support play HTTP-MP3 by H5(srs-player). v6.0.7 (#296) (#3338) 2 years ago
Winlin c39edf4788
Player: Support nginx-http-flv-module stream url. (#3305) 2 years ago
john d927996890 DASH: Fix number mode bug to make it run. v5.0.96 (#3240)
* Add utc time utility
* Fix calculate duration in fmp4
* Refine dash code, use segment template timeline
* Shrink m4s file and cleanup
* Support play by dash.js
* Use SegmentTemplate timeline mode with $Number$

Co-authored-by: winlin <winlin@vip.126.com>
2 years ago
Winlin 7e02d972ea
H265: Update mpegts.js to play HEVC over HTTP-TS/FLV. v6.0.1 (#3268)
1. Update mpegts.js to support HEVC over HTTP-TS.
2. Merge https://github.com/xqq/mpegts.js/pull/68 for HEVC over HTTP-FLV.
2 years ago
Winlin 9191217e27
Player: Use xqq/mpegts.js to play HTTP-TS/HTTP-FLV (#3263)
1. Replace flv.js with mpegts.js
2. Use mpegts.js to play HTTP-FLV.
3. Use mpegts.js to play HTTP-TS.
2 years ago
Winlin 59d37abc2b
Player: Use H5 native to play mp4. (#3262) 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
winlin 378bffa34f Micro changes and refines. 2 years ago
winlin 6f7b242ce2 APM: Extract research to projects. 2 years ago
winlin 3e2f8622f8 APM: Support distributed tracing by Tencent Cloud APM. v5.0.63 2 years ago
winlin 1b25ef9028 Merge branch '4.0release' into develop 2 years ago
winlin 686f57799e Fix #3179: WebRTC: Make sure the same m-lines order for offer and answer. v4.0.265 2 years ago
winlin dd37a041b9 Fix URL parsing bug for __defaultVhost__. v5.0.55 2 years ago
winlin 9c6774b644 STAT: Refine tcUrl for SRT/RTC. v5.0.54 2 years ago
winlin d877c0b76f Tools: Update console and httpx. 2 years ago
winlin 18d25eacfb Merge 4.0release 2 years ago
winlin f7280399d4 Merge 4.0release, migrate to new website. 3 years ago
winlin 310514ea94 Update players and console. 3 years ago
winlin 2b2379de12 RTC: Refine player sdk, reject with xhr. 3 years ago
winlin b3baa888ee RTC: Refine player sdk, directly use raw HTTP. 3 years ago
CommanderRoot 8a75e8a165
Replace deprecated String.prototype.substr() (#2948)
String.prototype.substr() is deprecated (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substr) so we replace it with slice() or substring() which work similarily but aren't deprecated.
Signed-off-by: Tobias Speicher <rootcommander@gmail.com>
3 years ago
chundonglinlin 03cf93fc2b
Forward: support config full rtmp url forward to other server (#2799)
* Forward: add backend config and demo server for dynamic create forwarder to other server.(#1342)

* Forward: if call forward backend failed, then return directly.

* Forward: add API description and change return value format.

* Forward: add backend conf file and wrapper function for backend service.

* Forward: add backend comment in full.conf and update forward.backend.conf.

* Forward: rename backend param and add comment tips.
3 years ago
winlin c2b07ad943 Squash: Fix bugs 3 years ago
winlin e27b658ef9 Refine the error for WebRTC H5 publisher. v4.0.239 3 years ago
winlin 32bb96a5c2 Squash: Fix bugs 3 years ago
winlin 1d4fac0dbc Refine docker console, preview by players at the same server. v4.0.236 3 years ago