SFU is an server based architecture that is used in webrtc to conduct multi party video calling, audio calling and data transfer.
The SFU acts an intermediary between devices that recives media streams from multiple devices and then decides which streams must be send to which devices.
WebRTC is an open source project, using which you can enable real time audio, video and data transfer between devices
WebRTC runs in web browsers as well as in apps, WebRTC is supported by almost all modern browsers and is an standard for video, audio communication
here is a step by step guide on how does an SFU work
Each participant first establishes a connection with the SFU. This process involves a signalling server where session descriptions are exchanged.
the session description contains important information, which is used to establish a session.
2. Media stream capture
On the client side the media streams are captured from the participant devices, like audio from microphone, video from camera etc. In the next step these streams are sent to the SFU
This is done using the RTP protocol or the SRTP protocol if you need encryption
2.Receipt by SFU
The SFU or the Selective forwarding unit recieves the individual streams from each connected device and maintains a seprate inbound stream for each device.
In SFU as compated to MCU all the streams are seprate from each other and there is no mixing
2. Selective Forwarding
The SFU recieves a seprate stream from each device that is connected to the SFU and then the SFU maintains a seprate stream for each participant
Before forwarding the stream to uesrs the SFU performs certain adaptations to the stream, such as chossing different quality video codecs and selecting between different simulcast streams.
These are based on the receiving client CPU and Bandwidth capabilities
2*. Forwarding Streams*
The SFU forwards the stream which each client is asking for.
The client devices could receive multiple of streams from the SFU or even a single stream of video and audio data
The media is sent in RTP or SRTP packets, and because different client devices might have different cpu and bandwidth limitations.
The SFU optimizes the streams packets to flow such that the stream flows smoothly and the video quality is smooth on the devices
Decoding: Each client recieves a RTP streams from the SFU, the client then decodes the stream and renders it on the screen
Synchronization: Audio and video synchronization is important and it is handled at the client level.The client uses the timestamps and the sequence numbers from the RTP stream to sync video and audio playback smoothly
In this section let us consider the distinctions between SFU that is Selective forwarding unit, Peer to Peer or P2p and MCU that is Multipoint Control Unit
selective forwarding: The SFU recieves multiple streams and selectively forwards the stream to devices without altering stream content
Server Based: The SFU relies on a server but the server is used for routing the steams and not for anything else.
Advantages:
Scalability: the SFU is highly scalable and it reduces the load on single client devices by managing which stream is sent to any client device
Low processing requirement: Because the SFU just forwards the stream and does not do any processing on the stream, thus reducing the latency and the cpu processing requirement
Stream flexibility:
The client devices can recive multiple streams or just one stream or no stream at all, it all depends on which stream the client device is asking for and needs to display it on the screen
Disadvantages:
Bandwidth Intensive: The SFU are bandwidth intensive on the server side because each stream is recieved by the server and the SFU should have the CPU and the bandwidth to handle all the streams
In P2p architecture each participant connects to another participant directly without the need for an intermediate server
but often a STUN server or a TURN server is required for NAT traversal and to relay the streams around NAT
if you are looking for a turn server you can consider theMetered TURN server service provider
Metered is a Global TURN server provider with TURN server all around the world, that connects to the user nearest to the TURN server for minimum latency and best performance
Disadvantages:
Each participant device must handle multiple streams if there are multiple devices in a meeting.
Which is CPU and bandwidth intensive on all the client devices. For this you can consider the Metered SFU
The MCU mixes all incoming streams and creates a single stream or few streams out of a many streams and then sends it to all the clients
The MCU requires a lot of CPU computation and resources on the server, it also creates latency when transmitting streams but it has one advantage, it can greatly reduce the computation and bandwidth requirement on client devices
When in the past the mobile devies were pretty slow and the network infrastructe was also bad, in those days MCU made a lot of sence
But these days with the advance in technology it perhaps provides a bad experience with increased latency and slow video delivery.
Here are some of the advantages of SFU in WebRTC
the most important advantage of SFU in WebRTC is scalability. You can also scale P2P video calling but it is difficult to create a mesh and scale it
When you are video calling with multiple client devices in peer 2 peer format, each client must send their stream to all the other clients and vice versa.
Because of these there is exponentially greater requirement of bandwidth as well as CPU for each client
Some client that do not have capacity for very high bandwidth and cpu compute struggle with the video calling
The SFU can make intelligent decisions regarding which streams to send to which clients thus saving imporving quality of video
The SFU can adapt the stream according to the bandwidth and CPU capacity of the recieving devices.
If the client device has lower bandwidth then the SFU can send low quality streams to that perticular device so that the video runs smoothly without buffering
The SFU handles the majority of the data processsing that is required for stream management, the client devices themsevles are freed from all the heavy lifting
This is helpful for mobilde devices and devices with low processing power that is CPU power
Client devices do not face a need for encoding and decoding the multiples streams that are comming to the SFU for processing instead the SFU does this for them
Thus these devices drink less battery run cooler and require less cpu time
The reduction in CPU processing leads to smoother interface, cooler devices and overall better user experience
SFU offer greater flexibility in how you want to handle the media steams and how you want the video to be displayed on the participants client devices
The client deives or the meeting participants can choose which streams they want to download and also how they want to display the stream on their screens
They also have the ability to download different quality of strems or make it automatic such that the SFU chooses the best stream based on the client device bandwidth capacity and CPU capability
SFU or the Selective Forwarding Unit supports a variety of advanced features like
サイマルキャスト (単一のビデオ ストリームの複数の品質を送信する機能)、スケーラブルなビデオ コーデックなど
SFU を通過するすべてのストリームはエンドツーエンドで暗号化されているため、SFU さえもどのストリームが通過しているのか誰も知りません
エンドツーエンドの暗号化にはDTLSやSRTPなどの暗号化プロトコルが使用されます
SFU はインタラクションをログに記録できますが、コンプライアンスの目的でストリームを傍受することもできません。
API:強力な API でサーバー管理を有効にします。 API を介して認証情報の追加/削除、API を介してユーザーごとの認証情報とユーザー指標を取得、API を介して認証情報を有効/無効にする、API を介して日付ごとの使用状況データを取得するなどの操作を行うことができます。
グローバル地理位置ターゲティング:トラフィックを最も近いサーバーに自動的に送信し、遅延を最小限に抑え、最高品質のパフォーマンスを実現します。世界中どこでも遅延が 50 ミリ秒未満
世界のすべての地域のサーバー:トロント、マイアミ、サンフランシスコ、アムステルダム、ロンドン、フランクフルト、バンガロール、シンガポール、シドニー、ソウル、ダラス、ニューヨーク
低遅延:世界中のどこでも遅延が 50 ミリ秒未満です。
費用対効果の高い:帯域幅とボリュームの割引が可能な従量課金制の料金設定です。
簡単な管理:使用ログ、アカウントがしきい値制限に達したときのメール、請求記録、メールと電話のサポートを取得します。
準拠規格:UDP、TCP、TLS、DTLS を介して RFC 5389、5769、5780、5766、6062、6156、5245、5768、6336、6544、5928 に準拠します。
複数の認証情報を作成し、顧客ごとまたは異なるアプリごとに使用を分離します。使用状況ログ、請求記録、およびしきい値アラートを取得します。
SLA による 99.999% の稼働時間。
同時トラフィックまたは総トラフィックに制限はありません。従量制の TURN サーバーはエンタープライズ スケーラビリティを提供します
無料プランでは毎月 5 GB の TURN サーバーを無料で利用できます
以上がWebRTC SFU: 完全なガイド。の詳細内容です。詳細については、PHP 中国語 Web サイトの他の関連記事を参照してください。