对等连接和朋友

PeerConnection and friends

对等连接和朋友

The PeerConnection is the C++-level implementation of the Javascript object “RTCPeerConnection” from the WEBRTC specification.

​PeerConnection是WEBRTC规范中Javascript对象“RTCPeerConnection”的C++级实现。

Like many objects in WebRTC, the PeerConnection is used via a factory and an observer:

与WebRTC中的许多对象一样,PeerConnection是通过工厂和观察者使用的:

  • 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.)
  • PeerConnectionFactory,它是通过静态Create方法创建的,采用PeerConnection FactoryDependencies结构,列出非默认线程和工厂等内容,供使用同一工厂的所有PeerConnect使用。(应该避免使用多个工厂,因为这需要更多的资源。)
  • 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).
  • PeerConnection本身,由名为PeerConnectionFactory::CreatePeerConnectivationOrError的方法创建,并采用PeerConnectInterface::RTCConfiguration参数以及PeerConnetionDependencies(甚至更多的工厂,以及其他东西)。
  • PeerConnectionObserver (a member of PeerConnectionDependencies), which contains the functions that will be called on events in the PeerConnection
  • PeerConnectionObserver(PeerConnectionDependencies的成员),它包含将在PeerConnection中的事件上调用的函数

These types are visible in the API.

这些类型在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.

在很大程度上,对等连接是一个“上帝对象”——在WebRTC中完成的大多数事情都需要对等连接。

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:

在内部,它被划分为多个对象,每个对象都有自己的责任,所有这些对象都归PeerConnection所有,并且与PeerConnetion一同存在:

  • SdpOfferAnswerHandler takes care of negotiating configurations with a remote peer, using SDP-formatted descriptions.
  • SdpOfferAnswerHandler负责使用SDP格式的描述与远程对等方协商配置。
  • RtpTransmissionManager takes care of the lists of RtpSenders, RtpReceivers and RtpTransceivers that form the heart of the transmission service.
  • RtpTransmissionManager负责处理构成传输服务核心的RtpSender、RtpReceiver和RtpTransceiver的列表。
  • DataChannelController takes care of managing the PeerConnection's DataChannels and its SctpTransport.
  • DataChannelController负责管理对等连接的DataChannels及其SctpTransport。
  • JsepTransportController takes care of configuring the details of senders and receivers.
  • JsepTransportController负责配置发送方和接收方的详细信息。
  • Call does management of overall call state.
  • 呼叫对整个呼叫状态进行管理。
  • RtcStatsCollector (and its obsolete sibling, StatsCollector) collects statistics from all the objects comprising the PeerConnection when requested.
  • 当请求时,RtcStatsCollector(及其过时的同级StatsCollecter)从组成对等连接的所有对象中收集统计信息。

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.

PeerConnection还拥有许多其他较小的对象,但在这里描述它们会占用太多空间;请查阅.h文件。

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.

PeerConnectionFactory拥有一个名为ConnectionContext的对象,并将对该对象的引用传递给每个PeerConnection。它是通过rtc::scoped_refptr引用的,这意味着只要工厂或其中一个PeerConnections正在使用它,它就保证是活动的。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值