WebRTC
WebRTC overview
一句话,用浏览器来进行实时通信
具体来说:
-
它是一套基于 Web 进行实时通信的标准和参考实现
-
它是一个开源项目,最初由 google 发起并交由开源社区
借助WebRTC,你可以在基于开放标准的应用程序中添加实时通信功能。 它支持在节点之间发送视频,语音和通用数据,从而使开发人员能够构建功能强大的语音和视频通信解决方案。 该技术可在所有现代浏览器以及所有主要平台的本机客户端上使用。
WebRTC背后的技术被实现为一个开放的Web标准,并在所有主要浏览器中均以常规JavaScript API的形式提供。 对于本机客户端(例如Android和iOS应用程序),可以使用提供相同功能的库。
WebRTC Primer
参见 https://www.fanyamin.com/webrtc/examples/index.html
WebRTC protocols
Standards
- draft-ietf-rtcweb-alpn --> RFC 8833
- draft-ietf-rtcweb-audio-codecs-for-interop --> RFC 7875
- draft-ietf-rtcweb-audio --> RFC 7874
- draft-ietf-rtcweb-data-channel --> RFC 8831
- draft-ietf-rtcweb-data-protocol --> RFC 8832
- draft-ietf-rtcweb-fec --> RFC 8854
- draft-ietf-rtcweb-ip-handling --> RFC 8828
- draft-ietf-rtcweb-jsep --> RFC 8829
- draft-ietf-rtcweb-overview --> RFC 8825
- draft-ietf-rtcweb-rtp-usage --> RFC 8834
- draft-ietf-rtcweb-security-arch --> RFC 8827
- draft-ietf-rtcweb-security --> RFC 8826
- draft-ietf-rtcweb-stun-consent-freshness --> RFC 7675
- draft-ietf-rtcweb-transports --> RFC 8835
- draft-ietf-rtcweb-use-cases-and-requirements --> RFC 7478
- draft-ietf-rtcweb-video --> RFC 7742
相关协议
- [I-D.ietf-avtext-rid] Roach, A., Nandakumar, S. and P. Thatcher, "RTP Stream Identifier Source Description (SDES)", Internet-Draft draft-ietf-avtext-rid-09, October 2016.
-
[I-D.ietf-ice-trickle] Ivov, E., Rescorla, E., Uberti, J. and P. Saint-Andre, "Trickle ICE: Incremental Provisioning of Candidates for the Interactive Connectivity Establishment (ICE) Protocol", Internet-Draft draft-ietf-ice-trickle-21, April 2018.
-
[I-D.ietf-mmusic-dtls-sdp] Holmberg, C. and R. Shpount, "Session Description Protocol (SDP) Offer/Answer Considerations for Datagram Transport Layer Security (DTLS) and Transport Layer Security (TLS)", Internet-Draft draft-ietf-mmusic-dtls-sdp-32, October 2017.
-
[I-D.ietf-mmusic-ice-sip-sdp] Petit-Huguenin, M., Nandakumar, S. and A. Keranen, "Session Description Protocol (SDP) Offer/Answer procedures for Interactive Connectivity Establishment (ICE)", Internet-Draft draft-ietf-mmusic-ice-sip-sdp-24, November 2018.
-
对于 ICE 的 SDP 的要约/应答过程
-
[I-D.ietf-mmusic-msid] Alvestrand, H., "WebRTC MediaStream Identification in the Session Description Protocol", Internet-Draft draft-ietf-mmusic-msid-17, December 2018.
-
SDP 中的 WebRTC 媒体流标识
-
[I-D.ietf-mmusic-mux-exclusive] Holmberg, C., "Indicating Exclusive Support of RTP/RTCP Multiplexing using SDP", Internet-Draft draft-ietf-mmusic-mux-exclusive-12, May 2017.
-
使用 SDP 的 RTP/RTCP 多路复用的表示独占支持
-
[I-D.ietf-mmusic-rid] Roach, A., "RTP Payload Format Restrictions", Internet-Draft draft-ietf-mmusic-rid-15, May 2018.
-
RTP 荷载格式限制
-
[I-D.ietf-mmusic-sctp-sdp] Holmberg, C., Shpount, R., Loreto, S. and G. Camarillo, "Session Description Protocol (SDP) Offer/Answer Procedures For Stream Control Transmission Protocol (SCTP) over Datagram Transport Layer Security (DTLS) Transport.", Internet-Draft draft-ietf-mmusic-sctp-sdp-26, April 2017.
-
数据报传输层安全性(DTLS)传输上的流控制传输协议(SCTP)的会话描述协议(SDP)要约/应答过程
-
[I-D.ietf-mmusic-sdp-bundle-negotiation] Holmberg, C., Alvestrand, H. and C. Jennings, "Negotiating Media Multiplexing Using the Session Description Protocol (SDP)", Internet-Draft draft-ietf-mmusic-sdp-bundle-negotiation-54, December 2018.
-
使用 SDP 协商媒体多路复用
-
[I-D.ietf-mmusic-sdp-mux-attributes] Nandakumar, S., "A Framework for SDP Attributes when Multiplexing", Internet-Draft draft-ietf-mmusic-sdp-mux-attributes-17, February 2018.
-
多路复用时用于 SDP 属性的框架
-
[I-D.ietf-mmusic-sdp-simulcast] Burman, B., Westerlund, M., Nandakumar, S. and M. Zanaty, "Using Simulcast in SDP and RTP Sessions", Internet-Draft draft-ietf-mmusic-sdp-simulcast-13, June 2018.
-
在 SDP 和 RTP 会话中使用直播
-
[I-D.ietf-rtcweb-fec] Uberti, J., "WebRTC Forward Error Correction Requirements", Internet-Draft draft-ietf-rtcweb-fec-08, March 2018.
-
WebRTC 前身纠错需求
-
[I-D.ietf-rtcweb-rtp-usage] Perkins, C., Westerlund, M. and J. Ott, "Web Real-Time Communication (WebRTC): Media Transport and Use of RTP", Internet-Draft draft-ietf-rtcweb-rtp-usage-26, March 2016.
-
WebRTC: 媒体传输和 RTP 的使用
-
[I-D.ietf-rtcweb-security] Rescorla, E., "Security Considerations for WebRTC", Internet-Draft draft-ietf-rtcweb-security-11, February 2019.
-
WebRTC 的安全考虑
-
[I-D.ietf-rtcweb-security-arch] Rescorla, E., "WebRTC Security Architecture", Internet-Draft draft-ietf-rtcweb-security-arch-18, February 2019.
-
WebRTC 安全架构
-
[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/RFC2119, March 1997.
-
在RFC中用于指示需求级别的关键字
-
[RFC3261] Rosenberg, J., Schulzrinne, H., Camarillo, G., Johnston, A., Peterson, J., Sparks, R., Handley, M. and E. Schooler, "SIP: Session Initiation Protocol", RFC 3261, DOI 10.17487/RFC3261, June 2002.
-
SIP: 会话初始化协议
-
[RFC3264] Rosenberg, J. and H. Schulzrinne, "An Offer/Answer Model with Session Description Protocol (SDP)", RFC 3264, DOI 10.17487/RFC3264, June 2002.
-
使用 SDP 的要约/应答模型
-
[RFC3552] Rescorla, E. and B. Korver, "Guidelines for Writing RFC Text on Security Considerations", BCP 72, RFC 3552, DOI 10.17487/RFC3552, July 2003.
-
出于安全考虑编写 RFC 文本的准则
-
[RFC3605] Huitema, C., "Real Time Control Protocol (RTCP) attribute in Session Description Protocol (SDP)", RFC 3605, DOI 10.17487/RFC3605, October 2003.
-
会话描述协议(SDP)中的 “实时控制协议 (RTCP)” 属性
-
[RFC3711] Baugher, M., McGrew, D., Naslund, M., Carrara, E. and K. Norrman, "The Secure Real-time Transport Protocol (SRTP)", RFC 3711, DOI 10.17487/RFC3711, March 2004.
-
安全传输协议
-
[RFC3890] Westerlund, M., "A Transport Independent Bandwidth Modifier for the Session Description Protocol (SDP)", RFC 3890, DOI 10.17487/RFC3890, September 2004.
-
会话描述协议(SDP)的与传输无关的带宽修改器
-
[RFC4145] Yon, D. and G. Camarillo, "TCP-Based Media Transport in the Session Description Protocol (SDP)", RFC 4145, DOI 10.17487/RFC4145, September 2005.
-
会话描述协议(SDP)中基于TCP的媒体传输
-
[RFC4566] Handley, M., Jacobson, V. and C. Perkins, "SDP: Session Description Protocol", RFC 4566, DOI 10.17487/RFC4566, July 2006.
-
SDP: 会话描述协议
-
[RFC4585] Ott, J., Wenger, S., Sato, N., Burmeister, C. and J. Rey, "Extended RTP Profile for Real-time Transport Control Protocol (RTCP)-Based Feedback (RTP/AVPF)", RFC 4585, DOI 10.17487/RFC4585, July 2006.
-
扩展的 RTP 配置文件,用于基于实时传输控制协议(RTCP)的反馈(RTP / AVPF)
-
[RFC5124] Ott, J. and E. Carrara, "Extended Secure RTP Profile for Real-time Transport Control Protocol (RTCP)-Based Feedback (RTP/SAVPF)", RFC 5124, DOI 10.17487/RFC5124, February 2008.
-
用于基于实时传输控制协议(RTCP)的反馈(RTP / SAVPF)的扩展安全 RTP 配置文件
-
[RFC5285] Singer, D. and H. Desineni, "A General Mechanism for RTP Header Extensions", RFC 5285, DOI 10.17487/RFC5285, July 2008.
-
RTP 包头扩展的通用机制
-
[RFC5761] Perkins, C. and M. Westerlund, "Multiplexing RTP Data and Control Packets on a Single Port", RFC 5761, DOI 10.17487/RFC5761, April 2010.
-
在单个端口上复用 RTP 数据和控制包
-
[RFC5888] Camarillo, G. and H. Schulzrinne, "The Session Description Protocol (SDP) Grouping Framework", RFC 5888, DOI 10.17487/RFC5888, June 2010.
-
SDP 分组框架
-
[RFC6236] Johansson, I. and K. Jung, "Negotiation of Generic Image Attributes in the Session Description Protocol (SDP)", RFC 6236, DOI 10.17487/RFC6236, May 2011.
-
会话描述协议(SDP)中通用图像属性的协商
-
[RFC6347] Rescorla, E. and N. Modadugu, "Datagram Transport Layer Security Version 1.2", RFC 6347, DOI 10.17487/RFC6347, January 2012.
-
DTLS 数据报传输层安全性 1.2 版
-
[RFC6716] Valin, JM., Vos, K. and T. Terriberry, "Definition of the Opus Audio Codec", RFC 6716, DOI 10.17487/RFC6716, September 2012.
-
Opus 音频编码的定义
-
[RFC6904] Lennox, J., "Encryption of Header Extensions in the Secure Real-time Transport Protocol (SRTP)", RFC 6904, DOI 10.17487/RFC6904, April 2013.
-
安全实时传输协议(SRTP)中报头扩展的加密
-
[RFC7160] Petit-Huguenin, M. and G. Zorn, "Support for Multiple Clock Rates in an RTP Session", RFC 7160, DOI 10.17487/RFC7160, April 2014.
-
在 RTP 会话中支持多种时钟速率
-
[RFC7587] Spittka, J., Vos, K. and JM. Valin, "RTP Payload Format for the Opus Speech and Audio Codec", RFC 7587, DOI 10.17487/RFC7587, June 2015.
-
Opus语音和音频编解码器的 RTP 有效负载格式
-
[RFC7742] Roach, A., "WebRTC Video Processing and Codec Requirements", RFC 7742, DOI 10.17487/RFC7742, March 2016.
-
WebRTC视频处理和编解码器需求
-
[RFC7850] Nandakumar, S., "Registering Values of the SDP 'proto' Field for Transporting RTP Media over TCP under Various RTP Profiles", RFC 7850, DOI 10.17487/RFC7850, April 2016.
-
在各种 RTP 配置文件下注册用于通过 TCP 传输 RTP 媒体的 SDP'proto' 字段的值
-
[RFC7874] Valin, JM. and C. Bran, "WebRTC Audio Codec and Processing Requirements", RFC 7874, DOI 10.17487/RFC7874, May 2016.
-
[RFC8108] Lennox, J., Westerlund, M., Wu, Q. and C. Perkins, "Sending Multiple RTP Streams in a Single RTP Session", RFC 8108, DOI 10.17487/RFC8108, March 2017.
-
WebRTC音频编解码器和处理要求
-
[RFC8122] Lennox, J. and C. Holmberg, "Connection-Oriented Media Transport over the Transport Layer Security (TLS) Protocol in the Session Description Protocol (SDP)", RFC 8122, DOI 10.17487/RFC8122, March 2017.
-
会话描述协议(SDP)中通过 TLS 进行的面向连接的媒体传输
-
[RFC8445] Keranen, A., Holmberg, C. and J. Rosenberg, "Interactive Connectivity Establishment (ICE): A Protocol for Network Address Translator (NAT) Traversal", RFC 8445, DOI 10.17487/RFC8445, July 2018.
- 交互式连接建立(ICE):网络地址转换器(NAT)遍历的协议
WebRTC examples
My WebRTC example Extended from WebRTC Samples and book Real-Time Communication with WebRTC:
WebRTC Tutorial
WebRTC related snippets
Materials and Tools
- audio files of TSP Lab in McGill University
- Audacity
- BlackHole: Virtual Audio Driver
- VB-CABLE Virtual Audio Device
Reference
- WebRTC offical site
-
https://webrtc.org/
- https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia
- https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection
-
https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel
-
WebRTC tutorial and book
- https://www.html5rocks.com/en/tutorials/webrtc/basics/
- https://www.html5rocks.com/en/tutorials/webrtc/infrastructure/
-
https://a-wing.github.io/webrtc-book-cn/01_introduction.html
-
WebRTC source code
- https://webrtc.googlesource.com/src/+/refs/heads/master/docs/native-code/index.md
- https://webrtc.googlesource.com/src/+/refs/heads/master/docs/native-code/development/index.md
$ git clone https://webrtc.googlesource.com/src
$ git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
#vi ~/.bashrc or ~/.zshrc
$ export PATH=/path/to/depot_tools:$PATH
$ mkdir webrtc-checkout
$ cd webrtc-checkout
$ fetch --nohooks webrtc
$ gclient sync