2024-09-10 16:41:34 +08:00
|
|
|
# Debug with VSCode
|
|
|
|
|
|
|
|
|
|
Support run and debug with VSCode.
|
|
|
|
|
|
2025-05-28 18:38:56 -04:00
|
|
|
## macOS: SRS Server
|
2024-09-10 16:41:34 +08:00
|
|
|
|
|
|
|
|
Install the following extensions:
|
|
|
|
|
|
|
|
|
|
- CMake Tools
|
|
|
|
|
- CodeLLDB
|
|
|
|
|
- C/C++ Extension Pack
|
|
|
|
|
|
2025-05-28 18:38:56 -04:00
|
|
|
Open the folder like `$HOME/git/srs` in VSCode, after you clone srs to
|
|
|
|
|
`$HOME/git/srs` directory.
|
2024-09-10 16:41:34 +08:00
|
|
|
|
2025-05-28 18:38:56 -04:00
|
|
|
Run commmand to configure the project by pressing `Command+Shift+P`, then type `CMake: Configure`
|
|
|
|
|
then select `Clang` as the toolchain. Or run the command manually in terminal:
|
2024-09-10 16:41:34 +08:00
|
|
|
|
2025-05-28 18:38:56 -04:00
|
|
|
```bash
|
2025-10-24 08:38:48 +08:00
|
|
|
cmake -S $HOME/git/srs/trunk/cmake -B $HOME/git/srs/trunk/cmake/build
|
2025-05-28 18:38:56 -04:00
|
|
|
```
|
2024-09-10 16:41:34 +08:00
|
|
|
|
2025-05-28 18:38:56 -04:00
|
|
|
> Note: Sometimes it may fail to configure when building libsrtp. Just retry, and it will succeed.
|
|
|
|
|
|
|
|
|
|
> Note: Make sure you have `xcode` installed, and run `xcode-select --install` to setup the toolchains.
|
|
|
|
|
|
2025-10-24 08:38:48 +08:00
|
|
|
> Note: The `settings.json` is used to configure the cmake. It will use `$HOME/git/srs/trunk/cmake/CMakeLists.txt`
|
|
|
|
|
> and `$HOME/git/srs/trunk/cmake/build` as the source file and build directory.
|
2025-05-28 18:38:56 -04:00
|
|
|
|
|
|
|
|
Click the `Run > Run Without Debugging` or `Run > Start Debugging` from menu to start or
|
|
|
|
|
debug the server. It will invoke the `build` task defined in `tasks.json`, or you can run
|
|
|
|
|
it manually:
|
|
|
|
|
|
|
|
|
|
```bash
|
2025-10-24 08:38:48 +08:00
|
|
|
cmake --build $HOME/git/srs/trunk/cmake/build
|
2025-05-28 18:38:56 -04:00
|
|
|
```
|
2024-09-10 16:41:34 +08:00
|
|
|
|
|
|
|
|
> Note: The `launch.json` is used for running and debugging. The build will output the binary to
|
2025-10-24 08:38:48 +08:00
|
|
|
> `$HOME/git/srs/trunk/cmake/build/srs`.
|
2025-05-28 18:38:56 -04:00
|
|
|
|
|
|
|
|
## macOS: SRS UTest
|
|
|
|
|
|
|
|
|
|
Install the following extensions:
|
|
|
|
|
|
|
|
|
|
- C++ TestMate
|
|
|
|
|
|
|
|
|
|
Open the folder like `$HOME/git/srs` in VSCode, after you clone srs to
|
|
|
|
|
`$HOME/git/srs` directory.
|
|
|
|
|
|
|
|
|
|
Run commmand to configure the project by pressing `Command+Shift+P`, then type `CMake: Configure`
|
|
|
|
|
then select `Clang` as the toolchain. Or run the command manually in terminal:
|
|
|
|
|
|
|
|
|
|
```bash
|
2025-10-24 08:38:48 +08:00
|
|
|
cmake -S $HOME/git/srs/trunk/cmake -B $HOME/git/srs/trunk/cmake/build
|
2025-05-28 18:38:56 -04:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
> Note: Sometimes it may fail to configure when building libsrtp. Just retry, and it will succeed.
|
|
|
|
|
|
|
|
|
|
Afterwards, build the utest by pressing `Command+Shift+P`, then type `CMake: Build` to run the
|
|
|
|
|
build command. It will invoke the `build` task defined in `tasks.json`, or you can run it manually:
|
|
|
|
|
|
|
|
|
|
```bash
|
2025-10-24 08:38:48 +08:00
|
|
|
cmake --build $HOME/git/srs/trunk/cmake/build
|
2025-05-28 18:38:56 -04:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Then you will discover all the unit testcases from the `View > Testing` panel. You can
|
|
|
|
|
open utest source file like `trunk/src/utest/srs_utest.cpp`, then click the `Run Test` or `Debug Test`
|
|
|
|
|
on each testcase such as `FastSampleInt64Test`.
|
2024-09-10 16:41:34 +08:00
|
|
|
|
Fix error about TestRtcPublish_HttpFlvPlay. v7.0.36 (#4363)
In the scenario of converting WebRTC to RTMP, this conversion will not
proceed until an SenderReport is received; for reference, see:
https://github.com/ossrs/srs/pull/2470.
Thus, if HTTP-FLV streaming is attempted before the SR is received, the
FLV Header will contain only audio, devoid of video content.
This error can be resolved by disabling `guess_has_av` in the
configuration file, since we can guarantee that both audio and video are
present in the test cases.
However, in the original regression tests, the
`TestRtcPublish_HttpFlvPlay` test case contains a bug:
https://github.com/ossrs/srs/blob/5a404c089baa93b906d2452ef47e2ba8a9e6211c/trunk/3rdparty/srs-bench/srs/rtc_test.go#L2421-L2424
The test would pass when `hasAudio` is true and `hasVideo` is false,
which is actually incorrect. Therefore, it has been revised so that the
test now only passes if both values are true.
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: winlin <winlinvip@gmail.com>
2025-05-29 23:21:15 +08:00
|
|
|
## macOS: SRS Regression Test
|
|
|
|
|
|
|
|
|
|
Follow the [srs-bench](../trunk/3rdparty/srs-bench/README.md) to setup the environment.
|
|
|
|
|
|
|
|
|
|
Open the test panel by clicking `View > Testing`, run the regression tests under:
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
+ Go
|
|
|
|
|
+ github.com/ossrs/srs-bench
|
|
|
|
|
+ blackbox
|
|
|
|
|
+ gb28181
|
|
|
|
|
+ srs
|
|
|
|
|
```
|
|
|
|
|
|
2025-05-28 18:38:56 -04:00
|
|
|
## macOS: Proxy
|
2024-09-10 16:41:34 +08:00
|
|
|
|
|
|
|
|
Install the following extensions:
|
|
|
|
|
|
|
|
|
|
- Go
|
|
|
|
|
|
|
|
|
|
Open the folder like `~/git/srs` in VSCode.
|
|
|
|
|
|
2025-05-28 18:38:56 -04:00
|
|
|
Click the `View > Run` and select `Launch srs-proxy` to start the proxy server.
|
2024-09-10 16:41:34 +08:00
|
|
|
|
|
|
|
|
Click the `Run > Run Without Debugging` button to start the server.
|
|
|
|
|
|
|
|
|
|
> Note: The `launch.json` is used for running and debugging.
|