Skip to content
Open
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
5 changes: 5 additions & 0 deletions .changeset/fix_headless_livekit_feature_wiring.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
livekit: patch
---

Disable libwebrtc default features in workspace dependency wiring so `livekit --no-default-features -F tokio` no longer re-enables `glib-main-loop` transitively.
8 changes: 8 additions & 0 deletions .changeset/headless_linux_build_path.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
livekit: patch
webrtc-sys: patch
libwebrtc: patch
livekit-ffi: patch
---

Add headless Linux build path - #1024 (@mikefaille)
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ license = "Apache-2.0"
[workspace.dependencies]
device-info = { version = "0.1.1", path = "device-info" }
imgproc = { version = "0.3.19", path = "imgproc" }
libwebrtc = { version = "0.3.30", path = "libwebrtc" }
libwebrtc = { version = "0.3.30", path = "libwebrtc", default-features = false }
livekit = { version = "0.7.37", path = "livekit" }
livekit-api = { version = "0.4.19", path = "livekit-api" }
livekit-ffi = { version = "0.12.53", path = "livekit-ffi" }
Expand Down
2 changes: 1 addition & 1 deletion examples/local_audio/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ tokio = { workspace = true, features = ["full"] }
env_logger = { workspace = true }
livekit = { workspace = true, features = ["rustls-tls-native-roots"] }
livekit-api = { workspace = true, features = ["rustls-tls-native-roots"] }
libwebrtc = { workspace = true }
libwebrtc = { workspace = true, features = ["glib-main-loop"] }
log = { workspace = true }
cpal = "0.15"
anyhow = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion examples/local_video/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ required-features = ["desktop"]
tokio = { workspace = true, features = ["full", "parking_lot"] }
livekit = { workspace = true, features = ["rustls-tls-native-roots"] }
webrtc-sys = { workspace = true }
libwebrtc = { workspace = true }
libwebrtc = { workspace = true, features = ["glib-main-loop"] }
livekit-api = { workspace = true }
yuv-sys = { workspace = true, features = ["jpeg"] }
futures = { workspace = true }
Expand Down
3 changes: 2 additions & 1 deletion livekit/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ repository.workspace = true

[features]
# By default ws TLS is not enabled
default = ["tokio"]
default = ["tokio", "glib-main-loop"]

async = ["livekit-api/signal-client-async"]
tokio = ["livekit-api/signal-client-tokio"]
dispatcher = ["livekit-api/signal-client-dispatcher"]
glib-main-loop = ["libwebrtc/glib-main-loop"]
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Disable libwebrtc defaults for headless feature control

This adds a glib-main-loop feature toggle at the livekit level, but the libwebrtc dependency still uses its own default features, so cargo build -p livekit --no-default-features -F tokio will continue to enable libwebrtc’s default glib-main-loop path. In practice, headless Linux builds still pull GLib transitively unless libwebrtc is declared with default-features = false, which means the new documented headless flow is not actually enforced by this feature wiring.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

fixed in the following commit



# Note that the following features only change the behavior of tokio-tungstenite.
Expand Down
35 changes: 22 additions & 13 deletions webrtc-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,24 @@ use std::path::Path;
use std::path::PathBuf;
use std::{env, path, process::Command};

fn lk_headless() -> bool {
env::var("LK_HEADLESS").map(|v| v == "1" || v.eq_ignore_ascii_case("true")).unwrap_or(false)
}

fn main() {
if env::var("DOCS_RS").is_ok() {
return;
}

let target_os = env::var("CARGO_CFG_TARGET_OS").unwrap();
let target_arch = env::var("CARGO_CFG_TARGET_ARCH").unwrap();
let is_desktop = target_os == "linux" || target_os == "windows" || target_os == "macos";
let headless_linux = target_os == "linux" && lk_headless();
let is_desktop =
(target_os == "linux" || target_os == "windows" || target_os == "macos") && !headless_linux;

println!("cargo:rerun-if-env-changed=LK_DEBUG_WEBRTC");
println!("cargo:rerun-if-env-changed=LK_CUSTOM_WEBRTC");
println!("cargo:rerun-if-env-changed=LK_HEADLESS");

let mut rust_files = vec![
"src/peer_connection.rs",
Expand Down Expand Up @@ -168,20 +175,22 @@ fn main() {
println!("cargo:rustc-link-lib=dylib=pthread");
println!("cargo:rustc-link-lib=dylib=m");

// In order to avoid any ABI mismatches we use the sysroot's headers.
add_gio_headers(&mut builder);
if !headless_linux {
// In order to avoid any ABI mismatches we use the sysroot's headers.
add_gio_headers(&mut builder);

for lib_name in ["glib-2.0", "gobject-2.0", "gio-2.0"] {
pkg_config::probe_library(lib_name).unwrap();
}
for lib_name in ["glib-2.0", "gobject-2.0", "gio-2.0"] {
pkg_config::probe_library(lib_name).unwrap();
}

add_lazy_load_so(
&mut builder,
"desktop_capturer",
["drm", "gbm", "X11", "Xfixes", "Xdamage", "Xrandr", "Xcomposite", "Xext"]
.map(String::from)
.to_vec(),
);
add_lazy_load_so(
&mut builder,
"desktop_capturer",
["drm", "gbm", "X11", "Xfixes", "Xdamage", "Xrandr", "Xcomposite", "Xext"]
.map(String::from)
.to_vec(),
);
}

let x86 = target_arch == "x86_64" || target_arch == "i686";
let arm = target_arch == "aarch64" || target_arch.contains("arm");
Expand Down
Loading