12 releases

0.3.5 Sep 5, 2024
0.3.3 Aug 22, 2024
0.3.2 Feb 28, 2024
0.2.1-alpha Sep 22, 2023
0.1.1 Jan 12, 2023

#177 in Video

Download history 110/week @ 2024-07-30 105/week @ 2024-08-06 124/week @ 2024-08-13 174/week @ 2024-08-20 103/week @ 2024-08-27 416/week @ 2024-09-03 197/week @ 2024-09-10 825/week @ 2024-09-17 87/week @ 2024-09-24 266/week @ 2024-10-01 529/week @ 2024-10-08 626/week @ 2024-10-15 708/week @ 2024-10-22 803/week @ 2024-10-29 421/week @ 2024-11-05 377/week @ 2024-11-12

2,485 downloads per month
Used in 5 crates (2 directly)

Apache-2.0

245KB
5.5K SLoC

C++ 2.5K SLoC // 0.1% comments Rust 2K SLoC // 0.1% comments Shell 380 SLoC // 0.2% comments Batch 68 SLoC Objective-C++ 39 SLoC // 0.4% 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
~66K SLoC