Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
5e5a41b
Add clang-tidy in GHA CI
alan-george-lk Apr 8, 2026
5e2268f
Potential fix for pull request finding 'CodeQL / Workflow does not co…
alan-george-lk Apr 8, 2026
a584b27
Remove compile commands
alan-george-lk Apr 8, 2026
918a2c0
Possibly fix pathing
alan-george-lk Apr 8, 2026
e65e8ab
Rebase and optimize build for debugging
alan-george-lk Apr 8, 2026
99081ab
Debugging clang stage
alan-george-lk Apr 8, 2026
36e9110
Remove debug output
alan-george-lk Apr 8, 2026
85caa49
Try cpplinter stage instead
alan-george-lk Apr 8, 2026
cce7d8b
Hopefully fix clang issue
alan-george-lk Apr 8, 2026
cccbc74
Add github token
alan-george-lk Apr 8, 2026
72c2fe4
Turn files changed only off
alan-george-lk Apr 8, 2026
8aa951d
New clang-tidy error list for the critical stuff
alan-george-lk Apr 9, 2026
65d923e
Adjustments to clang-tidy checks
alan-george-lk Apr 9, 2026
45b9e5b
Fix one introduce another
alan-george-lk Apr 9, 2026
357b85f
Cleanup clang file
alan-george-lk Apr 9, 2026
be4d8a4
Revert bridge_audio_track change that induced clang-tidy
alan-george-lk Apr 10, 2026
13e9948
Modernize namespaces
alan-george-lk Apr 14, 2026
3fbacd1
Merge branch 'main' of github.com:livekit/client-sdk-cpp into feature…
alan-george-lk Apr 14, 2026
695a242
Fix two clang issues
alan-george-lk Apr 14, 2026
d55804a
Use all possible cores on clang-tidy
alan-george-lk Apr 14, 2026
808f781
Use Node24 versions of things
alan-george-lk Apr 14, 2026
648f4b0
build improvements: *-all build configs, ccache, configure stage to o…
alan-george-lk Apr 14, 2026
afba69d
Attempt to fix diagnostic clang errors
alan-george-lk Apr 14, 2026
f242a9d
Cleaner compile database
alan-george-lk Apr 14, 2026
9561293
Some bugprone fixes
alan-george-lk Apr 14, 2026
a9ff299
Additional fixes
alan-george-lk Apr 14, 2026
c977e81
Hopefully cleaner run
alan-george-lk Apr 14, 2026
2512840
Ignore tests folder
alan-george-lk Apr 15, 2026
f3be562
Turn on all stages again
alan-george-lk Apr 15, 2026
67a990b
Undo ccache, additional clang-tidy fixes
alan-george-lk Apr 15, 2026
eff8b69
Fix exception catching
alan-george-lk Apr 15, 2026
1723bc8
Update windows build args
alan-george-lk Apr 15, 2026
b7776e0
Maybe fix catch
alan-george-lk Apr 15, 2026
5a83949
Additional fixes
alan-george-lk Apr 15, 2026
3bc0acb
Fix empty catch
alan-george-lk Apr 15, 2026
5abfda7
Try latest clang folder paths for diagnostic issues
alan-george-lk Apr 15, 2026
4edfe8e
Merge branch 'main' of github.com:livekit/client-sdk-cpp into feature…
alan-george-lk Apr 15, 2026
ccc021f
Additional clang-tidy checks
alan-george-lk Apr 16, 2026
8bcea38
Additional clang-tidy changes
alan-george-lk Apr 16, 2026
724e1af
Additional clang-tidy fixes
alan-george-lk Apr 16, 2026
8c62f8d
Merge branch 'main' of github.com:livekit/client-sdk-cpp into feature…
alan-george-lk Apr 16, 2026
6ec2a43
Additional clang-tidy fixes, 0 warning threshold
alan-george-lk Apr 16, 2026
b5cee08
More fixes
alan-george-lk Apr 16, 2026
a20e07e
Merge branch 'main' of github.com:livekit/client-sdk-cpp into feature…
alan-george-lk Apr 17, 2026
8747546
Remove separate configure stage
alan-george-lk Apr 17, 2026
0bdfb3e
Add readme on clang tools
alan-george-lk Apr 17, 2026
10b5216
PR feedback and integration test updates for env var
alan-george-lk Apr 17, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
Checks: >
-*,
bugprone-*,
performance-*,
modernize-*,
readability-misleading-indentation,
readability-redundant-smartptr-get,
-bugprone-easily-swappable-parameters,
-modernize-use-trailing-return-type,
-modernize-avoid-c-arrays,
-modernize-use-auto,
-modernize-use-nodiscard,
-performance-enum-size,
-readability-braces-around-statements,

