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
2 changes: 1 addition & 1 deletion .github/workflows/builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,4 @@ jobs:
ln -sf $ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/lib/${{ matrix.ndk_arch }}/{libunwind.so,libc++abi.a} $ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/lib/
cargo install cargo-ndk
# FIXME: wgpu_room does not link on aarch64
cargo ndk --target ${{ matrix.target }} build --release -p livekit --workspace --exclude wgpu_room -vv
cargo ndk --target ${{ matrix.target }} build --release -p livekit --workspace -vv
4 changes: 0 additions & 4 deletions .github/workflows/ffi-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,23 +89,20 @@ jobs:
dylib: liblivekit_ffi.so
jar: libwebrtc.jar
target: aarch64-linux-android
ndk_arch: aarch64-unknown-linux-musl
name: ffi-android-arm64
buildargs: --no-default-features --features "rustls-tls-webpki-roots"
- os: ubuntu-latest
platform: android
dylib: liblivekit_ffi.so
jar: libwebrtc.jar
target: armv7-linux-androideabi
ndk_arch: arm-unknown-linux-musleabihf
name: ffi-android-armv7
buildargs: --no-default-features --features "rustls-tls-webpki-roots"
- os: ubuntu-latest
platform: android
dylib: liblivekit_ffi.so
jar: libwebrtc.jar
target: x86_64-linux-android
ndk_arch: x86_64-unknown-linux-musl
name: ffi-android-x86_64
buildargs: --no-default-features --features "rustls-tls-webpki-roots"

Expand Down Expand Up @@ -171,7 +168,6 @@ jobs:
if: ${{ matrix.platform == 'android' }}
run: |
cd livekit-ffi/
ln -sf $ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/lib/${{ matrix.ndk_arch }}/{libunwind.so,libc++abi.a} $ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/lib/
cargo install cargo-ndk
cargo ndk --target ${{ matrix.target }} build --release ${{ matrix.buildargs }}
Expand Down
4 changes: 2 additions & 2 deletions examples/wgpu_room/src/logo_track.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ impl LogoTrack {
LocalTrack::Video(track.clone()),
TrackPublishOptions {
source: TrackSource::Camera,
simulcast: false,
video_codec: VideoCodec::H264,
simulcast: true,
video_codec: VideoCodec::H265,
..Default::default()
},
)
Expand Down
1 change: 1 addition & 0 deletions livekit-ffi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ from_variants = "1.0.2"

[target.'cfg(target_os = "android")'.dependencies]
jni = "0.21.1"
link-cplusplus = { version = "1", features = ["nothing"] }

