() Principle Analysis of RTCPeerConnection WebRTC

  • From getUserMedia()to RTCPeerConnection(), since that is the difficulty increased sharply. I think when one is learning ROS before calling camera, the peripheral interface calls, camera parameters have to learn to understand the underlying Linux platform; on the other hand, we began courses in computer networks junior next semester, understanding of network communication is still in its failure to achieve closed loop self-closing state (autistic - "full self-knowledge to complete the closed loop")
  • The face of ICE, SDP, NAT gateways, STUN , TURN and other words abnormal ignorant force (explanation can refer to this Introduction ) so as to write the text, enhance their understanding, but also for the same confusion of this part provide a reference

EDITORIAL

  • Currently, after reading some of the WebRTC information that RTCPeerConnection()is the most difficult but also the most crucial, also in RTCPeerConnection()each of the WebRTC, signaling part is the hardest, but most important, I want to clarify this part, kind of cross-platform build will be very helpful (across PC, Android, Raspberry Pi)
  • Establish understand the basic knowledge of computer networks, such as protocol required for communication between the architecture model, equipment, basic steps

  • OK, to ignore the various specific API, from a practical point of view to see the reality of physical devices based on WebRTC of P2P in the end how to achieve the reference Lifetime of a WebRTC session

Realistic physics WebRTC P2P implementation

  • Surely we all sent me express, express mail giving is a very typical P2P process, below the corresponding WebRTC to explain this process
  1. getUserMedia() To find out what you want to send, in the corresponding WebRTC which is to get audio | video, and get set for the selection of equipment, the resolution of the class
  2. RTCPeerConnection()Is signalingsimilar to choose what courier company (communication protocols), do not want to send things to deal with what the form, mail boxes or plastic bags to be loaded just fine, there is no use of receipt of the courier open Notes (media codecs and formats), fill sent to the address (IP adress and port information), then you can send a courier

    Signaling is the process of sending control information between two devices to determine the communication protocols, channels, media codecs and formats, and method of data transfer, as well as any required routing information.

    There are three basic types of information that need to be exchanged during signaling:
    • Control messages used to set up, open, and close the communication channel, and to handle errors.
    • Information needed in order to set up the connection: the IP addressing and port information needed for the peers to be able to talk to one another.
    • Media capability negotiation: what codecs and media data formats can the peers understand? These need to be agreed upon before the WebRTC session can begin.
  3. By RTCPeerConnection()in a series of API to achieve the above signalingprocess, a detailed breakdown of this process in the next section inside
  4. Of course, there will be mail delivery error or sometimes encounter unusual circumstances (though in reality I have not encountered this situation), if it is the kind of goods to be sent once per day ICE restart, refers to find a new way of delivery , to maintain the original way before finding a new delivery channels until you find a new way of delivery

signaling the specific implementation process

  • First put a schematic diagram ( source )

WebRTC_signaling

  • Theoretical course:
  1. Each peer creates an RTCPeerConnection object representing their end of the WebRTC session.
  2. Each peer establishes a handler for icecandidate events, which handles sending those candidates to the other peer over the signaling channel.
  3. Each peer establishes a handler for track event, which is received when the remote peer adds a track to the stream. This code should connect the tracks to its consumer, such as a <video> element.
  4. The caller creates and shares with the receiving peer a unique identifier or token of some kind so that the call between them can be identified by the code on the signaling server. The exact contents and form of this identifier is up to you.
  5. Each peer connects to an agreed-upon signaling server, such as a WebSocket server they both know how to exchange messages with.
  6. Each peer tells the signaling server that they want to join the same WebRTC session (identified by the token established in step 4).
  • The timing diagram with a program to sum up, the timing diagram link , the connection of the picture is too big, not paste it into the article, but the content of which accurately describes the whole process connection

Guess you like

Origin www.cnblogs.com/yzy11235/p/11439971.html