Skip to content

Commit c06ac4e

Browse files
alan-george-lkstephen-derosa
authored andcommitted
LiveKit capture: Additional API mods for redesign (#292)
* Additional API mods for redesign * Self-review bundle of changes * Consolidate cmake vars * Address devin.ai join throwing warning
1 parent 33618c4 commit c06ac4e

22 files changed

Lines changed: 304 additions & 185 deletions

File tree

‎.github/actions/build-sdk/action.yml‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ inputs:
1919
description: Build script command, such as release-examples or debug-tests.
2020
required: true
2121
capture:
22-
description: Capture sources (ON/all, OFF/none, or gstreamer,pattern,clock).
23-
default: 'OFF'
22+
description: Capture sources (all, none, or gstreamer,pattern,clock).
23+
default: 'none'
2424
bundle-dir:
2525
description: Optional installation directory for an SDK bundle.
2626
default: ''
@@ -45,8 +45,8 @@ runs:
4545
run: |
4646
args=(./build.sh "$SDK_PRESET")
4747
case "$SDK_CAPTURE" in
48-
ON|all) args+=(--capture) ;;
49-
OFF|none|"") args+=(--no-capture) ;;
48+
all) args+=(--capture) ;;
49+
none|"") args+=(--no-capture) ;;
5050
*) args+=(--capture="$SDK_CAPTURE") ;;
5151
esac
5252
if [[ -n "$SDK_BUNDLE_DIR" ]]; then args+=(--bundle --prefix "$SDK_BUNDLE_DIR"); fi
@@ -64,8 +64,8 @@ runs:
6464
run: |
6565
$buildArgs = @($env:SDK_PRESET)
6666
switch ([string]$env:SDK_CAPTURE) {
67-
{ $_ -in @('ON', 'all') } { $buildArgs += '--capture'; break }
68-
{ $_ -in @('OFF', 'none', '') } { $buildArgs += '--no-capture'; break }
67+
'all' { $buildArgs += '--capture'; break }
68+
{ $_ -in @('none', '') } { $buildArgs += '--no-capture'; break }
6969
default { $buildArgs += "--capture=$($env:SDK_CAPTURE)" }
7070
}
7171
if ($env:SDK_BUNDLE_DIR) { $buildArgs += @('--bundle', '--prefix', $env:SDK_BUNDLE_DIR) }

‎.github/actions/test-capture-variant/action.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ runs:
8282
uses: ./.github/actions/test-sdk-bundle
8383
with:
8484
bundle-dir: ${{ steps.variant.outputs.bundle-dir }}
85-
expected-sources: ${{ inputs.sources }}
85+
capture: ${{ inputs.sources }}
8686
verify-pixel-sources: ${{ inputs.verify-pixel-sources }}
8787
build-type: ${{ inputs.preset == 'debug' && 'Debug' || 'Release' }}
8888
macos-arch: ${{ inputs.macos-arch }}