# These warnings have determined to be critical and are as such treated as errors
WarningsAsErrors: >
clang-analyzer-*,
bugprone-use-after-move,
bugprone-dangling-handle,
bugprone-infinite-loop,
bugprone-narrowing-conversions,
bugprone-undefined-memory-manipulation,
bugprone-move-forwarding-reference,
bugprone-incorrect-roundings,
bugprone-sizeof-expression,
bugprone-string-literal-with-embedded-nul,
bugprone-suspicious-memset-usage,

HeaderFilterRegex: '(include/livekit|src|bridge/(include|src)|examples)'

FormatStyle: file

CheckOptions:
- key: modernize-use-nullptr.NullMacros
value: 'NULL'
94 changes: 89 additions & 5 deletions .github/workflows/builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ on:

permissions:
contents: read
actions: read
packages: read

env:
Expand Down Expand Up @@ -64,23 +65,23 @@ jobs:
include:
- os: ubuntu-latest
name: linux-x64
build_cmd: ./build.sh release-tests && ./build.sh release-examples
build_cmd: ./build.sh release-all
build_dir: build-release
- os: ubuntu-24.04-arm
name: linux-arm64
build_cmd: ./build.sh release-tests && ./build.sh release-examples
build_cmd: ./build.sh release-all
build_dir: build-release
- os: macos-latest
name: macos-arm64
build_cmd: ./build.sh release-tests && ./build.sh release-examples
build_cmd: ./build.sh release-all
build_dir: build-release
- os: macos-latest
name: macos-x64
build_cmd: ./build.sh release-tests && ./build.sh release-examples --macos-arch x86_64
build_cmd: ./build.sh release-all --macos-arch x86_64
build_dir: build-release
- os: windows-latest
name: windows-x64
build_cmd: .\build.cmd release-tests && .\build.cmd release-examples
build_cmd: .\build.cmd release-all
build_dir: build-release

name: Build (${{ matrix.name }})
Expand Down Expand Up @@ -545,3 +546,86 @@ jobs:
cmake -S . -B build -DLIVEKIT_LOCAL_SDK_DIR=/opt/livekit-sdk
cmake --build build --parallel
'

clang-tidy:
name: clang-tidy
runs-on: ubuntu-latest
continue-on-error: false
permissions:
contents: read
pull-requests: write

steps:
- name: Checkout (with submodules)
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
submodules: recursive
fetch-depth: 1

- name: Install dependencies
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

holy deps of clang, im surprised there isnt a clanh-tidy ez unstall

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might be able to clean this up -- standby

run: |
set -eux
sudo apt-get update
sudo apt-get install -y \
build-essential cmake ninja-build pkg-config \
llvm-dev libclang-dev clang clang-tidy \
libva-dev libdrm-dev libgbm-dev libx11-dev libgl1-mesa-dev \
libxext-dev libxcomposite-dev libxdamage-dev libxfixes-dev \
libxrandr-dev libxi-dev libxkbcommon-dev \
libasound2-dev libpulse-dev \
libssl-dev \
libprotobuf-dev protobuf-compiler \
libabsl-dev \
libwayland-dev libdecor-0-dev \
libspdlog-dev

- name: Install Rust (stable)
uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9
with:
toolchain: stable

- name: Set Linux build environment
run: |
echo "CXXFLAGS=-Wno-deprecated-declarations" >> $GITHUB_ENV
echo "CFLAGS=-Wno-deprecated-declarations" >> $GITHUB_ENV
LLVM_VERSION=$(llvm-config --version | cut -d. -f1)
echo "LIBCLANG_PATH=/usr/lib/llvm-${LLVM_VERSION}/lib" >> $GITHUB_ENV

- name: CMake configure
run: cmake --preset linux-release-all

