meetecho / simple-whip-server

Simple WHIP Server (based on the Janus WebRTC Server)
GNU General Public License v3.0
93 stars 24 forks source link

Support for RTP forwarding in WHIP server #2

Closed lminiero closed 3 years ago

lminiero commented 3 years ago

While the WHIP server is only meant as a proof of concept to show how you can use WHIP as a frontend to Janus, I thought it may make sense to expand on it a bit. Specifically, the WHIP server currently only allows you to ingest a WebRTC stream in a VideoRoom room: this means the stream can, out of the box, only be consumed via that VideoRoom on the same Janus instance. As people familiar with Janus will know, RTP forwarding is an easy way to help implementing scalability of streams sent to a VideoRoom. This patch allows the WHIP server to automatically RTP forward a published stream to a provided external address: how this stream is then handled outside of Janus is out of scope.

To do so, you just add a recipient attribute when creating a WHIP endpoint, which needs to include host, audioPort, videoPort and/or videoRtcpPort of the recipient (e.g., a Streaming plugin mountpoint). Notice that, if the VideoRoom is configured to require a secret and/or admin key to do RTP forwarding, you'll need to pass secret and/or adminKey to the create request as well.

lminiero commented 3 years ago

Merging.