‎.github/actions/test-sdk-bundle/action.yml‎

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,8 @@ inputs:
1919
description: SDK installation directory relative to the workspace.
2020
required: true
2121
capture:
22-
description: Expected capture support (ON or OFF).
23-
default: 'ON'
24-
expected-sources:
25-
description: Expected source set (all, none, or comma-separated sources); empty derives from capture.
26-
default: ''
22+
description: Expected capture sources (all, none, or a comma-separated source list).
23+
default: 'all'
2724
verify-pixel-sources:
2825
description: Require successful pattern/clock creation using a GPU or software adapter.
2926
default: 'false'
@@ -45,19 +42,18 @@ runs:
4542
env:
4643
SDK_BUNDLE_DIR: ${{ inputs.bundle-dir }}
4744
SDK_CAPTURE: ${{ inputs.capture }}
48-
SDK_EXPECTED_SOURCES: ${{ inputs.expected-sources }}
4945
SDK_VERIFY_PIXEL_SOURCES: ${{ inputs.verify-pixel-sources }}
5046
SDK_BUILD_TYPE: ${{ inputs.build-type }}
5147
SDK_VERSION: ${{ inputs.version }}
5248
SDK_MACOS_ARCH: ${{ inputs.macos-arch }}
5349
run: |
5450
bundle="$GITHUB_WORKSPACE/$SDK_BUNDLE_DIR"
55-
build_dir="${RUNNER_TEMP}/livekit-packaging-${SDK_EXPECTED_SOURCES:-$SDK_CAPTURE}"
51+
build_dir="${RUNNER_TEMP}/livekit-packaging-${SDK_CAPTURE//,/-}"
5652
arch_args=()
5753
if [[ -n "$SDK_MACOS_ARCH" ]]; then arch_args+=(-DCMAKE_OSX_ARCHITECTURES="$SDK_MACOS_ARCH"); fi
5854
cmake -S src/tests/packaging -B "$build_dir" -G Ninja \
5955
-DCMAKE_BUILD_TYPE="$SDK_BUILD_TYPE" -DCMAKE_PREFIX_PATH="$bundle" \
60-
-DLIVEKIT_EXPECT_CAPTURE="$SDK_CAPTURE" -DLIVEKIT_EXPECT_SOURCES="$SDK_EXPECTED_SOURCES" \
56+
-DLIVEKIT_CAPTURE="$SDK_CAPTURE" \
6157
-DLIVEKIT_VERIFY_PIXEL_SOURCES="$SDK_VERIFY_PIXEL_SOURCES" -DLIVEKIT_EXPECT_VERSION="$SDK_VERSION" "${arch_args[@]}"
6258
cmake --build "$build_dir" --config "$SDK_BUILD_TYPE"
6359
ctest --test-dir "$build_dir" -C "$SDK_BUILD_TYPE" --output-on-failure -L packaging
@@ -67,15 +63,14 @@ runs:
6763
env:
6864
SDK_BUNDLE_DIR: ${{ inputs.bundle-dir }}
6965
SDK_CAPTURE: ${{ inputs.capture }}
70-
SDK_EXPECTED_SOURCES: ${{ inputs.expected-sources }}
7166
SDK_VERIFY_PIXEL_SOURCES: ${{ inputs.verify-pixel-sources }}
7267
SDK_BUILD_TYPE: ${{ inputs.build-type }}
7368
SDK_VERSION: ${{ inputs.version }}
7469
run: |
7570
$bundle = Join-Path $env:GITHUB_WORKSPACE $env:SDK_BUNDLE_DIR
76-
$selection = if ($env:SDK_EXPECTED_SOURCES) { $env:SDK_EXPECTED_SOURCES } else { $env:SDK_CAPTURE }
71+
$selection = $env:SDK_CAPTURE -replace ',', '-'
7772
$buildDir = Join-Path $env:RUNNER_TEMP "livekit-packaging-$selection"
78-
cmake -S src/tests/packaging -B "$buildDir" -DCMAKE_PREFIX_PATH="$bundle" -DLIVEKIT_EXPECT_CAPTURE="$env:SDK_CAPTURE" -DLIVEKIT_EXPECT_SOURCES="$env:SDK_EXPECTED_SOURCES" -DLIVEKIT_VERIFY_PIXEL_SOURCES="$env:SDK_VERIFY_PIXEL_SOURCES" -DLIVEKIT_EXPECT_VERSION="$env:SDK_VERSION"
73+
cmake -S src/tests/packaging -B "$buildDir" -DCMAKE_PREFIX_PATH="$bundle" -DLIVEKIT_CAPTURE="$env:SDK_CAPTURE" -DLIVEKIT_VERIFY_PIXEL_SOURCES="$env:SDK_VERIFY_PIXEL_SOURCES" -DLIVEKIT_EXPECT_VERSION="$env:SDK_VERSION"
7974
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
8075
cmake --build "$buildDir" --config "$env:SDK_BUILD_TYPE"
8176
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }

‎.github/workflows/builds.yml‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ jobs:
166166
uses: ./.github/actions/build-sdk
167167
with:
168168
preset: release-examples
169-
capture: 'OFF'
169+
capture: 'none'
170170
bundle-dir: sdk-out/livekit-sdk-${{ matrix.name }}
171171
macos-arch: ${{ matrix.macos_arch || '' }}
172172

@@ -182,7 +182,7 @@ jobs:
182182
uses: ./.github/actions/test-sdk-bundle
183183
with:
184184
bundle-dir: sdk-out/livekit-sdk-${{ matrix.name }}
185-
capture: 'OFF'
185+
capture: 'none'
186186
macos-arch: ${{ matrix.macos_arch || '' }}
187187

188188
# ---------- Upload artifacts ----------
@@ -204,7 +204,7 @@ jobs:
204204
uses: ./.github/actions/build-sdk
205205
with:
206206
preset: release-examples
207-
capture: 'ON'
207+
capture: 'all'
208208
bundle-dir: sdk-out/livekit-sdk-${{ matrix.name }}-capture
209209
macos-arch: ${{ matrix.macos_arch || '' }}
210210

@@ -219,7 +219,7 @@ jobs:
219219
uses: ./.github/actions/test-sdk-bundle
220220
with:
221221
bundle-dir: sdk-out/livekit-sdk-${{ matrix.name }}-capture
222-
capture: 'ON'
222+
capture: 'all'
223223
macos-arch: ${{ matrix.macos_arch || '' }}
224224

225225
- name: Upload capture SDK bundle

‎.github/workflows/make-release.yml‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ jobs:
174174
uses: ./.github/actions/build-sdk
175175
with:
176176
preset: release-examples
177-
capture: 'OFF'
177+
capture: 'none'
178178
bundle-dir: sdk-out/livekit-sdk-${{ matrix.name }}-${{ steps.version.outputs.version }}
179179
version: ${{ steps.version.outputs.version }}
180180
macos-arch: ${{ matrix.macos_arch || '' }}
@@ -194,7 +194,7 @@ jobs:
194194
uses: ./.github/actions/test-sdk-bundle
195195
with:
196196
bundle-dir: sdk-out/livekit-sdk-${{ matrix.name }}-${{ steps.version.outputs.version }}
197-
capture: 'OFF'
197+
capture: 'none'
198198
macos-arch: ${{ matrix.macos_arch || '' }}
199199
version: ${{ steps.version.outputs.version }}
200200

@@ -207,7 +207,7 @@ jobs:
207207
uses: ./.github/actions/build-sdk
208208
with:
209209
preset: release-examples
210-
capture: 'ON'
210+
capture: 'all'
211211
bundle-dir: sdk-out/livekit-sdk-${{ matrix.name }}-capture-${{ steps.version.outputs.version }}
212212
version: ${{ steps.version.outputs.version }}
213213
macos-arch: ${{ matrix.macos_arch || '' }}
@@ -223,7 +223,7 @@ jobs:
223223
uses: ./.github/actions/test-sdk-bundle
224224
with:
225225
bundle-dir: sdk-out/livekit-sdk-${{ matrix.name }}-capture-${{ steps.version.outputs.version }}
226-
capture: 'ON'
226+
capture: 'all'
227227
macos-arch: ${{ matrix.macos_arch || '' }}
228228
version: ${{ steps.version.outputs.version }}
229229

‎.github/workflows/tests.yml‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -318,15 +318,15 @@ jobs:
318318
uses: ./.github/actions/build-sdk
319319
with:
320320
preset: ${{ inputs.build_type }}
321-
capture: 'OFF'
321+
capture: 'none'
322322
bundle-dir: sdk-out/test-sdk-standard
323323
macos-arch: ${{ matrix.macos_arch || '' }}
324324

