WebRTC 是一套基于 Web 的实时通信解决方案。
其官网上的解释如下: 借助WebRTC,您可以在基于开放标准的应用程序中添加实时通信功能。 它支持在端点之间发送视频,语音和一般的数据信息,从而使开发人员能够构建功能强大的语音和视频通信解决方案。 该技术可在所有现代浏览器以及所有主要平台的本机客户端上使用。 WebRTC背后的技术被实现为一个开放的Web标准,并在所有主要浏览器中均以常规JavaScript API的形式提供。 对于本机客户端(例如Android和iOS应用程序),可以使用提供相同功能的库。
WebRTC 开源项目的源码在此: webrtc.googlesource.com/src ,上百万行的代码汗牛充栋,直接看代码会迷失在汪洋大海中。
我们还要先理解标准和协议, 知道背后的设计思想
WebRTC 相关标准
- WebRTC standard: www.w3.org/TR/webrtc
WebRTC 相关协议
- SDP: www.rfcreader.com/#rfc4566
- RTP: www.rfcreader.com/#rfc3550
- SRTP: www.rfcreader.com/#rfc3711
- RTP Profile: www.rfcreader.com/#rfc3551
- Datagram Transport Layer Security Version 1.2: www.rfcreader.com/#rfc6347
- RTCWeb Offer/Answer Protocol (ROAP): tools.ietf.org/html/draft-…
- Javascript Session Establishment Protocol (JSEP): tools.ietf.org/html/rfc882…
- Session Traversal Utilities for NAT (STUN): tools.ietf.org/html/rfc538…
- Traversal Using Relays around NAT (TURN): tools.ietf.org/html/rfc576…
- Interactive Connectivity Establishment (ICE): tools.ietf.org/html/rfc844…
- TCP Candidates with Interactive Connectivity Establishment (ICE): tools.ietf.org/html/rfc654…
- Trickling ICE: tools.ietf.org/html/draft-…
- Datagram Transport Layer Security for SRTP (DTLS-SRTP): www.rfcreader.com/#rfc5764
- Connection-Oriented Media Transport over TLS in SDP: www.rfcreader.com/#rfc4572
- TCP-Based Media Transport in SDP: www.rfcreader.com/#rfc4145
- Web Real-Time Communication (WebRTC): Media Transport and Use of RTP: tools.ietf.org/html/draft-…
- Codec Control Messages in the RTP Audio-Visual Profile with Feedback (AVPF): tools.ietf.org/html/rfc510…
- Extended RTP Profile for RTCP-Based Feedback (RTP/AVPF): tools.ietf.org/html/rfc458…
- REMB - RTCP message for Receiver Estimated Maximum Bitrate: tools.ietf.org/html/draft-…
- Codec Control Messages in the RTP Audio-Visual Profile with Feedback (AVPF): tools.ietf.org/html/rfc510…
- A Google Congestion Control Algorithm for Real-Time Communication: tools.ietf.org/html/draft-…
- Framing RTP and RTCP Packets over Connection-Oriented Transport: tools.ietf.org/html/rfc457…
- SSRC Attributes in SDP: tools.ietf.org/html/rfc557…
- (RTP) Header Extension for Client-to-Mixer Audio Level Indication: tools.ietf.org/html/rfc646…
- RTP Retransmission Payload Format: tools.ietf.org/html/rfc458…
- Negotiating Media Multiplexing Using SDP: tools.ietf.org/html/draft-…
- RTP Stream Identifier Source Description (SDES): tools.ietf.org/html/draft-…
- WebRTC MediaStream Identification in SDP: tools.ietf.org/id/draft-ie…
- RTP Extensions for Transport-wide Congestion Control: tools.ietf.org/html/draft-…
- RTP Header Extension for the RTCP Source Description Items: tools.ietf.org/html/draft-…
- A Framework for SDP Attributes when Multiplexing: tools.ietf.org/html/draft-…
- ULPFEC - RTP Payload Format for Generic Forward Error Correction: tools.ietf.org/html/rfc510…
- RED - RTP Payload for Redundant Audio Data: tools.ietf.org/html/rfc219…
- RTP Payload Format for H.264 Video: tools.ietf.org/html/rfc618…
- RTP Payload Format for Scalable Video Coding: tools.ietf.org/html/rfc619…
- Definition of the Opus Audio Codec: tools.ietf.org/html/rfc671…
参考资料
-
WebRTC offical site: webrtc.org/
-
WebRTC tutorial and book
-
WebRTC native codes