9 releases

0.3.2 Feb 28, 2024
0.3.1 Feb 28, 2024
0.3.0 Jan 11, 2024
0.2.1-alpha Sep 22, 2023
0.1.1 Jan 12, 2023

#252 in Video

Download history 20/week @ 2023-12-20 7/week @ 2023-12-27 3/week @ 2024-01-03 49/week @ 2024-01-10 3/week @ 2024-01-17 13/week @ 2024-01-24 2/week @ 2024-02-07 10/week @ 2024-02-14 22/week @ 2024-02-21 290/week @ 2024-02-28 114/week @ 2024-03-06 184/week @ 2024-03-13 38/week @ 2024-03-20 26/week @ 2024-03-27 77/week @ 2024-04-03

386 downloads per month
Used in 4 crates (2 directly)

Apache-2.0

240KB
5K SLoC

C++ 2.5K SLoC // 0.1% comments Rust 2K SLoC // 0.1% comments Shell 379 SLoC // 0.2% comments Batch 68 SLoC Objective-C++ 13 SLoC // 0.6% comments

webrtc-sys

This crate provides wrapper over the WebRTC API for use from Rust. We use the crate cxx.rs to simplify our bindings.

Wrappers

Most of our wrappers use the cxx.rs types compatible with Rust. As most of our wrappers are stateless, we allow multiple instances of a specific wrapper to point to the same underlying webrtc pointer. (e.g: multiple livekit::MediaStreamTrack pointing to the same webrtc::MediaStreamTrackInterface).

Threadsafe methods use the const keyword so we can easily call them from the Rust side without worrying about the mutability of the object. (This is similar on how Cell/UnsafeCell works but implemented on the C++ side: interior mutability).

Code

We also use this C++ code to provide other needed utilities/features on the Rust side (e.g: tiny bindings to libyuv).

Dependencies

~0.6–4MB
~65K SLoC