325325
- name: Test installed standard SDK
326326
uses: ./.github/actions/test-sdk-bundle
327327
with:
328328
bundle-dir: sdk-out/test-sdk-standard
329-
capture: 'OFF'
329+
capture: 'none'
330330
macos-arch: ${{ matrix.macos_arch || '' }}
331331
build-type: ${{ inputs.build_type == 'debug' && 'Debug' || 'Release' }}
332332

@@ -347,15 +347,15 @@ jobs:
347347
uses: ./.github/actions/build-sdk
348348
with:
349349
preset: ${{ inputs.build_type }}-tests
350-
capture: ${{ matrix.name == 'macos-x64' && 'OFF' || 'ON' }}
350+
capture: ${{ matrix.name == 'macos-x64' && 'none' || 'all' }}
351351
bundle-dir: sdk-out/test-sdk-tests
352352
macos-arch: ${{ matrix.macos_arch || '' }}
353353

354354
- name: Test installed SDK used by tests
355355
uses: ./.github/actions/test-sdk-bundle
356356
with:
357357
bundle-dir: sdk-out/test-sdk-tests
358-
expected-sources: ${{ matrix.name == 'macos-x64' && 'none' || 'all' }}
358+
capture: ${{ matrix.name == 'macos-x64' && 'none' || 'all' }}
359359
verify-pixel-sources: ${{ matrix.selective_capture || (inputs.extended_capture_sources && runner.os == 'macOS' && matrix.extended_capture) }}
360360
macos-arch: ${{ matrix.macos_arch || '' }}
361361
build-type: ${{ inputs.build_type == 'debug' && 'Debug' || 'Release' }}

‎.gitignore‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,5 @@ web/
3939
*trace.json
4040
compile_commands.json
4141
user_stories
42+
sdk-out/
43+
capture-tester/

‎.gitmodules‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[submodule "client-sdk-rust"]
22
path = client-sdk-rust
3-
url = https://github.com/livekit/client-sdk-rust
3+
url = https://github.com/livekit/rust-sdks.git
44
[submodule "cpp-example-collection"]
55
path = cpp-example-collection
66
url = https://github.com/livekit-examples/cpp-example-collection.git

‎CMakeLists.txt‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ include(warnings)
1919
option(LIVEKIT_BUILD_EXAMPLES "Build LiveKit examples" OFF)
2020
option(LIVEKIT_BUILD_TESTS "Build LiveKit tests" OFF)
2121
# Capture sources for the Rust FFI. Comma-separated subset of gstreamer,
22-
# pattern, clock; or all / none / ON / OFF (aliases). Empty means none.
22+
# pattern, and clock, or all / none. Empty means none.
2323
set(LIVEKIT_CAPTURE "" CACHE STRING
2424
"Capture sources: none, all, or comma-separated gstreamer,pattern,clock")
2525
set_property(CACHE LIVEKIT_CAPTURE PROPERTY STRINGS
26-
"" none all gstreamer pattern clock ON OFF)
26+
"" none all gstreamer pattern clock)
2727

2828
# vcpkg is only used on Windows; Linux/macOS use system package managers
2929
if(WIN32)
@@ -180,9 +180,9 @@ set(LIVEKIT_CAPTURE_ENABLED 0)
180180
string(STRIP "${LIVEKIT_CAPTURE}" _lk_capture)
181181
string(TOLOWER "${_lk_capture}" _lk_capture_lower)
182182
set(_lk_capture_tokens "")
183-
if(_lk_capture_lower STREQUAL "" OR _lk_capture_lower STREQUAL "none" OR _lk_capture_lower STREQUAL "off")
183+
if(_lk_capture_lower STREQUAL "" OR _lk_capture_lower STREQUAL "none")
184184
# Capture disabled.
185-
elseif(_lk_capture_lower STREQUAL "all" OR _lk_capture_lower STREQUAL "on")
185+
elseif(_lk_capture_lower STREQUAL "all")
186186
set(_lk_capture_tokens "clock;gstreamer;pattern")
187187
else()
188188
string(REPLACE "," ";" _lk_capture_tokens "${_lk_capture_lower}")
@@ -202,7 +202,7 @@ foreach(_token IN LISTS _lk_capture_tokens)
202202
else()
203203
message(FATAL_ERROR
204204
"Unknown LIVEKIT_CAPTURE source '${_token}'. "
205-
"Expected: gstreamer, pattern, clock, all, none, ON, or OFF.")
205+
"Expected: gstreamer, pattern, clock, all, or none.")
206206
endif()
207207
endforeach()
208208
if(_lk_capture_features)

