Skip to content

Commit 2268150

Browse files
Docker build FROM ubuntu 22.04
1 parent cdeeddd commit 2268150

3 files changed

Lines changed: 202 additions & 43 deletions

File tree

.github/workflows/builds.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,29 @@ on:
77
- src/**
88
- include/**
99
- examples/**
10+
- bridge/**
1011
- client-sdk-rust/**
1112
- CMakeLists.txt
1213
- build.sh
1314
- build.cmd
1415
- vcpkg.json
1516
- CMakePresets.json
17+
- docker/Dockerfile
1618
- .github/workflows/**
1719
pull_request:
1820
branches: ["main"]
1921
paths:
2022
- src/**
2123
- include/**
2224
- examples/**
25+
- bridge/**
2326
- client-sdk-rust/**
2427
- CMakeLists.txt
2528
- build.sh
2629
- build.cmd
2730
- vcpkg.json
2831
- CMakePresets.json
32+
- docker/Dockerfile
2933
- .github/workflows/**
3034
workflow_dispatch:
3135

@@ -238,3 +242,25 @@ jobs:
238242
else
239243
./build.sh clean-all || true
240244
fi
245+
246+
docker-build:
247+
name: Build (docker-linux-x64)
248+
runs-on: ubuntu-latest
249+
250+
steps:
251+
- name: Checkout (with submodules)
252+
uses: actions/checkout@v4
253+
with:
254+
submodules: recursive
255+
fetch-depth: 0
256+
257+
- name: Set up Docker Buildx
258+
uses: docker/setup-buildx-action@v3
259+
260+
- name: Build Docker image
261+
run: docker build -t livekit-cpp-sdk:${{ github.sha }} . -f docker/Dockerfile
262+
263+
- name: Build SDK inside Docker
264+
run: |
265+
docker run --rm livekit-cpp-sdk:${{ github.sha }} bash -c \
266+
'cd /client-sdk-cpp && chmod +x build.sh && ./build.sh release-examples'

README.md

Lines changed: 46 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,7 @@
1414
Use this SDK to add realtime video, audio and data features to your C++ app. By connecting to <a href="https://livekit.io/">LiveKit</a> Cloud or a self-hosted server, you can quickly build applications such as multi-modal AI, live streaming, or video calls with just a few lines of code.
1515
<!--END_DESCRIPTION-->
1616

17-
## Build & Installation Guide
18-
19-
This page covers how to build and install the LiveKit C++ Client SDK for real-time audio/video communication.
20-
21-
---
22-
23-
### 📦 Requirements
17+
## 📦 Requirements
2418
- **CMake** ≥ 3.20
2519
- **Rust / Cargo** (latest stable toolchain)
2620
- **Git LFS** (required for examples)
@@ -31,19 +25,19 @@ This page covers how to build and install the LiveKit C++ Client SDK for real-ti
3125

3226
**Platform-Specific Requirements:**
3327

34-
#### For Building the SDK:
28+
### For Building the SDK:
3529
- **Windows:** Visual Studio 2019+, vcpkg
3630
- **Linux:** `sudo apt install libprotobuf-dev libssl-dev` (protobuf 3.x)
3731
- **macOS:** `brew install protobuf` (protobuf 3.x)
3832

39-
#### For Using the Pre-built SDK:
33+
### For Using the Pre-built SDK:
4034
- **Windows:** ✅ All dependencies included (DLLs bundled) - ready to use
4135
- **Linux:** ⚠️ Requires `libprotobuf` and `libssl-dev`; deploy `liblivekit_ffi.so` with your executable
4236
- **macOS:** ⚠️ Requires `protobuf`; deploy `liblivekit_ffi.dylib` with your executable
4337

4438
> **Note**: If the SDK was built with Protobuf 6.0+, you also need `libabsl-dev` (Linux) or `abseil` (macOS).
4539
46-
### 🧩 Clone the Repository
40+
## 🧩 Clone the Repository
4741

4842
Make sure to initialize the Rust submodule (`client-sdk-rust`):
4943

@@ -57,9 +51,9 @@ cd client-sdk-cpp
5751
git submodule update --init --recursive
5852
```
5953

60-
### ⚙️ BUILD
54+
## ⚙️ BUILD
6155

62-
#### Quick Build (Using Build Scripts)
56+
### Quick Build (Using Build Scripts)
6357

6458
**Linux/macOS:**
6559
```bash
@@ -71,6 +65,17 @@ git submodule update --init --recursive
7165
./build.sh release-tests # Build Release with tests
7266
```
7367
**Windows**
68+
Using build scripts:
69+
```powershell
70+
.\build.cmd clean # Clean CMake build artifacts
71+
.\build.cmd clean-all # Deep clean (C++ + Rust + generated files)
72+
.\build.cmd debug # Build Debug version
73+
.\build.cmd release # Build Release version
74+
.\build.cmd debug-tests # Build Debug with tests
75+
.\build.cmd release-tests # Build Release with tests
76+
```
77+
78+
### Windows build using cmake/vcpkg
7479
```bash
7580
cmake -S . -B build -DCMAKE_TOOLCHAIN_FILE="$PWD/vcpkg/scripts/buildsystems/vcpkg.cmake" # Generate Makefiles in build folder
7681
# Build (Release or Debug)
@@ -86,17 +91,7 @@ You must install protobuf via vcpkg (so CMake can find ProtobufConfig.cmake and
8691
.\vcpkg\vcpkg install protobuf:x64-windows
8792
```
8893

89-
**Windows:**
90-
```powershell
91-
.\build.cmd clean # Clean CMake build artifacts
92-
.\build.cmd clean-all # Deep clean (C++ + Rust + generated files)
93-
.\build.cmd debug # Build Debug version
94-
.\build.cmd release # Build Release version
95-
.\build.cmd debug-tests # Build Debug with tests
96-
.\build.cmd release-tests # Build Release with tests
97-
```
98-
99-
#### Advanced Build (Using CMake Presets)
94+
### Advanced Build (Using CMake Presets)
10095

10196
For more control and platform-specific builds, see the detailed instructions in [README_BUILD.md](README_BUILD.md).
10297

@@ -128,15 +123,23 @@ cmake --build --preset macos-release
128123

129124
📖 **For complete build instructions, troubleshooting, and platform-specific notes, see [README_BUILD.md](README_BUILD.md)**
130125

131-
### 🧪 Run Example
126+
### Building with Docker
127+
The Dockerfile COPYs folders/files required to build the CPP SDK into the image.
128+
**NOTE:** this has only been tested on Linux
129+
```bash
130+
docker build -t livekit-cpp-sdk . -f docker/Dockerfile
131+
docker run -it --network host livekit-cpp-sdk:latest bash
132+
```
133+
134+
## 🧪 Run Example
132135

133136
### Generate Tokens
134137
Before running any participant, create JWT tokens with the proper identity and room name, example
135138
```bash
136139
lk token create -r test -i your_own_identity --join --valid-for 99999h --dev --room=your_own_room
137140
```
138141

139-
#### SimpleRoom
142+
### SimpleRoom
140143

141144
```bash
142145
./build/examples/SimpleRoom --url $URL --token <jwt-token>
@@ -164,23 +167,23 @@ If the E2EE keys do not match between participants:
164167

165168
Press Ctrl-C to exit the example.
166169

167-
#### SimpleRpc
170+
### SimpleRpc
168171
The SimpleRpc example demonstrates how to:
169172
- Connect multiple participants to the same LiveKit room
170173
- Register RPC handlers (e.g., arrival, square-root, divide, long-calculation)
171174
- Send RPC requests from one participant to another
172175
- Handle success, application errors, unsupported methods, and timeouts
173176
- Observe round-trip times (RTT) for each RPC call
174177

175-
##### 🔑 Generate Tokens
178+
#### 🔑 Generate Tokens
176179
Before running any participant, create JWT tokens with **caller**, **greeter** and **math-genius** identities and room name.
177180
```bash
178181
lk token create -r test -i caller --join --valid-for 99999h --dev --room=your_own_room
179182
lk token create -r test -i greeter --join --valid-for 99999h --dev --room=your_own_room
180183
lk token create -r test -i math-genius --join --valid-for 99999h --dev --room=your_own_room
181184
```
182185

183-
##### ▶ Start Participants
186+
#### ▶ Start Participants
184187
Every participant is run as a separate terminal process, note --role needs to match the token identity.
185188
```bash
186189
./build/examples/SimpleRpc --url $URL --token <jwt-token> --role=math-genius
@@ -191,7 +194,7 @@ The caller will automatically:
191194
- Print round-trip times
192195
- Annotate expected successes or expected failures
193196

194-
#### SimpleDataStream
197+
### SimpleDataStream
195198
- The SimpleDataStream example demonstrates how to:
196199
- Connect multiple participants to the same LiveKit room
197200
- Register text stream and byte stream handlers by topic (e.g. "chat", "files")
@@ -201,14 +204,14 @@ The caller will automatically:
201204
- Measure and print one-way latency on the receiver using sender timestamps
202205
- Receive streamed chunks and reconstruct the full payload on the receiver
203206

204-
##### 🔑 Generate Tokens
207+
#### 🔑 Generate Tokens
205208
Before running any participant, create JWT tokens with caller and greeter identities and your room name.
206209
```bash
207210
lk token create -r test -i caller --join --valid-for 99999h --dev --room=your_own_room
208211
lk token create -r test -i greeter --join --valid-for 99999h --dev --room=your_own_room
209212
```
210213

211-
##### ▶ Start Participants
214+
#### ▶ Start Participants
212215
Start the receiver first (so it registers stream handlers before messages arrive):
213216
```bash
214217
./build/examples/SimpleDataStream --url $URL --token <jwt-token>
@@ -312,7 +315,7 @@ and a **ROS2 bridge** that maps `LogLevel` to `RCLCPP_*` macros.
312315

313316
---
314317

315-
### 🧪 Integration & Stress Tests
318+
## 🧪 Integration & Stress Tests
316319

317320
The SDK includes integration and stress tests using Google Test (gtest).
318321

@@ -330,7 +333,7 @@ The SDK includes integration and stress tests using Google Test (gtest).
330333
.\build.cmd release-tests
331334
```
332335

333-
#### Run Tests
336+
### Run Tests
334337

335338
After building, run tests using ctest or directly:
336339

@@ -348,7 +351,7 @@ ctest --output-on-failure
348351
./build-debug/bin/livekit_stress_tests --gtest_filter="*MaxPayloadStress*"
349352
```
350353

351-
#### Test Types
354+
### Test Types
352355

353356
| Executable | Description |
354357
|------------|-------------|
@@ -376,29 +379,29 @@ lk token create -r test -i rpc-caller --join --valid-for 99999h --dev --room=rpc
376379
lk token create -r test -i rpc-receiver --join --valid-for 99999h --dev --room=rpc-test-room
377380
```
378381

379-
#### Test Coverage
382+
### Test Coverage
380383

381384
- **SDK Initialization**: Initialize/shutdown lifecycle
382385
- **Room**: Room creation, options, connection
383386
- **Audio Frame**: Frame creation, manipulation, edge cases
384387
- **RPC**: Round-trip calls, max payload (15KB), timeouts, errors, concurrent calls
385388
- **Stress Tests**: High throughput, bidirectional RPC, memory pressure
386389

387-
### 🧰 Recommended Setup
388-
#### macOS
390+
## 🧰 Recommended Setup
391+
### macOS
389392
```bash
390393
brew install cmake protobuf rust
391394
```
392395

393-
#### Ubuntu / Debian
396+
### Ubuntu / Debian
394397
```bash
395398
sudo apt update
396399
sudo apt install -y cmake protobuf-compiler build-essential
397400
curl https://sh.rustup.rs -sSf | sh
398401
```
399402

400-
### 🛠️ Development Tips
401-
#### Update Rust version
403+
## 🛠️ Development Tips
404+
### Update Rust version
402405
```bash
403406
cd client-sdk-cpp
404407
git fetch origin
@@ -417,19 +420,19 @@ git -C client-sdk-rust/yuv-sys submodule update --init --recursive --checkout
417420
git submodule status --recursive
418421
```
419422

420-
#### If yuv-sys fails to build
423+
### If yuv-sys fails to build
421424
```bash
422425
cargo clean -p yuv-sys
423426
cargo build -p yuv-sys -vv
424427
```
425428

426-
#### Full clean (Rust + C++ build folders)
429+
### Full clean (Rust + C++ build folders)
427430
In some cases, you may need to perform a full clean that deletes all build artifacts from both the Rust and C++ folders:
428431
```bash
429432
./build.sh clean-all
430433
```
431434

432-
#### Clang format
435+
### Clang format
433436
CPP SDK is using clang C++ format
434437
```bash
435438
brew install clang-format

0 commit comments

Comments
 (0)