webrtc-rs / util Goto Github PK
View Code? Open in Web Editor NEWUtilities for WebRTC.rs stack
Home Page: https://webrtc.rs
License: Apache License 2.0
Utilities for WebRTC.rs stack
Home Page: https://webrtc.rs
License: Apache License 2.0
I have a problem with mDNS package on old armv5te platforms
Armv5te doesn't support AtomicU64 and AtomicI64 types
https://doc.rust-lang.org/std/sync/atomic/#portability
this types are using in "vnet" mod.. Can we hide it behind cargo feature or change it to AtomicU32 and AtomicI32 for support this platform?
mDNS package doesn't use vnet module but has this dependency
currently we use https://crates.io/crates/ifaces to retrieve network interface information, but it only works for linux platform.
we need to implement or wrap some crates for all platforms
Lines 26 to 36 in 2d193c0
This is required to implement Write
trait
Hi, when i compile this project for android using cargo ndk ,i set target sdk = 30 in android studio project. then the api ifaces() return fail.
according to https://developer.android.google.cn/training/articles/user-data-ids?hl=en that article ,i downgrade the target version to 29 and it works.
but sdk target 30 or above was google play needed after 2021 .so how can i do?
I write a small example examples/display-interfaces.rs
to test ifaces
:
use std::error::Error;
use webrtc_util::ifaces::ifaces;
fn main() -> Result<(), Box<dyn Error>> {
let interfaces = ifaces()?;
for (index, interface) in interfaces.iter().enumerate() {
println!("{} {:?}", index, interface);
}
Ok(())
}
I have following toolchain config in ~/.cargo/config
:
[target.i686-linux-android]
ar = "/Users/ignis/Library/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/darwin-x86_64/bin/llvm-ar"
linker = "/Users/ignis/Library/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/darwin-x86_64/bin/i686-linux-android21-clang"
Build commands:
# required by `cc` crate
export CC=/Users/ignis/Library/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/darwin-x86_64/bin/i686-linux-android21-clang
export CXX=/Users/ignis/Library/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/darwin-x86_64/bin/i686-linux-android21-clang++
export AR=export AR=/Users/ignis/Library/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/darwin-x86_64/bin/llvm-ar
# cross build
cargo build --target i686-linux-android --example display-interfaces
Here is what I got:
= note: src/ifaces/ffi/android/ifaddrs.cpp:182: error: undefined reference to 'operator new(unsigned int)'
src/ifaces/ffi/android/ifaddrs.cpp:182: error: undefined reference to 'operator delete(void*)'
src/ifaces/ffi/android/LocalArray.h:39: error: undefined reference to 'operator new[](unsigned int)'
src/ifaces/ffi/android/ifaddrs.cpp:69: error: undefined reference to 'operator new[](unsigned int)'
src/ifaces/ffi/android/ifaddrs.cpp:92: error: undefined reference to 'operator new(unsigned int)'
src/ifaces/ffi/android/ifaddrs.cpp:103: error: undefined reference to 'operator new(unsigned int)'
src/ifaces/ffi/android/LocalArray.h:49: error: undefined reference to 'operator delete[](void*)'
src/ifaces/ffi/android/ifaddrs.cpp:202: error: undefined reference to 'operator delete(void*)'
src/ifaces/ffi/android/ifaddrs.cpp:54: error: undefined reference to 'operator delete(void*)'
src/ifaces/ffi/android/ifaddrs.cpp:55: error: undefined reference to 'operator delete[](void*)'
src/ifaces/ffi/android/ifaddrs.cpp:56: error: undefined reference to 'operator delete(void*)'
/Users/ignis/rust/util/target/i686-linux-android/debug/deps/libwebrtc_util-823b3c5896b6d105.rlib(ifaddrs.o):ifaddrs.cpp:function __clang_call_terminate: error: undefined reference to '__cxa_begin_catch'
/Users/ignis/rust/util/target/i686-linux-android/debug/deps/libwebrtc_util-823b3c5896b6d105.rlib(ifaddrs.o):ifaddrs.cpp:function __clang_call_terminate: error: undefined reference to 'std::terminate()'
/Users/ignis/rust/util/target/i686-linux-android/debug/deps/libwebrtc_util-823b3c5896b6d105.rlib(ifaddrs.o):ifaddrs.cpp:DW.ref.__gxx_personality_v0: error: undefined reference to '__gxx_personality_v0'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I can fix this by modify build.rs
like this (add .cpp(true)
):
fn main() {
if std::env::var("TARGET")
.unwrap_or_default()
.contains("android")
{
cc::Build::new()
.cpp(true) // enable c++
.file("src/ifaces/ffi/android/ifaddrs.cpp")
.compile("ifaddrs-android");
}
}
But when I try to run it on my android simulator, another error shows up:
➜ util git:(main) ✗ adb push target/i686-linux-android/debug/examples/display-interfaces /data/local/tmp
target/i686-linux-android/debug/examples/display-interfaces: 1 file pushed, 0 skipped. 94.0 MB/s (26831268 bytes in 0.272s)
➜ util git:(main) ✗ adb shell
generic_x86:/ $ cd /data/local/tmp/
generic_x86:/data/local/tmp $ chmod +x display-interfaces
generic_x86:/data/local/tmp $ ./display-interfaces
CANNOT LINK EXECUTABLE "./display-interfaces": library "libc++_shared.so" not found
Aborted
134|generic_x86:/data/local/tmp $
It seems all problems come with C++, maybe we should just get rid of it. Two ways to fix:
ifaddrs.cpp
to c versionVNET: https://github.com/pion/transport/tree/master/vnet
ICE uses vnet to test NAT.
In cases where there exists a custom underlying interface for interfacing with a UDP socket, a tokio Receiver
may be used to accept output buffers. In this case, &mut self
is required to poll the receiver, not &self
. Plus, making async interfaces accept &mut self
is preferred especially since polling interfaces usually require Pin<&mut Self>
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.