‎build.cmd‎

Lines changed: 47 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,12 @@ if /I "!ARG:~0,10!"=="--capture=" (
9898
exit /b 1
9999
)
100100
shift
101-
goto parse_all
101+
goto :collect_capture_tokens
102102
)
103103
if /I "%~1"=="--capture" (
104-
set "CAPTURE_OVERRIDE=all"
104+
set "CAPTURE_OVERRIDE="
105105
shift
106-
goto parse_all
106+
goto :collect_capture_tokens
107107
)
108108
if /I "%~1"=="--no-capture" (
109109
set "CAPTURE_OVERRIDE=none"
@@ -143,7 +143,51 @@ set "PREFIX=%~1"
143143
shift
144144
goto parse_all
145145

146+
REM cmd.exe splits unquoted commas and equals signs. Rejoin source names that
147+
REM followed --capture so --capture=pattern,clock reaches CMake intact.
148+
:collect_capture_tokens
149+
if "%~1"=="" goto :finish_capture_tokens
150+
set "NEXT=%~1"
151+
if /I "!NEXT!"=="gstreamer" goto :append_capture_token
152+
if /I "!NEXT!"=="pattern" goto :append_capture_token
153+
if /I "!NEXT!"=="clock" goto :append_capture_token
154+
if /I "!NEXT!"=="all" goto :append_capture_token
155+
if /I "!NEXT!"=="none" goto :append_capture_token
156+
goto :finish_capture_tokens
157+
158+
:append_capture_token
159+
if defined CAPTURE_OVERRIDE (
160+
set "CAPTURE_OVERRIDE=!CAPTURE_OVERRIDE!,!NEXT!"
161+
) else (
162+
set "CAPTURE_OVERRIDE=!NEXT!"
163+
)
164+
shift
165+
goto :collect_capture_tokens
166+
167+
:finish_capture_tokens
168+
if not defined CAPTURE_OVERRIDE set "CAPTURE_OVERRIDE=all"
169+
goto parse_all
170+
171+
:validate_capture
172+
set "CAPTURE_CHECK=!CAPTURE_OVERRIDE!"
173+
set "CAPTURE_CHECK=!CAPTURE_CHECK: =!"
174+
if /I "!CAPTURE_CHECK!"=="" exit /b 0
175+
if /I "!CAPTURE_CHECK!"=="none" exit /b 0
176+
if /I "!CAPTURE_CHECK!"=="all" exit /b 0
177+
set "CAPTURE_CHECK=!CAPTURE_CHECK:,= !"
178+
set "CAPTURE_INVALID="
179+
for %%T in (!CAPTURE_CHECK!) do (
180+
if /I not "%%T"=="gstreamer" if /I not "%%T"=="pattern" if /I not "%%T"=="clock" (
181+
echo ERROR: Unknown capture source '%%T'. Expected: gstreamer, pattern, clock, all, or none.
182+
set "CAPTURE_INVALID=1"
183+
)
184+
)
185+
if defined CAPTURE_INVALID exit /b 1
186+
exit /b 0
187+
146188
:after_parse
189+
call :validate_capture
190+
if errorlevel 1 exit /b 1
147191
if not defined CMD (
148192
echo ERROR: No command specified
149193
call :usage

0 commit comments

Comments
 (0)