Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to analyze the log of establishing a point-to-point connection in WebRTC

2025-03-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

In this issue, the editor will bring you a log analysis on how to establish a point-to-point connection in WebRTC. The article is rich in content and analyzes and narrates it from a professional point of view. I hope you can get something after reading this article.

For rookies who are in contact with WebRTC for the first time, it is still difficult to understand how to establish a point-to-point connection. Although there are a lot of peer-to-peer connections demo on the Internet, it is still difficult to understand from a code point of view. I hope the following idea is also helpful to you!

First, obtain peer-to-peer logs

1. Use a Google browser to visit: https://github.com/webrtc/samples, the "Basic peer connection" demo provided by the browser

2. Right mouse button, click "Review elements" to open the "Console" console

3. Click the "Start" and "Call" buttons of the "Basic peer connection" demo page to establish a point-to-point connection (simulate a point-to-point connection based on the same Web page)

4. In the Consle console, right-click and click "Save as" to save the running log.

2. Log information and analysis

This appears to be Chrome

12.722: Requesting local stream (request local audio and video stream, that is, call local camera and microphone)

Spec: {"audio": true, "video": true}

Chrome: {"audio": true, "video": true}

Chrome: {"audio": true, "video": true}

14.022: Received local stream (the local camera and microphone are successfully called to obtain the audio / video stream stream object)

15.321: Local video videoWidth: 640px, videoHeight: 480px

98.136: Starting call (call remote peer)

98.137: Using video device: Lenovo EasyCamera (174f:14ee)

98.137: Using audio device: microphone (Realtek High Definition Audio)

98.137: Created local peer connection object pc1 (create a local PeerConnection object pc1)

98.141: Created remote peer connection object pc2 (create a remote PeerConnection object pc1)

98.143: Added local stream to pc1 (local audio and video streams are added to PeerConnection object pc1 object)

98.144: pc1 createOffer start (pc1 started to create Offer signaling successfully)

98.146: Offer from pc1 (pc1 successfully created Offer signaling, as shown below)

Vault 0

Oval-1942065961337070347 2 IN IP4 127.0.0.1

Slots-

Tweak 0 0

A=group:BUNDLE audio video

A=msid-semantic: WMS rICA7eip7IWV3m6Yp08Hz5cA1AvhLrfQT23p

M=audio 9 RTP/SAVPF 111 103 104 9 0 8 106 105 13 126

C=IN IP4 0.0.0.0

A=rtcp:9 IN IP4 0.0.0.0

A=ice-ufrag:33zghkUynpdQ7JDG

A=ice-pwd:gA6+vMk0K/TpuJoHN7QNTWSw

A=fingerprint:sha-256 65:84:AE:4D:4C:75:21:15

B:3E:57:62:A4:17:EB:C8:22:E1:FA:5B:6A:38:FB:A6:9E:E01:EA:B2:E1:34:49

A=setup:actpass

A=mid:audio

A=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level

A=extmap:3 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time

A=sendrecv

A=rtcp-mux

A=rtpmap:111 opus/48000/2

A=fmtp:111 minptime=10; useinbandfec=1

A=rtpmap:103 ISAC/16000

A=rtpmap:104 ISAC/32000

A=rtpmap:9 G722/8000

A=rtpmap:0 PCMU/8000

A=rtpmap:8 PCMA/8000

A=rtpmap:106 CN/32000

A=rtpmap:105 CN/16000

A=rtpmap:13 CN/8000

A=rtpmap:126 telephone-event/8000

A=maxptime:60

A=ssrc:2847625965 cname:FPxGs1+4IS0LJpcR

A=ssrc:2847625965 msid:rICA7eip7IWV3m6Yp08Hz5cA1AvhLrfQT23p d21f0789-d0f7-4b04-b9ee-134b56bd77a3

A=ssrc:2847625965 mslabel:rICA7eip7IWV3m6Yp08Hz5cA1AvhLrfQT23p

