Files
srs/.vscode/README.md
OSSRS-AI 6e93dd73b5 AI: WebRTC: Support optional msid attribute per RFC 8830. v7.0.126 (#4570) (#4572)
Fix issue #4570 by supporting optional `msid` attribute in WebRTC SDP
negotiation, enabling compatibility with libdatachannel and other
clients that don't include msid information.

SRS failed to negotiate WebRTC connections from libdatachannel clients
because:
- libdatachannel SDP lacks `a=ssrc:XX msid:stream_id track_id`
attributes
- SRS required msid information to create track descriptions
- According to RFC 8830, the msid attribute and its appdata (track_id)
are **optional**

If diligently look at the SDP generated by libdatachannel:

```
a=ssrc:42 cname:video-send
a=ssrc:43 cname:audio-send
```

It's deliberately missing the `a=ssrc:XX msid:stream_id track_id` line,
comparing that with this one:

```
a=ssrc:42 cname:video-send
a=ssrc:42 msid:stream_id video_track_id
a=ssrc:43 cname:audio-send  
a=ssrc:43 msid:stream_id audio_track_id
```

In such a situation, to keep compatible with libdatachannel, if no msid
line in sdp, SRS comprehensively and consistently uses:

* app/stream as stream_id, such as live/livestream
* type=video|audio, cname, and ssrc as track_id, such as
track-video-video-send-43
2025-11-11 10:22:31 -05:00

102 lines
3.1 KiB
Markdown

# Debug with VSCode
Support run and debug with VSCode.
## macOS: SRS Server
Install the following extensions:
- CMake Tools
- CodeLLDB
- C/C++ Extension Pack
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
cmake -S $HOME/git/srs/trunk/cmake -B $HOME/git/srs/trunk/cmake/build
```
> 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.
> 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.
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
cmake --build $HOME/git/srs/trunk/cmake/build
```
> Note: The `launch.json` is used for running and debugging. The build will output the binary to
> `$HOME/git/srs/trunk/cmake/build/srs`.
## macOS: SRS UTest
The most straightforward way is to select a test name like `WorkflowRtcManuallyVerifyForPublisher`,
then select `Debug gtest (macOS CodeLLDB)` and run the debug.
Or you can use the following way to run specified test from the test panel.
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
cmake -S $HOME/git/srs/trunk/cmake -B $HOME/git/srs/trunk/cmake/build
```
> 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
cmake --build $HOME/git/srs/trunk/cmake/build
```
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`.
## 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
```
## macOS: Proxy
Install the following extensions:
- Go
Open the folder like `~/git/srs` in VSCode.
Click the `View > Run` and select `Launch srs-proxy` to start the proxy server.
Click the `Run > Run Without Debugging` button to start the server.
> Note: The `launch.json` is used for running and debugging.