- name: Generate protobuf headers
run: cmake --build build-release --target livekit_proto

- name: Run clang-tidy
uses: cpp-linter/cpp-linter-action@77c390c5ba9c947ebc185a3e49cc754f1558abb5 # v2.18.0
id: linter
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
style: ''
tidy-checks: ''
database: build-release
files-changed-only: false
lines-changed-only: false
extensions: 'c,cpp,cc,cxx'
ignore: 'build-*|cpp-example-collection|client-sdk-rust|vcpkg_installed|src/tests|bridge/tests|src/room_event_converter.cpp'
file-annotations: true
thread-comments: update
step-summary: true
tidy-review: true
passive-reviews: true
no-lgtm: true
jobs: 0 # 0 == use all available CPU cores

- name: Check warning thresholds
env:
TIDY_FINDINGS: ${{ steps.linter.outputs.clang-tidy-checks-failed }}
MAX_TIDY_FINDINGS: '0'
run: |
echo "clang-tidy findings: ${TIDY_FINDINGS}"
if [ "${TIDY_FINDINGS}" -gt "${MAX_TIDY_FINDINGS}" ]; then
echo "::warning::clang-tidy found ${TIDY_FINDINGS} issue(s), threshold is ${MAX_TIDY_FINDINGS}"
exit 1
fi
echo "clang-tidy findings within threshold"
100 changes: 100 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,32 @@
"LIVEKIT_BUILD_TESTS": "OFF"
}
},
{
"name": "windows-release-all",
"displayName": "Windows x64 Release with Tests + Examples",
"description": "Build for Windows x64 Release with tests and examples",
"inherits": "windows-base",
"binaryDir": "${sourceDir}/build-release",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"LIVEKIT_BUILD_EXAMPLES": "ON",
"LIVEKIT_BUILD_TESTS": "ON",
"VCPKG_MANIFEST_FEATURES": "examples"
}
},
{
"name": "windows-debug-all",
"displayName": "Windows x64 Debug with Tests + Examples",
"description": "Build for Windows x64 Debug with tests and examples",
"inherits": "windows-base",
"binaryDir": "${sourceDir}/build-debug",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"LIVEKIT_BUILD_EXAMPLES": "ON",
"LIVEKIT_BUILD_TESTS": "ON",
"VCPKG_MANIFEST_FEATURES": "examples"
}
},
{
"name": "windows-release-tests",
"displayName": "Windows x64 Release with Tests",
Expand All @@ -231,6 +257,30 @@
"LIVEKIT_BUILD_TESTS": "ON"
}
},
{
"name": "linux-release-all",
"displayName": "Linux Release with Tests + Examples",
"description": "Build for Linux Release with tests and examples",
"inherits": "linux-base",
"binaryDir": "${sourceDir}/build-release",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"LIVEKIT_BUILD_EXAMPLES": "ON",
"LIVEKIT_BUILD_TESTS": "ON"
}
},
{
"name": "linux-debug-all",
"displayName": "Linux Debug with Tests + Examples",
"description": "Build for Linux Debug with tests and examples",
"inherits": "linux-base",
"binaryDir": "${sourceDir}/build-debug",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"LIVEKIT_BUILD_EXAMPLES": "ON",
"LIVEKIT_BUILD_TESTS": "ON"
}
},
{
"name": "linux-release-tests",
"displayName": "Linux Release with Tests",
Expand All @@ -255,6 +305,30 @@
"LIVEKIT_BUILD_TESTS": "ON"
}
},
{
"name": "macos-release-all",
"displayName": "macOS Release with Tests + Examples",
"description": "Build for macOS Release with tests and examples",
"inherits": "macos-base",
"binaryDir": "${sourceDir}/build-release",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"LIVEKIT_BUILD_EXAMPLES": "ON",
"LIVEKIT_BUILD_TESTS": "ON"
}
},
{
"name": "macos-debug-all",
"displayName": "macOS Debug with Tests + Examples",
"description": "Build for macOS Debug with tests and examples",
"inherits": "macos-base",
"binaryDir": "${sourceDir}/build-debug",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"LIVEKIT_BUILD_EXAMPLES": "ON",
"LIVEKIT_BUILD_TESTS": "ON"
}
},
{
"name": "macos-release-tests",
"displayName": "macOS Release with Tests",
Expand Down Expand Up @@ -333,6 +407,32 @@
"name": "macos-debug-examples",
"configurePreset": "macos-debug-examples"
},
{
"name": "windows-release-all",
"configurePreset": "windows-release-all",
"configuration": "Release"
},
{
"name": "windows-debug-all",
"configurePreset": "windows-debug-all",
"configuration": "Debug"
},
{
"name": "linux-release-all",
"configurePreset": "linux-release-all"
},
{
"name": "linux-debug-all",
"configurePreset": "linux-debug-all"
},
{
"name": "macos-release-all",
"configurePreset": "macos-release-all"
},
{
"name": "macos-debug-all",
"configurePreset": "macos-debug-all"
},
{
"name": "windows-release-tests",
"configurePreset": "windows-release-tests",
Expand Down
41 changes: 37 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -480,15 +480,48 @@ In some cases, you may need to perform a full clean that deletes all build artif
./build.sh clean-all
```

### Clang format
CPP SDK is using clang C++ format
## Quality Checks

This SDK leverages various tools and checks to ensure the highest quality of the code.

### Clang Tools

- `clang-tidy`: static analysis checks to catch common C++ pitfalls. See [.clang-tidy](./.clang-tidy) for the list of current checks (enforced in CI on PR)
- `clang-format`: (coming soon) code formatting and style consistency

> **Note**: clang-tidy is not currently supported on Windows for this project because the Visual Studio CMake generator does not produce the compile_commands.json database that clang-tidy requires.

To run locally, first install the following:

**macOS:**

```bash
brew install clang-format
# macOS
brew install llvm
```

This installs `clang-format`, `clang-tidy`, and `run-clang-tidy`. Homebrew may ask you to add `/opt/homebrew/opt/llvm/bin` to your `PATH`.

**Linux:**

```bash
# Ubuntu / Debian:
sudo apt-get install clang-format clang-tidy clang-tools
```

To run:

1. Run a build script command, such that `compile_command.json` is present at the root of the repository
2. Run:

```bash
clang-tidy -p . src/*.cpp
```

### Memory Checks

#### Memory Checks
Run valgrind on various examples or tests to check for memory leaks and other issues.

```bash
valgrind --leak-check=full ./build-debug/bin/livekit_integration_tests
valgrind --leak-check=full ./build-debug/bin/livekit_stress_tests
Expand Down
10 changes: 2 additions & 8 deletions bridge/include/livekit_bridge/rpc_constants.h
Comment thread
stephen-derosa marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#pragma once

#include <string>

#ifdef _WIN32
#ifdef livekit_bridge_EXPORTS
#define LIVEKIT_BRIDGE_API __declspec(dllexport)
Expand All @@ -31,15 +30,12 @@
#define LIVEKIT_BRIDGE_API
#endif

namespace livekit_bridge {
namespace rpc {

/// Built-in RPC method name used by remote track control.
/// Allows remote participants to mute or unmute tracks
/// published by this bridge. Must be called after connect().
/// Audio/video tracks support mute and unmute. Data tracks
/// only support mute and unmute.
namespace track_control {
namespace livekit_bridge::rpc::track_control {

enum class Action { kActionMute, kActionUnmute };

Expand All @@ -60,6 +56,4 @@ LIVEKIT_BRIDGE_API extern const char *const kResponseOk;
LIVEKIT_BRIDGE_API std::string formatPayload(const char *action,
const std::string &track_name);

} // namespace track_control
} // namespace rpc
} // namespace livekit_bridge
} // namespace livekit_bridge::rpc::track_control
8 changes: 2 additions & 6 deletions bridge/src/rpc_constants.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@

#include "livekit_bridge/rpc_constants.h"

namespace livekit_bridge {
namespace rpc {
namespace track_control {
namespace livekit_bridge::rpc::track_control {

const char *const kMethod = "lk.bridge.track-control";
const char *const kActionMute = "mute";
Expand All @@ -36,6 +34,4 @@ std::string formatPayload(const char *action, const std::string &track_name) {
return payload;
}

} // namespace track_control
} // namespace rpc
} // namespace livekit_bridge
} // namespace livekit_bridge::rpc::track_control
Loading
Loading