A=ssrc:2847625965 label:d21f0789-d0f7-4b04-b9ee-134b56bd77a3

M=video 9 RTP/SAVPF 100 116 117 96

C=IN IP4 0.0.0.0

A=rtcp:9 IN IP4 0.0.0.0

A=ice-ufrag:33zghkUynpdQ7JDG

A=ice-pwd:gA6+vMk0K/TpuJoHN7QNTWSw

A=fingerprint:sha-256 65:84:AE:4D:4C:75:21:15

B:3E:57:62:A4:17:EB:C8:22:E1:FA:5B:6A:38:FB:A6:9E:E01:EA:B2:E1:34:49

A=setup:actpass

A=mid:video

A=extmap:2 urn:ietf:params:rtp-hdrext:toffset

A=extmap:3 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time

A=extmap:4 urn:3gpp:video-orientation

A=sendrecv

A=rtcp-mux

A=rtpmap:100 VP8/90000

A=rtcp-fb:100 ccm fir

A=rtcp-fb:100 nack

A=rtcp-fb:100 nack pli

A=rtcp-fb:100 goog-remb

A=rtpmap:116 red/90000

A=rtpmap:117 ulpfec/90000

A=rtpmap:96 rtx/90000

A=fmtp:96 apt=100

A=ssrc-group:FID 2259890580 1253285440

A=ssrc:2259890580 cname:FPxGs1+4IS0LJpcR

A=ssrc:2259890580 msid:rICA7eip7IWV3m6Yp08Hz5cA1AvhLrfQT23p c402a35d-4298-4a6b-ad8a-c4d6dbfde67f

A=ssrc:2259890580 mslabel:rICA7eip7IWV3m6Yp08Hz5cA1AvhLrfQT23p

A=ssrc:2259890580 label:c402a35d-4298-4a6b-ad8a-c4d6dbfde67f

A=ssrc:1253285440 cname:FPxGs1+4IS0LJpcR

A=ssrc:1253285440 msid:rICA7eip7IWV3m6Yp08Hz5cA1AvhLrfQT23p c402a35d-4298-4a6b-ad8a-c4d6dbfde67f

A=ssrc:1253285440 mslabel:rICA7eip7IWV3m6Yp08Hz5cA1AvhLrfQT23p

A=ssrc:1253285440 label:c402a35d-4298-4a6b-ad8a-c4d6dbfde67f

98.147: pc1 setLocalDescription start (the pc1 object sends offer signaling to the remote pc2 object through the server)

98.148: pc2 setRemoteDescription start (pc2 receives the Offer signaling from pc1 and extracts the SDP descriptor contained in it)

98.149: pc2 createAnswer start (pc2 creates an Answer signaling that contains the SDP descriptor of the remote peer)

98.178: pc1 setLocalDescription complete (pc1 has finished sending Offer signaling)

98.178: pc2 setRemoteDescription complete (pc2 received Offer signaling completed)

98.179: Answer from pc2: (pc2 started creating Answer signaling successfully, as shown below)

Vault 0

Oasis-5093582210222064371 2 IN IP4 127.0.0.1

Slots-

Tweak 0 0

A=group:BUNDLE audio video

A=msid-semantic: WMS

M=audio 9 RTP/SAVPF 111 103 104 9 0 8 106 105 13 126

C=IN IP4 0.0.0.0

A=rtcp:9 IN IP4 0.0.0.0

A=ice-ufrag:ubQcfltTHAop9S73

A=ice-pwd:tM0zrbhW4uKe+h8Y9hVYkRQK

A=fingerprint:sha-256 65:84:AE:4D:4C:75:21:15

B:3E:57:62:A4:17:EB:C8:22:E1:FA:5B:6A:38:FB:A6:9E:E01:EA:B2:E1:34:49

A=setup:active

A=mid:audio

A=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level

A=extmap:3 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time

A=recvonly

A=rtcp-mux

