Commit Graph

29 Commits (f76be5fe9b0b0d5a32080abb2e9363cd90acd30a)

Author SHA1 Message Date
Winlin 23d2602c34
UniquePtr: Support SrsUniquePtr to replace SrsAutoFree. v6.0.136 (#4109)
To manage an object:

```cpp
// Before
MyClass* ptr = new MyClass();
SrsAutoFree(MyClass, ptr);
ptr->do_something();

// Now
SrsUniquePtr<MyClass> ptr(new MyClass());
ptr->do_something();
```

To manage an array of objects:

```cpp
// Before
char* ptr = new char[10];
SrsAutoFreeA(char, ptr);
ptr[0] = 0xf;

// Now
SrsUniquePtr<char[]> ptr(new char[10]);
ptr[0] = 0xf;
```

In fact, SrsUniquePtr is a limited subset of SrsAutoFree, mainly
managing pointers and arrays. SrsUniquePtr is better than SrsAutoFree
because it has the same API to standard unique ptr.

```cpp
SrsUniquePtr<MyClass> ptr(new MyClass());
ptr->do_something();
MyClass* p = ptr.get();
```

SrsAutoFree actually uses a pointer to a pointer, so it can be set to
NULL, allowing the pointer's value to be changed later (this usage is
different from SrsUniquePtr).

```cpp
// OK to free ptr correctly.
MyClass* ptr;
SrsAutoFree(MyClass, ptr);
ptr = new MyClass();

// Crash because ptr is an invalid pointer.
MyClass* ptr;
SrsUniquePtr<MyClass> ptr(ptr);
ptr = new MyClass();
```

Additionally, SrsAutoFreeH can use specific release functions, which
SrsUniquePtr does not support.

---------

Co-authored-by: Jacob Su <suzp1984@gmail.com>
7 months 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
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
winlin 5999e446de Merge branch v5.0.103 into develop
1. GB28181: Enable GB for CentOS 7 package. v5.0.103
2. Package script support extra options. v5.0.102
3. Disable CLS and APM by default. v5.0.101
2 years ago
winlin e86e0c8999 Disable CLS and APM by default. v5.0.101 2 years ago
winlin 8debbe6db8 Asan: Fix utest bug. 2 years ago
winlin f10412d289 Asan: Fix utest bug. 2 years ago
Winlin f316e9a0de
H265: Support parse multiple NALUs in a frame. v6.0.3 (#3274)
1. Fix parsing multiple NALUs bug.
2. Eliminate duplicated code for parsing NALU.
3. Return error when HEVC not enabled.
2 years ago
winlin 02d47c5c21 Docs: Update features with version. 2 years ago
Winlin 178e40a5fc
H265: Support HEVC over RTMP or HTTP-FLV. (#3272)
1. Support configure with --h265=on.
2. Parse HEVC(H.265) from FLV or RTMP packet.
3. Support HEVC over RTMP or HTTP-FLV.

Co-authored-by: runner365 <shi.weibd@hotmail.com>
2 years ago
winlin e10fa6dc91 Kernel: Support grab backtrace stack when assert fail. v5.0.80 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 0a025fc4b6 Remove unneccessary depends headers. 3 years ago
winlin f7280399d4 Merge 4.0release, migrate to new website. 3 years ago
winlin d88fd12c26 SRT: Fix cmake bug, quit if error. 3 years ago
winlin cf4fbb887b SRT: Support debugging with CLion. 3 years ago
Winlin 350c05c589
UTest: Upgrade gtest to 1.11 and support clion. (#2970) 3 years ago
winlin c5cc79ee6f SRT: Support debug and run with CLion. v4.0.249 3 years ago
qingfuliao 60ab81a5c7 IDE: Fix build problem caused by ffmpeg/pthread dependency. (#2579) 3 years ago
winlin 169f08bae1 [IDE] We should always configure SRS for switching between branches. 4 years ago
winlin 2e222d369d [IDE] Refine CMakeLists.txt, use absolute path 4 years ago
winlin c209e547a8 [IDE] Support CLion and cmake to build and debug SRS. 4.0.141
1. Remove all except JetBrains clion by cmake
2. Add .run/srs.run.xml for debugging for CLion.
3. Auto configure SRS when load CMakeLists.txt
4 years ago
ghostsf d3e153e504
fix: update CMakeLists.txt for rtc (#2042) 4 years ago
yanghuiwen 2911c814c4 更新CMakeLists.txt文件,使项目能在clion编译通过 5 years ago
winlin 1ffd5fd455 rename org simple-rtmp-server to ossrs 9 years ago
winlin 115daa3cc1 migarate from winlinvip to srs org 10 years ago
winlin d22e4e86d8 update projects for rtmp renamed to protocol 10 years ago
winlin 31efea4f33 rename srs cmake ide to jetbrains clion 10 years ago