[build-dependencies]
prost-build = "0.14.1"
Expand Down
9 changes: 3 additions & 6 deletions webrtc-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,10 +249,11 @@ fn main() {

println!("cargo:rustc-link-lib=EGL");
println!("cargo:rustc-link-lib=OpenSLES");
println!("cargo:rustc-link-lib=c++_static");
println!("cargo:rustc-link-lib=c++abi");

configure_android_sysroot(&mut builder);

builder.file("src/android.cpp").flag("-std=c++20").cpp_link_stdlib("c++_static");
builder.file("src/android.cpp").flag("-std=c++20");
}
_ => {
panic!("Unsupported target, {}", target_os);
Expand Down Expand Up @@ -340,10 +341,6 @@ fn configure_darwin_sysroot(builder: &mut cc::Build) {

fn configure_android_sysroot(builder: &mut cc::Build) {
let toolchain = webrtc_sys_build::android_ndk_toolchain().unwrap();
let toolchain_lib = toolchain.join("lib");

let sysroot = toolchain.join("sysroot").canonicalize().unwrap();
println!("cargo:rustc-link-search={}", toolchain_lib.display());

builder.flag(format!("-isysroot{}", sysroot.display()).as_str());
}
2 changes: 1 addition & 1 deletion webrtc-sys/build/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use regex::Regex;
use reqwest::StatusCode;

pub const SCRATH_PATH: &str = "livekit_webrtc";
pub const WEBRTC_TAG: &str = "webrtc-ebd5a9f";
pub const WEBRTC_TAG: &str = "webrtc-ebd5a9f-2";
pub const IGNORE_DEFINES: [&str; 2] = ["CR_CLANG_REVISION", "CR_XCODE_VERSION"];

pub fn target_os() -> String {
Expand Down
6 changes: 5 additions & 1 deletion webrtc-sys/libwebrtc/build_android.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,10 @@ git apply "$COMMAND_DIR/patches/ssl_verify_callback_with_native_handle.patch" -v
git apply "$COMMAND_DIR/patches/add_deps.patch" -v --ignore-space-change --ignore-whitespace --whitespace=nowarn
git apply "$COMMAND_DIR/patches/android_use_libunwind.patch" -v --ignore-space-change --ignore-whitespace --whitespace=nowarn

cd ..
cd third_party/libyuv
git apply "$COMMAND_DIR/patches/disable_sme_for_libyuv.patch" -v --ignore-space-change --ignore-whitespace --whitespace=nowarn

cd ../../..

mkdir -p "$ARTIFACTS_DIR/lib"

Expand All @@ -95,6 +98,7 @@ args="is_debug=$debug \
is_component_build=false \
enable_stripping=true \
rtc_use_h264=false \
rtc_use_h265=true \
rtc_use_pipewire=false \
symbol_level=0 \
enable_iterator_debugging=false \
Expand Down
13 changes: 13 additions & 0 deletions webrtc-sys/libwebrtc/patches/disable_sme_for_libyuv.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/libyuv.gni b/libyuv.gni
index 3334df70..9859a121 100644
--- a/libyuv.gni
+++ b/libyuv.gni
@@ -24,7 +24,7 @@ declare_args() {
# errors on Fuchsia, macOS, and compilation errors on Windows.
# TODO: bug 359006069 - Remove the restriction after the linker and
# compilation errors are fixed.
- libyuv_use_sme = current_cpu == "arm64" && (is_linux || is_android)
+ libyuv_use_sme = current_cpu == "arm64" && (is_linux)
libyuv_use_msa =
(current_cpu == "mips64el" || current_cpu == "mipsel") && mips_use_msa
libyuv_use_mmi =
Comment thread
cloudwebrtc marked this conversation as resolved.
13 changes: 8 additions & 5 deletions webrtc-sys/src/objc_video_factory.mm
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,23 @@

#include "livekit/objc_video_factory.h"

#import <sdk/objc/components/video_codec/RTCVideoDecoderFactoryH264.h>
#import <sdk/objc/components/video_codec/RTCVideoEncoderFactoryH264.h>
#import <sdk/objc/components/video_codec/RTCDefaultVideoDecoderFactory.h>
#import <sdk/objc/components/video_codec/RTCDefaultVideoEncoderFactory.h>
#import <sdk/objc/components/video_codec/RTCVideoEncoderFactorySimulcast.h>
#include "sdk/objc/native/api/video_decoder_factory.h"
#include "sdk/objc/native/api/video_encoder_factory.h"

namespace livekit {

std::unique_ptr<webrtc::VideoEncoderFactory> CreateObjCVideoEncoderFactory() {
// TODO(theomonnom): Simulcast?
return webrtc::ObjCToNativeVideoEncoderFactory([[RTCVideoEncoderFactoryH264 alloc] init]);
RTCDefaultVideoEncoderFactory* encoderFactory = [[RTCDefaultVideoEncoderFactory alloc] init];
RTCVideoEncoderFactorySimulcast* simulcastFactory =
[[RTCVideoEncoderFactorySimulcast alloc] initWithPrimary:encoderFactory fallback:encoderFactory];
return webrtc::ObjCToNativeVideoEncoderFactory(simulcastFactory);
}

std::unique_ptr<webrtc::VideoDecoderFactory> CreateObjCVideoDecoderFactory() {
return webrtc::ObjCToNativeVideoDecoderFactory([[RTCVideoDecoderFactoryH264 alloc] init]);
return webrtc::ObjCToNativeVideoDecoderFactory([[RTCDefaultVideoDecoderFactory alloc] init]);
}

} // namespace livekit