xref: /aosp_15_r20/external/webrtc/api/g3doc/index.md (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1<?% config.freshness.owner = 'hta' %?>
2<?% config.freshness.reviewed = '2021-04-12' %?>
3
4# The WebRTC API
5
6The public API of the WebRTC library consists of the api/ directory and
7its subdirectories. No other files should be depended on by webrtc users.
8
9Before starting to code against the API, it is important to understand
10some basic concepts, such as:
11
12* Memory management, including webrtc's reference counted objects
13* [Thread management](threading_design.md)
14
15## Using WebRTC through the PeerConnection class
16
17The
18[PeerConnectionInterface](https://source.chromium.org/chromium/chromium/src/+/main:third_party/webrtc/api/peer_connection_interface.h?q=webrtc::PeerConnectionInterface)
19class is the recommended way to use the WebRTC library.
20
21It is closely modeled after the Javascript API documented in the [WebRTC
22specification](https://w3c.github.io/webrtc-pc/).
23
24PeerConnections are created using the [PeerConnectionFactoryInterface](https://source.chromium.org/search?q=webrtc::PeerConnectionFactoryInterface).
25
26There are two levels of customization available:
27
28*   Pass a PeerConnectionFactoryDependencies object to the function that creates
29    a PeerConnectionFactory. This object defines factories for a lot of internal
30    objects inside the PeerConnection, so that users can override them.
31    All PeerConnections using this interface will have the same options.
32*   Pass a PeerConnectionInterface::RTCConfiguration object to the
33    CreatePeerConnectionOrError() function on the
34    PeerConnectionFactoryInterface. These customizations will apply only to a
35    single PeerConnection.
36
37Most functions on the PeerConnection interface are asynchronous, and take a
38callback that is executed when the function is finished. The callbacks are
39mostly called on the thread that is passed as the "signaling thread" field of
40the PeerConnectionFactoryDependencies, or the thread that called
41PeerConnectionFactory::CreatePeerConnectionOrError() if no thread is given.
42
43See each class' module documentation for details.
44
45## Using WebRTC components without the PeerConnection class
46
47This needs to be done carefully, and in consultation with the WebRTC team. There
48are non-obvious dependencies between many of the components.
49
50
51
52