<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>webrtc-sys/README.md - fork/rust-sdks @ livekit/livekit-ffi@0.13.0</title>
<meta name="description" content="webrtc-sys/README.md in fork/rust-sdks at livekit/livekit-ffi@0.13.0.">
<meta property="og:title" content="webrtc-sys/README.md - fork/rust-sdks @ livekit/livekit-ffi@0.13.0">
<meta property="og:description" content="webrtc-sys/README.md in fork/rust-sdks at livekit/livekit-ffi@0.13.0.">
<meta property="og:type" content="website">
<meta property="og:site_name" content="git.julia.blue">
<link rel="stylesheet" href="/css/style.css?v=62">
<script type="module" src="/js/main.js?v=62"></script>
</head>
<body>
<main data-ref="livekit/livekit-ffi@0.13.0" data-tip="aea9f4e47dbcb0d34d146bfe315f75e5bfd63cc2">
<noscript>
  <div class="callout">
    <p>
      hey! this is a static git repo viewer. commit diffs, file history,
      older commits and other revisions won't load without javascript.
    </p>
    <p>
      you are still able to view source files on branch/tag tips,
      but the experience is degraded.
    </p>
  </div>
</noscript>
<header class="repo"><div>
<h1>fork/rust-sdks</h1>
</div>
<pre class="clone">git clone https://git.julia.blue/fork/rust-sdks</pre>
</header>
<p class="snapshot-commit"><span class="commit-author">Théo Monnom</span><span class="commit-message" data-commit="4411f88b685092dd095ae254cb4ed43d0901df26">added useful note about webrtc-sys (#38)</span><span class="snapshot-sha sha" data-commit="4411f88b685092dd095ae254cb4ed43d0901df26">4411f88</span><time datetime="2023-02-07T00:05:07+01:00" title="2023-02-07 00:05:07 +0100">2023-02-07</time></p>
<header class="topbar"><details class="switcher"><summary>livekit/livekit-ffi@0.13.0</summary><div class="menu"><strong>branches</strong><a href="/fork/rust-sdks/ref/main/">main</a><strong>tags</strong><a class="current" href="/fork/rust-sdks/ref/livekit/livekit-ffi%400.13.0/">livekit/livekit-ffi@0.13.0</a><a href="/fork/rust-sdks/ref/rust-sdks/livekit-ffi%400.12.15/">rust-sdks/livekit-ffi@0.12.15</a><a href="/fork/rust-sdks/ref/rust-sdks/livekit-ffi%400.12.16/">rust-sdks/livekit-ffi@0.12.16</a><a href="/fork/rust-sdks/ref/rust-sdks/livekit-ffi%400.12.17/">rust-sdks/livekit-ffi@0.12.17</a><a href="/fork/rust-sdks/ref/rust-sdks/livekit-ffi%400.12.18/">rust-sdks/livekit-ffi@0.12.18</a><a href="/fork/rust-sdks/ref/rust-sdks/livekit-ffi%400.12.19/">rust-sdks/livekit-ffi@0.12.19</a><a href="/fork/rust-sdks/ref/rust-sdks/livekit%400.7.7/">rust-sdks/livekit@0.7.7</a><a href="/fork/rust-sdks/ref/rust-sdks/livekit%400.7.8/">rust-sdks/livekit@0.7.8</a><a class="all" href="/fork/rust-sdks/refs">all refs →</a></div></details><nav class="crumbs"><a href="/fork/rust-sdks/">rust-sdks</a> / <a href="/fork/rust-sdks/ref/livekit/livekit-ffi%400.13.0/tree/webrtc-sys/">webrtc-sys</a> / <span class="cur">README.md</span></nav>
<span class="view-stats"><span>834 B</span><span>16 lines</span></span><span class="actions"><a class="raw" href="/fork/rust-sdks/raw/f3c044694b8f6a8cf0b13048bd26765287c92a56/webrtc-sys/README.md">raw</a></span></header>
<div class="markdown-view"><input type="radio" name="markdown-view" id="markdown-rendered" checked><label for="markdown-rendered">rendered</label><input type="radio" name="markdown-view" id="markdown-code"><label for="markdown-code">code</label><section class="readme rendered"><h1>webrtc-sys</h1>
<p>This crate provides wrapper over the WebRTC API for use from Rust.
We use the crate <a href="https://cxx.rs/">cxx.rs</a> to simplify our bindings.</p>
<h2>Wrappers</h2>
<p>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).</p>
<p>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).</p>
<h2>Code</h2>
<p>We also use this C++ code to provide other needed utilities/features on the Rust side (e.g: tiny bindings to libyuv).</p>
</section><div class="code-panel"><pre class="code src language-markdown"><span class="code-line"><a class="ln" id="L1" href="#L1">1</a><span class="code-text"><a-p>#</a-p> <a-tt>webrtc-sys</a-tt></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L2" href="#L2">2</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L3" href="#L3">3</a><span class="code-text">This crate provides wrapper over the WebRTC API for use from Rust.</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L4" href="#L4">4</a><span class="code-text">We use the crate [cxx.rs](https://cxx.rs/) to simplify our bindings.</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L5" href="#L5">5</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L6" href="#L6">6</a><span class="code-text"><a-p>##</a-p> <a-tt>Wrappers</a-tt></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L7" href="#L7">7</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L8" href="#L8">8</a><span class="code-text">Most of our wrappers use the cxx.rs types compatible with Rust.</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L9" href="#L9">9</a><span class="code-text">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).</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L10" href="#L10">10</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L11" href="#L11">11</a><span class="code-text">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).</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L12" href="#L12">12</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L13" href="#L13">13</a><span class="code-text"><a-p>##</a-p> <a-tt>Code</a-tt></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L14" href="#L14">14</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L15" href="#L15">15</a><span class="code-text">We also use this C++ code to provide other needed utilities/features on the Rust side (e.g: tiny bindings to libyuv).</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L16" href="#L16">16</a><span class="code-text"></span></span></pre></div></div>
</main>
</body>
</html>
