Skip to content

This is the source code of the WebRTC client stack built in Rust for the voice/screenshare functionality of noor.to app.

License

Notifications You must be signed in to change notification settings

inline-chat/webrtc-client-rust

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

An implementation of WebRTC client stack built in Rust

Warning: This will not run or compile. This is stripped away from the noor.to application, and is only for educational purposes.

What is this?

When we started building Noor in Tauri, we didn't want to use the WebKit WebRTC implementation. We wanted more control over the voice and screen sharing to achieve lower latency, higher quality, better performance, and a less-resource-intensive call experience. So we built this from scratch and learnt Rust and a whole lot about WebRTC and media processing while doing it.

It would've been super helpful if I had an easy-to-read open source implementation for a client stack to learn from. Since most of the WebRTC projects are for server side implementations, I'm sharing this to help other developers building cool client WebRTC applications without relying on libWebRTC if they don't need the whole thing.

What exactly is implemented here?

This implements voice chat (cross-platform, built primarly for macOS but tested on Linux) and screen sharing (macOS-only). Specifically, it supports:

  • WebRTC peer to peer connection
  • WebRTC signaling and reconnection
  • TURN / STUN / ICE
  • Audio capture
  • Audio processing
  • Audio echo and noise cancellation
  • Audio encoding and decoding
  • Audio resampling
  • Audio jitter buffer
  • Audio playback
  • Screen capture
  • Hardware accelerated encoding and decoding
  • GPU rendering on a CALayer (macOS)

I didn't get to finish the screen sharing part the way I wanted to, but it can be used as a starting point to get a basic idea of how an implementation would look like.

Code guide

The file names are self-explanatory. However here's a few starting points:

Thanks to...

We used amazing open-source libraries to build this:

And many other crates for building the application itself, mainly, Tauri.

While developing this, we contributed back to some of the crates mentioned above. One of which that I really enjoyed was adding support for keyboard noise cancellation through the libWebRTC's AEC to the webrtc-audio-processing crate after a lot of reading through the WebRTC codebase for the first time I was looking at it.

LICENSE

This code is licensed under the MIT license. See the LICENSE file for more details.

About

This is the source code of the WebRTC client stack built in Rust for the voice/screenshare functionality of noor.to app.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published