webrtc
webrtc copied to clipboard
Begin creation of an SFU project
👋 Hi!
I've been working a bit on a SFU example to add to the examples in https://github.com/webrtc-rs/examples/pull/15.
This is a good starting point for what I think is the next logical step for the project: starting an official SFU project similar to the relationship between the Ion SFU and the Pion project.
If everyone agrees, seems like the starting point would be workshopping the goals in this ticket on how we want to start, what goals we want to set, and then start a new repository.
I created the SFU repo : https://github.com/webrtc-rs/sfu you can work on this dedicated SFU repo
@rainliu I've been working on an SFU based on webrtc.rs called switchboard https://github.com/billylindeman/switchboard
It's based on / compatible with pion/ion-sfu https://github.com/pion/ion-sfu :)
Would love to make this an upstream project at some point!
Hi guys, I'm happy to share a new webrtc-rs based SFU project here in the very beginning of 2023.
We, Embracer Freemode, are open sourcing our SFU project under MIT/APACHE-2.0 license!
Feel free to give it a try.
repo: https://github.com/embracer-freemode/weever-streaming
Here is a demo video (with ugly demo site :p):
Features
- 1 HTTP POST for connection setup
- subscriber multistream
- 1 connection for any amount of stream subscribing (
O(1)
port usage) - publisher is 1 connection for each stream publishing (
O(N)
port usage)
- 1 connection for any amount of stream subscribing (
- (optional) authentication via Bearer Token
-
WHIP-like media ingress
- it's WHIP-"like" because there is no guarantee about spec compliance
- but this project learned the idea from there
-
WHEP-like media egress
- it's WHEP-"like" because there is no guarantee about spec compliance
- this project implemented similar idea before there is WHEP spec release
- shared internal states across SFU instances (currently via Redis)
- internal traffic routing across SFU instances (currently via NATS)
Background Story
The project was started in Sep 2021 (about 1 year and 4 monthes ago). WebRTC streaming was part of our focus back then. After using Janus for a while, we decided to build our own SFU based on webrtc-rs. I set the SFU goal to be easy scaling, our biggest issue at that time. To make development quicker, I reuse Redis and NATS for internal data sharing. In the end, I got pretty good result (not perfect, but good enough as a first try).
This project was deployed to our Kubernetes cluster. With StatefulSet setup and a LoadBalancer. We used this for our team meeting (as user testing) for a while.
We switched focus around April 2022. WebRTC streaming is not our core focus now. By the end of the 2022, company allows me to make this project open source. (Technically, I'm the only developer for this SFU project.)
Before open sourcing, I've updated couple dependencies and do a quick round of manual testing. The webrtc-rs is currently lock at commit 242db9d6 (2022/11/11), later commits seem to break something.
There is only ugly demo website in repo for now. We have a prettier website for streaming. But that's not built by me, and it's out of this open sourcing scope.
Future Works
- test cases (nothing right now :p)
- refactor
- more streaming features
- prettier demo website
- optimize CPU usage
- maybe in-house backbone that can replace current Redis & NATS usage
Misc
There is no relationship with pion/ion-sfu. Not compatible with pion/ion-sfu.
Depends on the webrtc-rs library, xiu now can support whip/whep. (https://github.com/harlanc/xiu/releases/tag/v0.9.1).