This reverts commit 0f2ce5cc1c779f9bf33f51f29bfffbcbe105d1b1. Reason for revert: Downstream infrastructure should be ready now Original change's description: > Revert "Migrate WebRTC documentation to new renderer" > > This reverts commit 3eceaf46695518f25bef43f155f82ed174827197. > > Reason for revert: > > Original change's description: > > Migrate WebRTC documentation to new renderer > > > > Bug: b/258408932 > > Change-Id: Ib96f39fe0c3912f9746bcc09d079097a145d6115 > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/290987 > > Reviewed-by: Harald Alvestrand <hta@webrtc.org> > > Commit-Queue: Artem Titov <titovartem@webrtc.org> > > Cr-Commit-Position: refs/heads/main@{#39205} > > Bug: b/258408932 > Change-Id: I16cb4088bee3fc15c2bb88bd692c592b3a7db9fe > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/291560 > Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com> > Owners-Override: Artem Titov <titovartem@webrtc.org> > Commit-Queue: Artem Titov <titovartem@webrtc.org> > Cr-Commit-Position: refs/heads/main@{#39209} Bug: b/258408932 Change-Id: Ia172e4a6ad1cc7953b48eed08776e9d1e44eb074 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/291660 Owners-Override: Artem Titov <titovartem@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com> Commit-Queue: Artem Titov <titovartem@webrtc.org> Cr-Commit-Position: refs/heads/main@{#39231}
7.6 KiB
ICE
Overview
ICE (link) provides unreliable packet transport between two clients (p2p) or between a client and a server.
This documentation provides an overview of how ICE is implemented, i.e how the following classes interact.
-
cricket::IceTransportInternal- is the interface that does ICE (manage ports, candidates, connections to send/receive packets). The interface is implemented bycricket::P2PTransportChannel. -
cricket::PortInterfaceRepresents a local communication mechanism that can be used to create connections to similar mechanisms of the other client. There are 4 implementations ofcricket::PortInterfacecricket::UDPPort,cricket::StunPort,cricket::TcpPortandcricket::TurnPort. The ports share lots of functionality in a base class,cricket::Port. -
cricket::Candidaterepresents an address discovered by acricket::Port. A candidate can be local (i.e discovered by a local port) or remote. Remote candidates are transported using signaling, i.e outside of webrtc. There are 4 types of candidates:local,stun,prflxorrelay(standard) -
cricket::Connectionprovides the management of acricket::CandidatePair, i.e for sending data between two candidates. It sends STUN Binding requests (aka STUN pings) to verify that packets can traverse back and forth and keep connections alive (both that NAT binding is kept, and that the remote peer still wants the connection to remain open). -
cricket::P2PTransportChanneluses ancricket::PortAllocatorto create ports and discover local candidates. Thecricket::PortAllocatoris implemented bycricket::BasicPortAllocator. -
cricket::P2PTransportChanneluses ancricket::IceControllerInterfaceto manage a set of connections. Thecricket::IceControllerInterfacedecides whichcricket::Connectionto send data on.
Connection establishment
This section describes a normal sequence of interactions to establish ice state completed link ( standard )
All of these steps are invoked by interactions with PeerConnection.
-
P2PTransportChannel::MaybeStartGatheringThis function is invoked as part ofPeerConnection::SetLocalDescription.P2PTransportChannelwill use thecricket::PortAllocatorto create acricket::PortAllocatorSession. Thecricket::PortAllocatorSessionwill create local ports as configured, and the ports will start gathering candidates. -
IceTransportInternal::SignalCandidateGatheredWhen a port finds a local candidate, it will be added to a list oncricket::P2PTransportChanneland signaled to application usingIceTransportInternal::SignalCandidateGathered. A p2p application can then send them to peer using favorite transport mechanism whereas a client-server application will do nothing. -
P2PTransportChannel::AddRemoteCandidateWhen the application get a remote candidate, it can add it usingPeerConnection::AddRemoteCandidate(afterPeerConnection::SetRemoteDescriptionhas been called!), this will trickle down toP2PTransportChannel::AddRemoteCandidate.P2PTransportChannelwill combine the remote candidate with all compatible local candidates to form newcricket::Connection(s). Candidates are compatible if it is possible to send/receive data (e.g ipv4 can only send to ipv4, tcp can only connect to tcp etc...) The newly formedcricket::Connection(s) will be added to thecricket::IceControllerthat will decide whichcricket::Connectionto send STUN ping on. -
P2PTransportChannel::SignalCandidatePairChangedWhen a remote connection replies to a STUN ping,cricket::IceControllerwill instructP2PTransportChannelto use the connection. This is signalled up the stack usingP2PTransportChannel::SignalCandidatePairChanged. Note thatcricket::IceControllerwill continue to send STUN pings on the selected connection, as well as other connections. -
P2PTransportChannel::SignalIceTransportStateChangedThe initial selection of a connection makesP2PTransportChannelsignal up stack that state has changed, which may makecricket::DtlsTransportInternalinitiate a DTLS handshake (depending on the DTLS role).