### Install and Start Frontend Example Source: https://github.com/versatica/mediasoup/blob/v3/rust/examples-frontend/readme.md Install npm dependencies and start the client-side application for the mediasoup Rust frontend examples. ```bash npm install npm start ``` -------------------------------- ### Install clang-tidy on Linux Source: https://github.com/versatica/mediasoup/blob/v3/doc/Building.md Installs a specific version of clang-tidy required for mediasoup development on Linux using apt-get. ```bash apt-get install clang-tidy-VERSION ``` -------------------------------- ### Install clang-format on Linux Source: https://github.com/versatica/mediasoup/blob/v3/doc/Building.md Installs a specific version of clang-format required for mediasoup development on Linux using apt-get. ```bash apt-get install clang-format-VERSION ``` -------------------------------- ### Install clang-format on macOS Source: https://github.com/versatica/mediasoup/blob/v3/doc/Building.md Installs a specific version of clang-format required for mediasoup development on macOS using Homebrew. ```bash brew install clang-format@VERSION ``` -------------------------------- ### Install clang-tidy on macOS Source: https://github.com/versatica/mediasoup/blob/v3/doc/Building.md Installs a specific version of clang-tidy required for mediasoup development on macOS using Homebrew. ```bash brew install clang-tidy@VERSION ``` -------------------------------- ### Install npm dependencies for worker scripts Source: https://github.com/versatica/mediasoup/blob/v3/doc/Building.md Before running certain Invoke tasks, ensure that the npm dependencies for the worker scripts are installed. This command installs them in the specified prefix. ```bash npm ci --prefix worker/scripts ``` -------------------------------- ### Update Subproject Wrap File and Reconfigure Source: https://github.com/versatica/mediasoup/blob/v3/doc/Building.md Updates the wrap file for a subproject and then reconfigures the setup. Ensure you are in the 'worker' directory before running. ```bash cd worker invoke update-wrap-file openssl MESON_ARGS="--reconfigure" invoke setup ``` -------------------------------- ### TypeScript Inline Comment Example Source: https://github.com/versatica/mediasoup/blob/v3/CONTRIBUTING.md Demonstrates the correct format for inline comments in TypeScript, including capitalization and punctuation. ```typescript // Calculate foo based on bar value. const foo = bar / 2; ``` -------------------------------- ### TypeScript JSDoc Comment Example Source: https://github.com/versatica/mediasoup/blob/v3/CONTRIBUTING.md Shows the standard JSDoc syntax for documenting methods and functions in TypeScript. ```typescript /** * Calculates current score for foo and bar. */ function calculateScore(): number { // [...] ``` -------------------------------- ### UDP SCTP Example with node-sctp Source: https://github.com/versatica/mediasoup/wiki/DataChannel This example demonstrates sending SCTP packets over UDP using the node-sctp library. It's relevant for understanding how SCTP can be transmitted via UDP, a key aspect of the DataChannel architecture. ```javascript const sctp = require('sctp'); const dgram = require('dgram'); const socket = dgram.createSocket('udp4'); socket.on('listening', () => { const address = socket.address(); console.log(`UDP Socket listening on ${address.address}:${address.port}`); }); socket.on('message', (message, remoteInfo) => { console.log(`Received message from ${remoteInfo.address}:${remoteInfo.port} - ${message}`); }); socket.on('error', (err) => { console.error(`Socket error: ${err.stack}`); socket.close(); }); // Send SCTP packet over UDP socket.send(Buffer.from('hello'), 5000, '127.0.0.1', (err) => { if (err) { console.error(`UDP message send error: ${err.stack}`); socket.close(); } else { console.log('UDP message sent to 127.0.0.1:5000'); } }); socket.bind(5001); // Example of sending SCTP packet over UDP // sctp.send(socket, Buffer.from('hello'), 5000, '127.0.0.1', 5001, (err) => { // if (err) { // console.error(`SCTP send error:\n${err.stack}`); // } else { // console.log('SCTP packet sent'); // } // }); ``` -------------------------------- ### Tagging a New Rust Crate Version Source: https://github.com/versatica/mediasoup/blob/v3/doc/Rust-crates.md Use this command to create and push a Git tag for a new Rust crate version, following the `rust-X.X.X` format. ```sh git tag -a rust-X.X.X -m rust-X.X.X git push origin rust-X.X.X ``` -------------------------------- ### Run clang-tidy with Standard Library Paths Source: https://github.com/versatica/mediasoup/blob/v3/doc/Building.md Runs clang-tidy, providing explicit paths to C++ standard libraries to resolve potential warnings related to them. ```bash PATH="/opt/homebrew/opt/llvm/bin/:$PATH" CPATH=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1 invoke tidy ``` -------------------------------- ### Enable STUN Fuzzer Source: https://github.com/versatica/mediasoup/blob/v3/doc/Fuzzer.md Set this environment variable to enable fuzzing specifically for the STUN protocol. ```bash MS_FUZZ_STUN=1 ``` -------------------------------- ### Run clang-tidy with Custom PATH Source: https://github.com/versatica/mediasoup/blob/v3/doc/Building.md Executes clang-tidy for C++ code checks, ensuring the clang-tidy executable is found by prepending its directory to the PATH. ```bash PATH="/opt/homebrew/opt/llvm/bin/:$PATH" invoke tidy ``` -------------------------------- ### Use Pre-compiled Worker Binary Source: https://github.com/versatica/mediasoup/blob/v3/doc/Building.md Specifies a pre-compiled mediasoup-worker binary to be used by the mediasoup module, bypassing the compilation process. ```bash MEDIASOUP_WORKER_BIN="/home/xxx/src/foo/mediasoup-worker" node myapp.js ``` -------------------------------- ### Enable Audio/Video Codecs Fuzzer Source: https://github.com/versatica/mediasoup/blob/v3/doc/Fuzzer.md Set this environment variable to enable fuzzing for audio and video codecs. ```bash MS_FUZZ_CODECS=1 ``` -------------------------------- ### Run Jest with specific test patterns Source: https://github.com/versatica/mediasoup/blob/v3/doc/Building.md This command runs Jest test units for the Node.js part of mediasoup. You can specify test file patterns and test name patterns to focus your testing efforts. ```bash npm run test:node -- --testPathPatterns "node/src/test/test-Worker.ts" --testNamePattern "createWorker" ``` -------------------------------- ### Publishing Mediasoup Rust Crates Source: https://github.com/versatica/mediasoup/blob/v3/doc/Rust-crates.md Commands to publish the `mediasoup-types`, `mediasoup-sys` (from `worker` directory), and `mediasoup` crates to crates.io. Ensure you are in the correct directory for each command. ```sh cd rust/types cargo publish cd worker cargo publish cd rust cargo publish ``` -------------------------------- ### Add mediasoup-types to Cargo.toml Source: https://github.com/versatica/mediasoup/blob/v3/rust/types/README.md Add the mediasoup-types crate as a dependency in your project's Cargo.toml file. Replace X.Y.Z with the desired version. ```toml [dependencies] mediasoup-types = "X.Y.Z" ``` -------------------------------- ### Fuzz All Components with Custom Logging Source: https://github.com/versatica/mediasoup/blob/v3/doc/Fuzzer.md This command fuzzes all components with a specified log level and log tags. It also enables memory leak detection and includes multiple corpora. ```bash MS_FUZZ_LOG_LEVEL=warn MS_FUZZ_LOG_TAGS="rtp rtcp" LSAN_OPTIONS=verbosity=1:log_threads=1 ./out/Release/mediasoup-worker-fuzzer -artifact_prefix=fuzzer/reports/ -max_len=1400 fuzzer/new-corpus deps/webrtc-fuzzer-corpora/corpora/stun-corpus deps/webrtc-fuzzer-corpora/corpora/rtp-corpus deps/webrtc-fuzzer-corpora/corpora/rtcp-corpus ``` -------------------------------- ### Enable RTP Fuzzer Source: https://github.com/versatica/mediasoup/blob/v3/doc/Fuzzer.md Set this environment variable to enable fuzzing specifically for the RTP protocol. ```bash MS_FUZZ_RTP=1 ``` -------------------------------- ### Enable SCTP Fuzzer Source: https://github.com/versatica/mediasoup/blob/v3/doc/Fuzzer.md Set this environment variable to enable fuzzing specifically for the SCTP protocol. ```bash MS_FUZZ_SCTP=1 ``` -------------------------------- ### Enable C++ Utils Fuzzer Source: https://github.com/versatica/mediasoup/blob/v3/doc/Fuzzer.md Set this environment variable to enable fuzzing for C++ utility functions. ```bash MS_FUZZ_UTILS=1 ``` -------------------------------- ### Import and Use Types in Rust Source: https://github.com/versatica/mediasoup/blob/v3/rust/types/README.md Import and utilize core types like RtpCodecParameters, RtpCapabilities, and MediaKind from the mediasoup-types crate in your Rust code. ```rust use mediasoup_types::{RtpCodecParameters, RtpCapabilities, MediaKind}; ``` -------------------------------- ### Updating Rust Toolchain Source: https://github.com/versatica/mediasoup/blob/v3/doc/Rust-crates.md Use the `rustup` command to update your Rust toolchain to the latest version. ```sh rustup update ``` -------------------------------- ### Verify Specific Crash Fix Source: https://github.com/versatica/mediasoup/blob/v3/doc/Fuzzer.md Use this command to verify that a specific crash has been fixed. It requires the path to the crash artifact. ```bash LSAN_OPTIONS=verbosity=1:log_threads=1 ./out/Release/mediasoup-worker-fuzzer fuzzer/reports/crash-f39771f7a03c0e7e539d4e52f48f7adad8976404 ``` -------------------------------- ### Set Build Type for Node.js Application Source: https://github.com/versatica/mediasoup/blob/v3/doc/Building.md Instructs the mediasoup Node.js module to use a specific build type (e.g., 'Debug') for the mediasoup-worker binary. ```bash MEDIASOUP_BUILDTYPE=Debug node myapp.js ``` -------------------------------- ### Find File Duplicates Across All Subfolders Source: https://github.com/versatica/mediasoup/blob/v3/worker/deps/webrtc-fuzzer-corpora/README.md This command uses `find`, `sha1sum`, `sort`, and `uniq` to detect duplicate files across all subfolders. It lists files that have identical SHA1 hashes, regardless of their directory. ```bash > find . \( ! -regex '.*/\..*' \) -type f -exec sha1sum {} + | sort | uniq -w40 -dD 131d620296fa9eb2c372c7fd71b8e58f8a10abd5 ./corpora/sdp-corpus/46-131d620296fa9eb2c372c7fd71b8e58f8a10abd5.sdp 131d620296fa9eb2c372c7fd71b8e58f8a10abd5 ./corpora/sdp-corpus/50.sdp 271138fdddb4f02313f25b47581f9f8f4a2eb201 ./corpora/sdp-corpus/12-271138fdddb4f02313f25b47581f9f8f4a2eb201.sdp 271138fdddb4f02313f25b47581f9f8f4a2eb201 ./corpora/sdp-corpus/15.sdp 271138fdddb4f02313f25b47581f9f8f4a2eb201 ./corpora/sdp-corpus/40.sdp ... 461a0e9201a7ea5ea6a43511571bdafce10b8185 ./corpora/rtcp-corpus/17-461a0e9201a7ea5ea6a43511571bdafce10b8185.rtcp 461a0e9201a7ea5ea6a43511571bdafce10b8185 ./reports/crashes/rtcp/crash-461a0e9201a7ea5ea6a43511571bdafce10b8185 ``` -------------------------------- ### Fuzz Audio/Video Codecs with Memory Leak Detection Source: https://github.com/versatica/mediasoup/blob/v3/doc/Fuzzer.md This command enables memory leak detection and fuzzing for audio/video codecs. It does not require a specific corpus path. ```bash MS_FUZZ_CODECS=1 LSAN_OPTIONS=verbosity=1:log_threads=1 ./out/Release/mediasoup-worker-fuzzer -artifact_prefix=fuzzer/reports/ -max_len=1400 fuzzer/new-corpus ``` -------------------------------- ### Enable RTCP Fuzzer Source: https://github.com/versatica/mediasoup/blob/v3/doc/Fuzzer.md Set this environment variable to enable fuzzing specifically for the RTCP protocol. ```bash MS_FUZZ_RTCP=1 ``` -------------------------------- ### Fuzz STUN with Memory Leak Detection Source: https://github.com/versatica/mediasoup/blob/v3/doc/Fuzzer.md Use this command to detect memory leaks while fuzzing the STUN component. Ensure LSAN_OPTIONS are set for verbosity and thread logging. ```bash MS_FUZZ_STUN=1 LSAN_OPTIONS=verbosity=1:log_threads=1 ./out/Release/mediasoup-worker-fuzzer -artifact_prefix=fuzzer/reports/ -max_len=1400 fuzzer/new-corpus deps/webrtc-fuzzer-corpora/corpora/stun-corpus ``` -------------------------------- ### Enable DTLS Fuzzer Source: https://github.com/versatica/mediasoup/blob/v3/doc/Fuzzer.md Set this environment variable to enable fuzzing specifically for the DTLS protocol. ```bash MS_FUZZ_DTLS=1 ``` -------------------------------- ### Checking Crate Without Publishing Source: https://github.com/versatica/mediasoup/blob/v3/doc/Rust-crates.md Use `cargo package` to create a crate package for inspection without uploading it to crates.io. The `--dry-run` flag can be used to avoid package generation. ```sh cargo package --dry-run ``` -------------------------------- ### Verify Hashed Files with add_sha1.sh Source: https://github.com/versatica/mediasoup/blob/v3/worker/deps/webrtc-fuzzer-corpora/README.md This command filters the output of `add_sha1.sh` to show files that have been successfully hashed and renamed. It confirms that the script correctly processed and updated the filenames. ```bash > ./add_sha1.sh . | grep OK ./corpora/pseudotcp-corpus/785b96587d0eb44dd5d75b7a886f37e2ac504511 -> OK ./corpora/rtcp-corpus/0-01b13c2eb549daadeec1eb7eb0846e9a2f5729eb.rtcp -> OK ./corpora/rtp-corpus/rtp-0-951641f47532884149e6ebe9a87386226d8bf4fe -> OK ``` -------------------------------- ### Update Wrap File for Subproject Source: https://github.com/versatica/mediasoup/blob/v3/doc/Building.md Use this command to update a specific subproject's wrap file within the worker directory. Ensure the SUBPROJECT environment variable is set. ```bash cd worker make update-wrap-file SUBPROJECT=openssl ``` -------------------------------- ### Detect Duplicates within Subfolders using add_sha1.sh Source: https://github.com/versatica/mediasoup/blob/v3/worker/deps/webrtc-fuzzer-corpora/README.md This command uses `add_sha1.sh` to identify duplicate files within the same subfolder. It flags files that have the same SHA1 hash as other files in their respective directories. ```bash > ./add_sha1.sh . | grep DUPLICATE ./corpora/rtp-corpus/rtp-4 -> DUPLICATE ./corpora/rtp-corpus/rtp-1-5a709d82364ddf4f9350104c83994dded1c9f91c ./corpora/sdp-corpus/4.sdp -> DUPLICATE ./corpora/sdp-corpus/2-60495c33fc8758c5ce44f896c5f508bc026842c2.sdp ./corpora/sdp-corpus/8.sdp -> DUPLICATE ./corpora/sdp-corpus/2-60495c33fc8758c5ce44f896c5f508bc026842c2.sdp ``` -------------------------------- ### Fuzz Mediasoup-Worker C++ Utils with Memory Leak Detection Source: https://github.com/versatica/mediasoup/blob/v3/doc/Fuzzer.md Use this command to detect memory leaks and fuzz the C++ utilities within mediasoup-worker. Note the increased max_len for this specific fuzzing target. ```bash MS_FUZZ_UTILS=1 LSAN_OPTIONS=verbosity=1:log_threads=1 ./out/Release/mediasoup-worker-fuzzer -artifact_prefix=fuzzer/reports/ -max_len=2000 fuzzer/new-corpus ``` -------------------------------- ### Fuzz RTP with Memory Leak Detection Source: https://github.com/versatica/mediasoup/blob/v3/doc/Fuzzer.md This command is used to fuzz the RTP component and detect memory leaks. It includes the RTP corpus for fuzzing. ```bash MS_FUZZ_RTP=1 LSAN_OPTIONS=verbosity=1:log_threads=1 ./out/Release/mediasoup-worker-fuzzer -artifact_prefix=fuzzer/reports/ -max_len=1400 fuzzer/new-corpus deps/webrtc-fuzzer-corpora/corpora/rtp-corpus ``` -------------------------------- ### Enable Memory Leak Detection Source: https://github.com/versatica/mediasoup/blob/v3/doc/Fuzzer.md Set this environment variable to enable memory leak detection during fuzzing. Verbosity and thread logging can be configured. ```bash LSAN_OPTIONS=verbosity=1:log_threads=1 ``` -------------------------------- ### Fuzz DTLS with Memory Leak Detection Source: https://github.com/versatica/mediasoup/blob/v3/doc/Fuzzer.md This command enables memory leak detection and fuzzing for the DTLS component. It requires specific environment variables and fuzzer arguments. ```bash MS_FUZZ_DTLS=1 LSAN_OPTIONS=verbosity=1:log_threads=1 ./out/Release/mediasoup-worker-fuzzer -artifact_prefix=fuzzer/reports/ -max_len=1400 fuzzer/new-corpus ``` -------------------------------- ### Set Fuzzer Log Level Source: https://github.com/versatica/mediasoup/blob/v3/doc/Fuzzer.md Set the logging level for the mediasoup-worker fuzzer. Options include 'debug', 'warn', or 'error'. Defaults to 'none' if unset. ```bash MS_FUZZ_LOG_LEVEL=debug ``` -------------------------------- ### Fuzz RTCP with Memory Leak Detection Source: https://github.com/versatica/mediasoup/blob/v3/doc/Fuzzer.md Use this command to fuzz the RTCP component and detect memory leaks. It utilizes the RTCP corpus for fuzzing. ```bash MS_FUZZ_RTCP=1 LSAN_OPTIONS=verbosity=1:log_threads=1 ./out/Release/mediasoup-worker-fuzzer -artifact_prefix=fuzzer/reports/ -max_len=1400 fuzzer/new-corpus deps/webrtc-fuzzer-corpora/corpora/rtcp-corpus ``` -------------------------------- ### Append SHA1 Hash to Corpora Files Source: https://github.com/versatica/mediasoup/blob/v3/worker/deps/webrtc-fuzzer-corpora/README.md Use this script to append SHA1 hash sums to corpus files. It helps in managing unique files and detecting duplicates. The script renames files by appending their SHA1 hash. ```bash $ ./add_sha1.sh . renamed './corpora/agc-corpus/agc-1' -> './corpora/agc-corpus/agc-1-b35a35f11d86e802f694f84c45e48da96158f73f' renamed './corpora/agc-corpus/agc-2' -> './corpora/agc-corpus/agc-2-f3d59a997d30890da3239b377bba3bc502d18f1e' ... renamed './corpora/rtcp-corpus/0.rtcp' -> './corpora/rtcp-corpus/0-01b13c2eb549daadeec1eb7eb0846e9a2f5729eb.rtcp' ``` -------------------------------- ### Specify Artifact Prefix for Crash Reports Source: https://github.com/versatica/mediasoup/blob/v3/doc/Fuzzer.md When the fuzzer detects an issue, it generates a crash report. Use this option to specify the directory where these reports will be stored. ```bash -artifact_prefix=fuzzer/reports/ ``` -------------------------------- ### Set Maximum Input Length for Fuzzer Source: https://github.com/versatica/mediasoup/blob/v3/doc/Fuzzer.md This option limits the maximum input size for the fuzzer, which can be useful for performance or specific testing scenarios. ```bash -max_len=1400 ``` -------------------------------- ### Fuzz SCTP with Memory Leak Detection Source: https://github.com/versatica/mediasoup/blob/v3/doc/Fuzzer.md Use this command to fuzz the SCTP component and detect memory leaks. It is similar to other component fuzzing commands, with the specific component flag set. ```bash MS_FUZZ_SCTP=1 LSAN_OPTIONS=verbosity=1:log_threads=1 ./out/Release/mediasoup-worker-fuzzer -artifact_prefix=fuzzer/reports/ -max_len=1400 fuzzer/new-corpus ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.