Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
117 changes: 113 additions & 4 deletions .github/workflows/builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ on:
- .github/workflows/**
workflow_dispatch:

permissions:
contents: read

env:
CARGO_TERM_COLOR: always
# vcpkg binary caching for Windows
Expand Down Expand Up @@ -252,7 +255,7 @@ jobs:
./build.sh clean-all || true
fi

docker-build:
docker-build-x64:
name: Build (docker-linux-x64)
runs-on: ubuntu-latest

Expand All @@ -267,9 +270,115 @@ jobs:
uses: docker/setup-buildx-action@v3

- name: Build Docker image
run: docker build -t livekit-cpp-sdk:${{ github.sha }} . -f docker/Dockerfile
run: |
docker buildx build \
--platform linux/amd64 \
--load \
-t livekit-cpp-sdk-x64:${{ github.sha }} \
. \
-f docker/Dockerfile

- name: Verify installed SDK inside image
run: |
docker run --rm livekit-cpp-sdk-x64:${{ github.sha }} bash -c \
'test -f /opt/livekit-sdk/lib/cmake/LiveKit/LiveKitConfig.cmake'

- name: Build SDK inside Docker
- name: Save Docker image artifact
run: |
docker save livekit-cpp-sdk-x64:${{ github.sha }} | gzip > livekit-cpp-sdk-x64-docker.tar.gz

- name: Upload Docker image artifact
uses: actions/upload-artifact@v4
with:
name: livekit-cpp-sdk-docker-x64
path: livekit-cpp-sdk-x64-docker.tar.gz
retention-days: 7

docker-build-linux-arm64:
name: Build (docker-linux-arm64)
runs-on: ubuntu-24.04-arm

steps:
- name: Checkout (with submodules)
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build Docker image
run: |
docker buildx build \
--platform linux/arm64 \
--load \
-t livekit-cpp-sdk:${{ github.sha }} \
. \
-f docker/Dockerfile

- name: Verify installed SDK inside image
run: |
docker run --rm livekit-cpp-sdk:${{ github.sha }} bash -c \
'cd /client-sdk-cpp && chmod +x build.sh && ./build.sh release-examples'
'test -f /opt/livekit-sdk/lib/cmake/LiveKit/LiveKitConfig.cmake'

- name: Save Docker image artifact
run: |
docker save livekit-cpp-sdk:${{ github.sha }} | gzip > livekit-cpp-sdk-arm64-docker.tar.gz

- name: Upload Docker image artifact
uses: actions/upload-artifact@v4
with:
name: livekit-cpp-sdk-docker-arm64
path: livekit-cpp-sdk-arm64-docker.tar.gz
retention-days: 7

build-collections-linux-arm64:
name: Build (cpp-example-collection-linux-arm64)
runs-on: ubuntu-24.04-arm
needs: docker-build-linux-arm64

steps:
- name: Download Docker image artifact
uses: actions/download-artifact@v4
with:
name: livekit-cpp-sdk-docker-arm64

- name: Load Docker image
run: gzip -dc livekit-cpp-sdk-arm64-docker.tar.gz | docker load

- name: Build cpp-example-collection against installed SDK
run: |
docker run --rm livekit-cpp-sdk:${{ github.sha }} bash -lc '
set -euxo pipefail
git clone https://github.com/livekit-examples/cpp-example-collection.git /tmp/cpp-example-collection
cd /tmp/cpp-example-collection
git checkout sderosa/examples-migration
cmake -S . -B build -DLIVEKIT_LOCAL_SDK_DIR=/opt/livekit-sdk
cmake --build build --parallel
'

build-collections-x64:
name: Build (cpp-example-collection-x64)
runs-on: ubuntu-latest
needs: docker-build-x64

steps:
- name: Download Docker image artifact
uses: actions/download-artifact@v4
with:
name: livekit-cpp-sdk-docker-x64

- name: Load Docker image
run: gzip -dc livekit-cpp-sdk-x64-docker.tar.gz | docker load

- name: Build cpp-example-collection against installed SDK
run: |
docker run --rm livekit-cpp-sdk-x64:${{ github.sha }} bash -lc '
set -euxo pipefail
git clone https://github.com/livekit-examples/cpp-example-collection.git /tmp/cpp-example-collection
cd /tmp/cpp-example-collection
git checkout sderosa/examples-migration
cmake -S . -B build -DLIVEKIT_LOCAL_SDK_DIR=/opt/livekit-sdk
cmake --build build --parallel
'
3 changes: 1 addition & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -378,9 +378,8 @@ target_include_directories(livekit
)

target_link_libraries(livekit
PUBLIC
$<BUILD_INTERFACE:spdlog::spdlog>
PRIVATE
spdlog::spdlog
livekit_ffi
${LIVEKIT_PROTOBUF_TARGET}
)
Expand Down
7 changes: 0 additions & 7 deletions bridge/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,6 @@ target_include_directories(livekit_bridge
target_link_libraries(livekit_bridge
PUBLIC
livekit
PRIVATE
spdlog::spdlog
)

target_compile_definitions(livekit_bridge
PRIVATE
SPDLOG_ACTIVE_LEVEL=${_SPDLOG_ACTIVE_LEVEL}
)

if(MSVC)
Expand Down
1 change: 0 additions & 1 deletion bridge/include/livekit_bridge/livekit_bridge.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include "livekit_bridge/bridge_video_track.h"
#include "livekit_bridge/rpc_constants.h"

#include "livekit/lk_log.h"
#include "livekit/local_participant.h"
#include "livekit/room.h"
#include "livekit/rpc_error.h"
Expand Down
11 changes: 5 additions & 6 deletions bridge/src/bridge_audio_track.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,9 @@
#include "livekit/local_audio_track.h"
#include "livekit/local_participant.h"

#include <iostream>
#include <stdexcept>

#include "livekit/lk_log.h"

namespace livekit_bridge {

BridgeAudioTrack::BridgeAudioTrack(
Expand Down Expand Up @@ -56,7 +55,7 @@ bool BridgeAudioTrack::pushFrame(const std::vector<std::int16_t> &data,
try {
source_->captureFrame(frame, timeout_ms);
} catch (const std::exception &e) {
LK_LOG_ERROR("BridgeAudioTrack captureFrame error: {}", e.what());
std::cerr << "[error] BridgeAudioTrack captureFrame error: " << e.what() << "\n";
return false;
}
return true;
Expand All @@ -77,7 +76,7 @@ bool BridgeAudioTrack::pushFrame(const std::int16_t *data,
try {
source_->captureFrame(frame, timeout_ms);
} catch (const std::exception &e) {
LK_LOG_ERROR("BridgeAudioTrack captureFrame error: {}", e.what());
std::cerr << "[error] BridgeAudioTrack captureFrame error: " << e.what() << "\n";
return false;
}
return true;
Expand Down Expand Up @@ -115,8 +114,8 @@ void BridgeAudioTrack::release() {
participant_->unpublishTrack(track_->publication()->sid());
} catch (...) {
// Best-effort cleanup; ignore errors during teardown
LK_LOG_WARN("BridgeAudioTrack unpublishTrack error, continuing with "
"cleanup");
std::cerr << "[warn] BridgeAudioTrack unpublishTrack error, continuing "
"with cleanup\n";
}
}

Expand Down
11 changes: 5 additions & 6 deletions bridge/src/bridge_video_track.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,9 @@
#include "livekit/video_frame.h"
#include "livekit/video_source.h"

#include <iostream>
#include <stdexcept>

#include "livekit/lk_log.h"

namespace livekit_bridge {

BridgeVideoTrack::BridgeVideoTrack(
Expand Down Expand Up @@ -56,7 +55,7 @@ bool BridgeVideoTrack::pushFrame(const std::vector<std::uint8_t> &rgba,
try {
source_->captureFrame(frame, timestamp_us);
} catch (const std::exception &e) {
LK_LOG_ERROR("BridgeVideoTrack captureFrame error: {}", e.what());
std::cerr << "[error] BridgeVideoTrack captureFrame error: " << e.what() << "\n";
return false;
}
return true;
Expand All @@ -76,7 +75,7 @@ bool BridgeVideoTrack::pushFrame(const std::uint8_t *rgba,
try {
source_->captureFrame(frame, timestamp_us);
} catch (const std::exception &e) {
LK_LOG_ERROR("BridgeVideoTrack captureFrame error: {}", e.what());
std::cerr << "[error] BridgeVideoTrack captureFrame error: " << e.what() << "\n";
return false;
}
return true;
Expand Down Expand Up @@ -114,8 +113,8 @@ void BridgeVideoTrack::release() {
participant_->unpublishTrack(track_->publication()->sid());
} catch (...) {
// Best-effort cleanup; ignore errors during teardown
LK_LOG_WARN("BridgeVideoTrack unpublishTrack error, continuing with "
"cleanup");
std::cerr << "[warn] BridgeVideoTrack unpublishTrack error, continuing "
"with cleanup\n";
}
}

Expand Down
11 changes: 7 additions & 4 deletions bridge/src/livekit_bridge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include "livekit/video_source.h"

#include <cassert>
#include <iostream>
#include <stdexcept>

namespace livekit_bridge {
Expand Down Expand Up @@ -122,8 +123,8 @@ void LiveKitBridge::disconnect() {
std::lock_guard<std::mutex> lock(mutex_);

if (!connected_) {
LK_LOG_WARN("Attempting to disconnect an already disconnected bridge. "
"Things may not disconnect properly.");
std::cerr << "[warn] Attempting to disconnect an already disconnected "
"bridge. Things may not disconnect properly.\n";
}

connected_ = false;
Expand Down Expand Up @@ -241,7 +242,8 @@ void LiveKitBridge::setOnAudioFrameCallback(
AudioFrameCallback callback) {
std::lock_guard<std::mutex> lock(mutex_);
if (!room_) {
LK_LOG_WARN("setOnAudioFrameCallback called before connect(); ignored");
std::cerr << "[warn] setOnAudioFrameCallback called before connect(); "
"ignored\n";
return;
}
room_->setOnAudioFrameCallback(participant_identity, source,
Expand All @@ -253,7 +255,8 @@ void LiveKitBridge::setOnVideoFrameCallback(
VideoFrameCallback callback) {
std::lock_guard<std::mutex> lock(mutex_);
if (!room_) {
LK_LOG_WARN("setOnVideoFrameCallback called before connect(); ignored");
std::cerr << "[warn] setOnVideoFrameCallback called before connect(); "
"ignored\n";
return;
}
room_->setOnVideoFrameCallback(participant_identity, source,
Expand Down
3 changes: 0 additions & 3 deletions cmake/LiveKitConfig.cmake.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
@PACKAGE_INIT@

include(CMakeFindDependencyMacro)
find_dependency(spdlog)

include("${CMAKE_CURRENT_LIST_DIR}/LiveKitTargets.cmake")

18 changes: 18 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,33 @@ FROM ubuntu:22.04

ENV DEBIAN_FRONTEND=noninteractive
ENV HOME=/root
ENV SDK_INSTALL_PREFIX=/opt/livekit-sdk

# Install make, pkg-config, and base build deps (pkg-config + libglib2.0-dev for Rust glib-sys, libasound2-dev for alsa-sys)
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
curl \
git \
libasound2-dev \
libabsl-dev \
libclang-dev \
libdrm-dev \
libglib2.0-dev \
libprotobuf-dev \
libdecor-0-dev \
libspdlog-dev \
libssl-dev \
libunwind-dev \
libusb-1.0-0-dev \
libva-dev \
libwayland-dev \
make \
ninja-build \
pkg-config \
protobuf-compiler \
wget \
llvm-dev \
clang \
xz-utils \
&& rm -rf /var/lib/apt/lists/*

Expand Down Expand Up @@ -122,3 +130,13 @@ RUN mkdir -p /client-sdk-cpp/client-sdk-rust/.cargo \
&& printf '%s\n' '[target.x86_64-unknown-linux-gnu]' 'linker = "/root/gcc-14/bin/g++"' \
'[target.aarch64-unknown-linux-gnu]' 'linker = "/root/gcc-14/bin/g++"' > /client-sdk-cpp/client-sdk-rust/.cargo/config.toml

# Build and install the SDK into a fixed prefix so downstream projects can
# consume the image as a prebuilt LiveKit SDK environment.
RUN LLVM_VERSION="$(llvm-config --version | cut -d. -f1)" \
&& export LIBCLANG_PATH="/usr/lib/llvm-${LLVM_VERSION}/lib" \
&& export CXXFLAGS="-Wno-deprecated-declarations" \
&& export CFLAGS="-Wno-deprecated-declarations" \
&& chmod +x /client-sdk-cpp/build.sh \
&& cd /client-sdk-cpp \
&& ./build.sh release --bundle --prefix "${SDK_INSTALL_PREFIX}" \
&& test -f "${SDK_INSTALL_PREFIX}/lib/cmake/LiveKit/LiveKitConfig.cmake"
Loading
Loading