A=rtpmap:111 opus/48000/2

A=fmtp:111 minptime=10; useinbandfec=1

A=rtpmap:103 ISAC/16000

A=rtpmap:104 ISAC/32000

A=rtpmap:9 G722/8000

A=rtpmap:0 PCMU/8000

A=rtpmap:8 PCMA/8000

A=rtpmap:106 CN/32000

A=rtpmap:105 CN/16000

A=rtpmap:13 CN/8000

A=rtpmap:126 telephone-event/8000

A=maxptime:60

M=video 9 RTP/SAVPF 100 116 117 96

C=IN IP4 0.0.0.0

A=rtcp:9 IN IP4 0.0.0.0

A=ice-ufrag:ubQcfltTHAop9S73

A=ice-pwd:tM0zrbhW4uKe+h8Y9hVYkRQK

A=fingerprint:sha-256 65:84:AE:4D:4C:75:21:15

B:3E:57:62:A4:17:EB:C8:22:E1:FA:5B:6A:38:FB:A6:9E:E01:EA:B2:E1:34:49

A=setup:active

A=mid:video

A=extmap:2 urn:ietf:params:rtp-hdrext:toffset

A=extmap:3 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time

A=extmap:4 urn:3gpp:video-orientation

A=recvonly

A=rtcp-mux

A=rtpmap:100 VP8/90000

A=rtcp-fb:100 ccm fir

A=rtcp-fb:100 nack

A=rtcp-fb:100 nack pli

A=rtcp-fb:100 goog-remb

A=rtpmap:116 red/90000

A=rtpmap:117 ulpfec/90000

A=rtpmap:96 rtx/90000

A=fmtp:96 apt=100

98.180: pc2 setLocalDescription start (the remote pc2 object sends Answer signaling to the local pc1 object through the server)

98.182: pc1 setRemoteDescription start (pc1 receives the Answer signaling from pc2 and extracts the SDP descriptor contained in it)

98.203: pc1 ICE candidate:

Candidate:3031090232 1 udp 2122260223 192.168.1.20 52118 typ host generation 0

98.203: pc1 ICE candidate:

Candidate:3031090232 2 udp 2122260222 192.168.1.20 52119 typ host generation 0

98.204: pc2 received remote stream (pc2 or get pc1 audio / video stream)

98.204: pc2 setLocalDescription complete (pc2 has finished sending Answer signaling)

98.205: pc1 setRemoteDescription complete (pc1 received Answer signaling completed)

98.205: pc1 addIceCandidate success (pc1 added IceCandidate successfully)

98.206: pc2 ICE state: checking

ICE state change event: Event {}

98.239: pc2 ICE candidate:

Candidate:3031090232 1 udp 2122260223 192.168.1.20 52122 typ host generation 0

98.240: pc2 ICE candidate:

Candidate:3031090232 1 udp 2122260223 192.168.1.20 52122 typ host generation 0

98.242: pc1 ICE candidate:

Candidate:3031090232 1 udp 2122260223 192.168.1.20 52120 typ host generation 0

98.249: pc1 ICE candidate:

Candidate:3031090232 2 udp 2122260222 192.168.1.20 52121 typ host generation 0

98.249: pc1 ICE state: checking

ICE state change event: Event {}

98.250: pc2 addIceCandidate success (pc2 added IceCandidate successfully)

98.250: pc1 addIceCandidate success

98.272: pc1 ICE state: completed

ICE state change event: Event {}

98.275: pc1 ICE state: completed

ICE state change event: Event {}

98.279: pc2 ICE state: connected

ICE state change event: Event {}

98.349: Remote video size changed to 640x480

98.349: Setup time: 212.435ms

98.349: Remote video videoWidth: 640px, videoHeight: 480px

98.350: Remote video size changed to 640x480

135.775: Ending call

The above is the log analysis of how to establish a point-to-point connection in WebRTC shared by the editor. If you happen to have similar doubts, please refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report