From 4411f88b685092dd095ae254cb4ed43d0901df26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Monnom?= Date: Tue, 7 Feb 2023 00:05:07 +0100 Subject: [PATCH] added useful note about webrtc-sys (#38) * Create README.md * Update README.md * Update README.md * Update README.md --- webrtc-sys/README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 webrtc-sys/README.md diff --git a/webrtc-sys/README.md b/webrtc-sys/README.md new file mode 100644 index 0000000..f3c0446 --- /dev/null +++ b/webrtc-sys/README.md @@ -0,0 +1,16 @@ +# webrtc-sys + +This crate provides wrapper over the WebRTC API for use from Rust. +We use the crate [cxx.rs](https://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). +