##############################
Simulcast
##############################
:最終更新日: 2020-11-08
Simulcast とは
==============
Simulcast は配信者が複数画質の映像を送るという仕組みです。P2P で利用されるのではなく SFU 向けの機能です。
SFU では映像を変換しないためユーザごとに配信されるビットレートを選択できません。例えば配信者が 1Mbps で映像を配信したとしても、
視聴者の 1 人が 500kbps しか帯域がない場合は映像を見ることができなくなります。
これを解決するのが Simulcast です。配信者が複数の画質の映像を SFU に送り SFU は視聴者に最適な映像を送ることで、
視聴者は配信者より帯域が少ない場合でも視聴が可能になります。 HLS や MPEG-DASH でいうアダプティブビットレートをサーバ無変換で実現する技術です。
Simulcast の実装
================
rid (RTP Stream ID) を利用した Simulcast 実装がすべてのブラウザで採用されています。
SDP の ``a=rid`` と ``a=simulcast`` を利用できます。
JavaScript では ``setParameters`` の ``sendEncodings`` を利用することでクライアントから解像度、ビットレート、フレームレートなどを指定可能です。
- https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiverinit-sendencodings
- https://w3c.github.io/webrtc-pc/#dom-rtcrtpencodingparameters
- https://w3c.github.io/webrtc-extensions/#dom-rtcrtpencodingparameters
Simulcast の負荷
================
配信する解像度に依存しますが、基本的には 1/4 と 1/8 の解像度を配信するため、30% 程度の CPU 使用率アップと考えてもらって構いません。
Simulcast でできること
======================
**rid ベース Simulcast と SFU での利用を前提としています**
- クライアント側での解像度、ビットレート、フレームレート、アクティブの有無が指定可能
- Offer でクライアントに対して Simulcast を要求できる
- 最大 4 種類までの画質を指定できる
- 同一解像度でフレームレートだけが異なるといった事も可能
資料
====
- `WebRTC 1.0: Real-Time Communication Between Browsers `_
- https://w3c.github.io/webrtc-pc/#simulcast-functionality
- `draft-ietf-rtcweb-jsep-26 - JavaScript Session Establishment Protocol `_
- https://tools.ietf.org/html/draft-ietf-rtcweb-jsep-26#section-3.7
- `draft-ietf-mmusic-rid-15 - RTP Payload Format Restrictions `_
- `draft-ietf-mmusic-sdp-simulcast-14 - Using Simulcast in SDP and RTP Sessions `_