Write some doc about PeerConnection
Bug: webrtc:12738 Change-Id: I2a2c627ebe371a5ebd4c8e860d121a4ab8b2d291 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/217680 Commit-Queue: Harald Alvestrand <hta@webrtc.org> Reviewed-by: Tommi <tommi@webrtc.org> Reviewed-by: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33944}
This commit is contained in:

committed by
WebRTC LUCI CQ

parent
59b802883a
commit
e316b86127
@ -26,7 +26,7 @@
|
||||
* [Video coding](/modules/video_coding/g3doc/index.md)
|
||||
* [Stats](/video/g3doc/stats.md)
|
||||
* DataChannel
|
||||
* PeerConnection
|
||||
* [PeerConnection](/pc/g3doc/peer_connection.md)
|
||||
* Desktop capture
|
||||
* Stats
|
||||
* Testing
|
||||
|
59
pc/g3doc/peer_connection.md
Normal file
59
pc/g3doc/peer_connection.md
Normal file
@ -0,0 +1,59 @@
|
||||
<?% config.freshness.reviewed = '2021-05-07' %?>
|
||||
<?% config.freshness.owner = 'hta' %?>
|
||||
|
||||
# PeerConnection and friends
|
||||
|
||||
The PeerConnection is the C++-level implementation of the Javascript
|
||||
object "RTCPeerConnection" from the
|
||||
[WEBRTC specification](https://w3c.github.io/webrtc-pc/).
|
||||
|
||||
Like many objects in WebRTC, the PeerConnection is used via a factory and an
|
||||
observer:
|
||||
|
||||
* PeerConnectionFactory, which is created via a static Create method and takes
|
||||
a PeerConnectionFactoryDependencies structure listing such things as
|
||||
non-default threads and factories for use by all PeerConnections using
|
||||
the same factory. (Using more than one factory should be avoided, since
|
||||
it takes more resources.)
|
||||
* PeerConnection itself, which is created by the method called
|
||||
PeerConnectionFactory::CreatePeerConnectionOrError, and takes a
|
||||
PeerConnectionInterface::RTCConfiguration argument, as well as
|
||||
a PeerConnectionDependencies (even more factories, plus other stuff).
|
||||
* PeerConnectionObserver (a member of PeerConnectionDependencies), which
|
||||
contains the functions that will be called on events in the PeerConnection
|
||||
|
||||
These types are visible in the API.
|
||||
|
||||
## Internal structure of PeerConnection and friends
|
||||
|
||||
The PeerConnection is, to a large extent, a "God object" - most things
|
||||
that are done in WebRTC require a PeerConnection.
|
||||
|
||||
Internally, it is divided into several objects, each with its own
|
||||
responsibilities, all of which are owned by the PeerConnection and live
|
||||
as long as the PeerConnection:
|
||||
|
||||
* SdpOfferAnswerHandler takes care of negotiating configurations with
|
||||
a remote peer, using SDP-formatted descriptions.
|
||||
* RtpTransmissionManager takes care of the lists of RtpSenders,
|
||||
RtpReceivers and RtpTransceivers that form the heart of the transmission
|
||||
service.
|
||||
* DataChannelController takes care of managing the PeerConnection's
|
||||
DataChannels and its SctpTransport.
|
||||
* JsepTransportController takes care of configuring the details of senders
|
||||
and receivers.
|
||||
* Call does management of overall call state.
|
||||
* RtcStatsCollector (and its obsolete sibling, StatsCollector) collects
|
||||
statistics from all the objects comprising the PeerConnection when
|
||||
requested.
|
||||
|
||||
There are a number of other smaller objects that are also owned by
|
||||
the PeerConnection, but it would take too much space to describe them
|
||||
all here; please consult the .h files.
|
||||
|
||||
PeerConnectionFactory owns an object called ConnectionContext, and a
|
||||
reference to this is passed to each PeerConnection. It is referenced
|
||||
via an rtc::scoped_refptr, which means that it is guaranteed to be
|
||||
alive as long as either the factory or one of the PeerConnections
|
||||
is using it.
|
||||
|
Reference in New Issue
Block a user