How does RTCPeerConnection work in WebRTC

See below sequence diagram.

To be easy understand, no turn/stun/signal server here.

Description

  1. call peerA’s createOffer. Inside createOffer, there are 2 things happening
    1. call peer’s setLocalDescription. The description is known as SDP. It’s peerB’s SDP.
      • setLocalDescription will trigger iceCandidate listener. Inside listener, another 2 things happening
        • get iceCandidate of peerA from WebRTC framework.
        • send the iceCandidate to peerB
    2. send SDP to peerB
  2. When peerB receives SDP, peerB is trying to createAnswer by call peerB’s createAnswer. Inside it, below 2 things are happening
    1. call peerB’s setLocalDescription. The description is know as SDP. It’s peerB’s SDP.
      • setLocalDescription will trigger peerB’s iceCanidate listener.
        • geticeCandiate of peerB from WebRTC framework.
        • send the iceCanddiate to peerA.
    2. send SDP to peer A.
  3. The two peers begin to transfer media data.

Now you see it’s the process of exchange of iceCandidate and SDP.

Amusement

I saw an article https://titanwolf.org/Network/Articles/Article?AID=9e275db3-0270-4605-8d6d-55f4177e73e2#gsc.tab=0 today.

I had a strange feeling when I looked at the words. It’s like the one I wrote. But I’ve never wrote an tech article in English before. I searched on internet. Finally I found the article I wrote. https://blog.csdn.net/huaxin803/article/details/7617215

Comparing the two articles, suddenly, I understand it. Someone translated it from Chinese to English. I was amused. Internet is really a funny place.