Skip to content

Commit e7d33fd

Browse files
stephen-derosaladvocdevin-ai-integration[bot]alan-george-lk
authored
LK Capture integration (#276)
* LiveKit Capture integrated through FFI * dep on libjpeg * LIVEKIT_CAPTURE_ENABLED * capture specific releases/builds and tooling. effort to reduce the scope of the public API WRT capture. Co-authored-by: Jacob Gelman <3182119+ladvoc@users.noreply.github.com> Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Alan George <alan.george@livekit.io>
1 parent 354ba5b commit e7d33fd

46 files changed

Lines changed: 3824 additions & 616 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.build-info.json.in‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,7 @@
44
"cpp_git_commit": "@GIT_COMMIT@",
55
"rust_submodule_commit": "@RUST_GIT_COMMIT@",
66
"livekit_ffi_version": "@LIVEKIT_FFI_VERSION@",
7+
"capture_enabled": @LIVEKIT_CAPTURE_ENABLED@,
8+
"cargo_features": "@LIVEKIT_CARGO_FEATURES@",
79
"build_date": "@BUILD_DATE@"
810
}

‎.gitattributes‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
data/welcome.wav filter=lfs diff=lfs merge=lfs -text
22
build.cmd whitespace=cr-at-eol
3+
CMakePresets.json whitespace=cr-at-eol
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Copyright 2026 LiveKit, Inc.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: Build SDK
16+
description: Configure and build an SDK variant with the repository build scripts.
17+
inputs:
18+
preset:
19+
description: Build script command, such as release-examples or debug-tests.
20+
required: true
21+
capture:
22+
description: Capture sources (all, none, or gstreamer,pattern,clock).
23+
default: 'none'
24+
bundle-dir:
25+
description: Optional installation directory for an SDK bundle.
26+
default: ''
27+
version:
28+
description: Optional SDK version to inject.
29+
default: ''
30+
macos-arch:
31+
description: Optional macOS architecture override.
32+
default: ''
33+
runs:
34+
using: composite
35+
steps:
36+
- name: Build (Unix)
37+
if: runner.os != 'Windows'
38+
shell: bash
39+
env:
40+
SDK_PRESET: ${{ inputs.preset }}
41+
SDK_CAPTURE: ${{ inputs.capture }}
42+
SDK_BUNDLE_DIR: ${{ inputs.bundle-dir }}
43+
SDK_VERSION: ${{ inputs.version }}
44+
SDK_MACOS_ARCH: ${{ inputs.macos-arch }}
45+
run: |
46+
args=(./build.sh "$SDK_PRESET")
47+
case "$SDK_CAPTURE" in
48+
all) args+=(--capture) ;;
49+
none|"") args+=(--no-capture) ;;
50+
*) args+=(--capture="$SDK_CAPTURE") ;;
51+
esac
52+
if [[ -n "$SDK_BUNDLE_DIR" ]]; then args+=(--bundle --prefix "$SDK_BUNDLE_DIR"); fi
53+
if [[ -n "$SDK_VERSION" ]]; then args+=(--version "$SDK_VERSION"); fi
54+
if [[ -n "$SDK_MACOS_ARCH" ]]; then args+=(--macos-arch "$SDK_MACOS_ARCH"); fi
55+
"${args[@]}"
56+
- name: Build (Windows)
57+
if: runner.os == 'Windows'
58+
shell: pwsh
59+
env:
60+
SDK_PRESET: ${{ inputs.preset }}
61+
SDK_CAPTURE: ${{ inputs.capture }}
62+
SDK_BUNDLE_DIR: ${{ inputs.bundle-dir }}
63+
SDK_VERSION: ${{ inputs.version }}
64+
run: |
65+
$buildArgs = @($env:SDK_PRESET)
66+
switch ([string]$env:SDK_CAPTURE) {
67+
'all' { $buildArgs += '--capture'; break }
68+
{ $_ -in @('none', '') } { $buildArgs += '--no-capture'; break }
69+
default { $buildArgs += "--capture=$($env:SDK_CAPTURE)" }
70+
}
71+
if ($env:SDK_BUNDLE_DIR) { $buildArgs += @('--bundle', '--prefix', $env:SDK_BUNDLE_DIR) }
72+
if ($env:SDK_VERSION) { $buildArgs += @('--version', $env:SDK_VERSION) }
73+
& .\build.cmd @buildArgs
74+
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Copyright 2026 LiveKit, Inc.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: Set Cargo output root
16+
description: Use a short Cargo root on Windows and the submodule target directory elsewhere.
17+
runs:
18+
using: composite
19+
steps:
20+
- shell: bash
21+
run: |
22+
if [[ "$RUNNER_OS" == "Windows" ]]; then
23+
echo "CARGO_TARGET_DIR=$(cygpath -m "$RUNNER_TEMP")/lk-rust" >> "$GITHUB_ENV"
24+
else
25+
echo "CARGO_TARGET_DIR=$GITHUB_WORKSPACE/client-sdk-rust/target" >> "$GITHUB_ENV"
26+
fi
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Copyright 2026 LiveKit, Inc.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: Check SDK exported symbols
16+
description: Reject private dependency symbols exported by an installed SDK.
17+
inputs:
18+
bundle-dir:
19+
description: SDK installation directory relative to the workspace.
20+
required: true
21+
runs:
22+
using: composite
23+
steps:
24+
- shell: bash
25+
env:
26+
SDK_BUNDLE_DIR: ${{ inputs.bundle-dir }}
27+
run: |
28+
case "$RUNNER_OS" in
29+
Windows) lib="$SDK_BUNDLE_DIR/bin/livekit.dll" ;;
30+
macOS) lib="$SDK_BUNDLE_DIR/lib/liblivekit.dylib" ;;
31+
Linux) lib="$SDK_BUNDLE_DIR/lib/liblivekit.so" ;;
32+
*) echo "Unsupported runner OS: $RUNNER_OS" >&2; exit 1 ;;
33+
esac
34+
python .github/scripts/check_no_private_symbols.py "$lib"
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: Set up capture dependencies
2+
description: Install additional build and runtime dependencies for capture-enabled SDK builds.
3+
runs:
4+
using: composite
5+
steps:
6+
- name: Install GStreamer (Linux)
7+
if: runner.os == 'Linux'
8+
shell: bash
9+
run: |
10+
sudo apt-get update
11+
# Request the distro unwinder explicitly so apt can replace conflicting
12+
# LLVM unwinder development packages on Ubuntu 22.04 runners.
13+
sudo apt-get install -y libunwind-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev \
14+
gstreamer1.0-plugins-base gstreamer1.0-plugins-good \
15+
gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav
16+
- name: Install GStreamer (macOS)
17+
if: runner.os == 'macOS'
18+
env:
19+
GSTREAMER_MACOS_VERSION: "1.28.5"
20+
GSTREAMER_MACOS_RUNTIME_SHA256: "0a8fc7a1cf8d7bac833ca0ebe2fd196a199c2465e810cd5b1e4b4f720c258f43"
21+
GSTREAMER_MACOS_DEVEL_SHA256: "6f7b55e8fb86dcc615c9cae46b79b7785851e5c77f79a938648a81dfa2603729"
22+
shell: bash
23+
run: |
24+
set -euo pipefail
25+
# Official universal packages cover both x86_64 and arm64. Homebrew
26+
# no longer produces Intel bottles and may compile its dependency tree.
27+
base_url="https://gstreamer.freedesktop.org/data/pkg/osx/$GSTREAMER_MACOS_VERSION"
28+
installer_dir="$RUNNER_TEMP/gstreamer-installers"
29+
runtime_pkg="gstreamer-1.0-$GSTREAMER_MACOS_VERSION-universal.pkg"
30+
devel_pkg="gstreamer-1.0-devel-$GSTREAMER_MACOS_VERSION-universal.pkg"
31+
mkdir -p "$installer_dir"
32+
33+
for package in "$runtime_pkg" "$devel_pkg"; do
34+
expected_hash="$GSTREAMER_MACOS_RUNTIME_SHA256"
35+
if [[ "$package" == "$devel_pkg" ]]; then
36+
expected_hash="$GSTREAMER_MACOS_DEVEL_SHA256"
37+
fi
38+
curl --fail --location --retry 3 --connect-timeout 30 --max-time 600 \
39+
"$base_url/$package" --output "$installer_dir/$package"
40+
printf '%s %s\n' "$expected_hash" "$installer_dir/$package" | shasum -a 256 -c -
41+
done
42+
43+
# Verify both downloads before installing either package.
44+
sudo installer -pkg "$installer_dir/$runtime_pkg" -target /
45+
sudo installer -pkg "$installer_dir/$devel_pkg" -target /
46+
47+
framework="/Library/Frameworks/GStreamer.framework/Versions/1.0"
48+
echo "$framework/bin" >> "$GITHUB_PATH"
49+
export PATH="$framework/bin:$PATH"
50+
export PKG_CONFIG_PATH="$framework/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"
51+
echo "PKG_CONFIG_PATH=$PKG_CONFIG_PATH" >> "$GITHUB_ENV"
52+
# The framework dylibs use @rpath. Rust sys-crate linker arguments do
53+
# not propagate to the final FFI dylib, so set its runtime search path.
54+
echo "RUSTFLAGS=${RUSTFLAGS:+$RUSTFLAGS }-C link-arg=-Wl,-rpath,$framework/lib" >> "$GITHUB_ENV"
55+
pkg-config --modversion gstreamer-1.0 gstreamer-app-1.0
56+
gst-inspect-1.0 --version
57+
- name: Install GStreamer (Windows)
58+
if: runner.os == 'Windows'
59+
env:
60+
GSTREAMER_WINDOWS_VERSION: "1.28.5"
61+
GSTREAMER_WINDOWS_SHA256: "51ee5eaec33008e8409d8cf6f6884457f22aa3bd515f8856f993a3eaab903530"
62+
shell: pwsh
63+
run: |
64+
$installer = Join-Path $env:RUNNER_TEMP "gstreamer-installer.exe"
65+
$installDir = Join-Path $env:RUNNER_TEMP "gstreamer"
66+
$uri = "https://gstreamer.freedesktop.org/data/pkg/windows/$env:GSTREAMER_WINDOWS_VERSION/msvc/gstreamer-1.0-msvc-x86_64-$env:GSTREAMER_WINDOWS_VERSION.exe"
67+
68+
Invoke-WebRequest -Uri $uri -OutFile $installer
69+
$actualHash = (Get-FileHash -Algorithm SHA256 $installer).Hash.ToLowerInvariant()
70+
if ($actualHash -ne $env:GSTREAMER_WINDOWS_SHA256) {
71+
throw "GStreamer installer SHA-256 mismatch: expected $env:GSTREAMER_WINDOWS_SHA256, got $actualHash"
72+
}
73+
74+
$process = Start-Process -FilePath $installer -ArgumentList @(
75+
"/TYPE=devel",
76+
"/DIR=$installDir",
77+
"/CURRENTUSER",
78+
"/VERYSILENT",
79+
"/NORESTART"
80+
) -Wait -PassThru
81+
if ($process.ExitCode -ne 0) {
82+
throw "GStreamer installer failed with exit code $($process.ExitCode)"
83+
}
84+
85+
"$installDir\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
86+
"PKG_CONFIG_PATH=$installDir\lib\pkgconfig" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# Copyright 2026 LiveKit, Inc.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: Set up base SDK dependencies
16+
description: Install base SDK packages and the build compiler, without capture dependencies.
17+
inputs:
18+
vcpkg-commit:
19+
description: Pinned vcpkg revision for Windows builds.
20+
default: fb87e2bb3fe69e16c224989acb5a61349166c782
21+
linux-extra-packages:
22+
description: Optional space-separated Linux packages to install with the base dependencies.
23+
default: ''
24+
runs:
25+
using: composite
26+
steps:
27+
- name: Setup vcpkg (Windows only)
28+
if: runner.os == 'Windows'
29+
uses: lukka/run-vcpkg@b1a0dd252f06b9e25b3c022a9a03bd7a427fb6a2 # v11.6
30+
with:
31+
vcpkgGitCommitId: ${{ inputs.vcpkg-commit }}
32+
33+
- name: Install base deps (Ubuntu)
34+
if: runner.os == 'Linux'
35+
shell: bash
36+
env:
37+
SDK_EXTRA_PACKAGES: ${{ inputs.linux-extra-packages }}
38+
run: |
39+
set -eux
40+
extra_packages=()
41+
if [[ -n "$SDK_EXTRA_PACKAGES" ]]; then
42+
read -r -a extra_packages <<< "$SDK_EXTRA_PACKAGES"
43+
fi
44+
sudo apt-get update
45+
sudo apt-get install -y \
46+
build-essential cmake ninja-build pkg-config \
47+
llvm-dev libclang-dev clang \
48+
libva-dev libdrm-dev libgbm-dev libx11-dev libgl1-mesa-dev \
49+
libxext-dev libxcomposite-dev libxdamage-dev libxfixes-dev \
50+
libxrandr-dev libxi-dev libxkbcommon-dev \
51+
libasound2-dev libpulse-dev \
52+
libssl-dev \
53+
libprotobuf-dev protobuf-compiler \
54+
libabsl-dev \
55+
libcurl4-openssl-dev \
56+
libwayland-dev libdecor-0-dev \
57+
"${extra_packages[@]}"
58+
59+
# libwebrtc ships hermetic libc++ headers that require a newer clang than
60+
# Ubuntu provides. The submodule script exports CC/CXX for later steps.
61+
- name: Install clang for libwebrtc
62+
if: runner.os == 'Linux'
63+
shell: bash
64+
run: client-sdk-rust/.github/scripts/install-clang.sh
65+
66+
- name: Install base deps (macOS)
67+
if: runner.os == 'macOS'
68+
shell: bash
69+
run: |
70+
set -eux
71+
brew update
72+
brew install cmake ninja protobuf abseil

0 commit comments

Comments
 (0)