温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

如何进行WebRTC建立点对点连接的日志分析

发布时间:2021-12-28 16:44:40 来源:亿速云 阅读:155 作者:柒染 栏目:云计算

这期内容当中小编将会给大家带来有关如何进行WebRTC建立点对点连接的日志分析,文章内容丰富且以专业的角度为大家分析和叙述,阅读完这篇文章希望大家可以有所收获。

对于初次接触 WebRTC 的小白来说,想要理解如何建立一个点对点连接还是有一定的难度的,虽然网上的点对点连接 demo 一大堆,但是从代码角度去理解还是有一定的难度的,希望下面这个思路对您也有帮助!
一、获取点对点日志

1、使用Google 浏览器访问:https://github.com/webrtc/samples,提供的“Basic peer connection” demo

2、鼠标右键,点击“审查元素”,打开 "Console" 控制台

3、点击“Basic peer connection” demo 页面的“Start”、“Call”按钮,建立一个点对点连接(基于同一个Web 页面,模拟点对点连接)

4、在Consle 控制台,鼠标右键,点击“Save as”保存运行日志

如何进行WebRTC建立点对点连接的日志分析 

二、日志信息与分析:

This appears to be Chrome
12.722: Requesting local stream(请求本地音视频流,即调用本地的摄像头与麦克风)
spec:   {"audio":true,"video":true}
chrome: {"audio":true,"video":true}
chrome: {"audio":true,"video":true}
14.022: Received local stream(调用本地的摄像头与麦克风成功,获得音视频流 stream 对象)
15.321: Local video videoWidth: 640px,  videoHeight: 480px
98.136: Starting call(呼叫远程 peer)
98.137: Using video device: Lenovo EasyCamera (174f:14ee)
98.137: Using audio device: 麦克风 (Realtek High Definition Audio)
98.137: Created local peer connection object pc1(创建本地的 PeerConnection 对象 pc1)
98.141: Created remote peer connection object pc2(创建远程的 PeerConnection 对象 pc1)
98.143: Added local stream to pc1(本地音视频流添加到PeerConnection 对象 pc1 对象)
98.144: pc1 createOffer start(pc1 开始创建 Offer 信令成功)
98.146: Offer from pc1 (pc1 创建 Offer 信令成功,如下所示)
v=0

o=- 1942065961337070347 2 IN IP4 127.0.0.1

s=-

t=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(pc1 对象将 offer信令通过服务器发送给远程的 pc2 对象)
98.148: pc2 setRemoteDescription start(pc2 接收到 pc1 的 Offer 信令并提取其中所包含的SDP 描述符)
98.149: pc2 createAnswer start(pc2 创建一个包含远程 peer 的SDP 描述符的 Answer 信令)
98.178: pc1 setLocalDescription complete(pc1 发送 Offer 信令完毕)
98.178: pc2 setRemoteDescription complete(pc2 接收 Offer 信令完毕)
98.179: Answer from pc2:(pc2 开始创建 Answer 信令成功,如下所示)
v=0

o=- 5093582210222064371 2 IN IP4 127.0.0.1

s=-

t=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(远程的pc2 对象将 Answer 信令通过服务器发送给本地的 pc1 对象)
98.182: pc1 setRemoteDescription start(pc1 接收到 pc2 的 Answer 信令并提取其中所包含的SDP 描述符)
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 或得到 pc1 音视频流)
98.204: pc2 setLocalDescription complete(pc2 发送 Answer 信令完毕)
98.205: pc1 setRemoteDescription complete(pc1 接收 Answer 信令完毕)
98.205: pc1 addIceCandidate success (pc1 添加 IceCandidate 成功)
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 添加 IceCandidate 成功)
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

上述就是小编为大家分享的如何进行WebRTC建立点对点连接的日志分析了,如果刚好有类似的疑惑,不妨参照上述分析进行理解。如果想知道更多相关知识,欢迎关注亿速云行业资讯频道。

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI