webrtc icon indicating copy to clipboard operation
webrtc copied to clipboard

Begin creation of an SFU project

Open srcrip opened this issue 2 years ago • 4 comments

👋 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.

srcrip avatar Jun 23 '22 16:06 srcrip

I created the SFU repo : https://github.com/webrtc-rs/sfu you can work on this dedicated SFU repo

rainliu avatar Jun 23 '22 19:06 rainliu

@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!

billylindeman avatar Oct 04 '22 18:10 billylindeman

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):

SFU demo

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)
  • (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.

wdv4758h avatar Jan 03 '23 06:01 wdv4758h

Depends on the webrtc-rs library, xiu now can support whip/whep. (https://github.com/harlanc/xiu/releases/tag/v0.9.1).

harlanc avatar Oct 20 '23 02:10 harlanc