Android WebRTC连接成功率低

Android WebRTC low success connection rate

我正在使用本机 android WebRTC 开发视频聊天应用程序。 我正在使用 public google STUN 服务器和 XIRRYS STUN 和 TURN 服务器。

我的问题是连接成功率很低!

连接成功率如下:

在所有情况下,offer、answer 和 candidates 消息都运行很好地通过信令服务器,但正如我所说,在任何情况下连接都会失败。

我尝试检查 SDP 和候选人信息,但我看不出有任何问题:

这是 LOGCAT 中的一个失败示例:

    2019-08-30 12:35:20.647 8450-8580 D/ZCF localconnection: onRenegotiationNeeded 
    2019-08-30 12:35:20.649 8450-8580 D/ZCF local offer sdp: onCreateSuccess v=0
    o=- 517380758811234323 2 IN IP4 127.0.0.1
    s=-
    t=0 0
    a=group:BUNDLE audio video
    a=msid-semantic: WMS localMediaStream
    m=audio 9 UDP/TLS/RTP/SAVPF 111 103 104 9 102 0 8 106 105 13 110 112 113 126
    c=IN IP4 0.0.0.0
    a=rtcp:9 IN IP4 0.0.0.0
    a=ice-ufrag:Q6E1
    a=ice-pwd:Mtu+EvxO9zwAIYBAMrqgphUl
    a=ice-options:trickle renomination
    a=fingerprint:sha-256 96:FF:68:5B:85:00:71:06:58:93:7F:92:BA:CD:68:6A:31:D7:BC:95:5B:1E:F6:A8:C6:31:66:3F:90:B6:35:03
    a=setup:actpass
    a=mid:audio
    a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level
    a=sendrecv
    a=rtcp-mux
    a=rtpmap:111 opus/48000/2
    a=rtcp-fb:111 transport-cc
    a=fmtp:111 minptime=10;useinbandfec=1
    a=rtpmap:103 ISAC/16000
    a=rtpmap:104 ISAC/32000
    a=rtpmap:9 G722/8000
    a=rtpmap:102 ILBC/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:110 telephone-event/48000
    a=rtpmap:112 telephone-event/32000
    a=rtpmap:113 telephone-event/16000
    a=rtpmap:126 telephone-event/8000
    a=ssrc:831571398 cname:Q8DS5ia+kdlu8Q1f
    a=ssrc:831571398 msid:localMediaStream localAudioTrack
    a=ssrc:831571398 mslabel:localMediaStream
    a=ssrc:831571398 label:localAudioTrack
    m=video 9 UDP/TLS/RTP/SAVPF 96 97 98 99 100 101 127 124 125
    c=IN IP4 0.0.0.0
    a=rtcp:9 IN IP4 0.0.0.0
    a=ice-ufrag:Q6E1
    a=ice-pwd:Mtu+EvxO9zwAIYBAMrqgphUl
    a=ice-options:trickle renomination
    a=fingerprint:sha-256 96:FF:68:5B:85:00:71:06:58:93:7F:92:BA:CD:68:6A:31:D7:BC:95:5B:1E:F6:A8:C6:31:66:3F:90:B6:35:03
    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=extmap:5 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
    a=extmap:6 http://www.webrtc.org/experiments/rtp-hdrext/playout-delay
    a=extmap:7 http://www.webrtc.org/experiments/rtp-hdrext/video-content-type
    a=extmap:8 http://www.webrtc.org/experiments/rtp-hdrext/video-timing
    a=extmap:10 http://tools.ietf.org/html/draft-ietf-avtext-framemarking-07
    a=extmap:12 http://www.webrtc.org/experiments/rtp-hdrext/color-space
    a=sendrecv
    a=rtcp-mux
    a=rtcp-rsize
    a=rtpmap:96 VP8/90000
    a=rtcp-fb:96 goog-remb
    a=rtcp-fb:96 transport-cc
    a=rtcp-fb:96 ccm fir
    a=rtcp-fb:96 nack
    a=rtcp-fb:96 nack pli
    a=rtpmap:97 rtx/90000
    a=fmtp:97 apt=96
    a=rtpmap:98 VP9/90000
    a=rtcp-fb:98 goog-remb
    a=rtcp-fb:98 transport-cc
    a=rtcp-fb:98 ccm fir
    a=rtcp-fb:98 nack
    a=rtcp-fb:98 nack pli
    a=rtpmap:99 rtx/90000
    a=fmtp:99 apt=98
    a=rtpmap:100 H264/90000
    a=rtcp-fb:100 goog-remb
    a=rtcp-fb:100 transport-cc
    a=rtcp-fb:100 ccm fir
    a=rtcp-fb:100 nack
    a=rtcp-fb:100 nack pli
    a=fmtp:100 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f
    a=rtpmap:101 rtx/90000
    a=fmtp:101 apt=100
    a=rtpmap:127 red/90000
    a=rtpmap:124 rtx/90000
    a=fmtp:124 apt=127
    a=rtpmap:125 ulpfec/90000
    a=ssrc-group:FID 4145536005 1421838753
    a=ssrc:4145536005 cname:Q8DS5ia+kdlu8Q1f
    a=ssrc:4145536005 msid:localMediaStream 100
    a=ssrc:4145536005 mslabel:localMediaStream
    a=ssrc:4145536005 label:100
    a=ssrc:1421838753 cname:Q8DS5ia+kdlu8Q1f
    a=ssrc:1421838753 msid:localMediaStream 100
    a=ssrc:1421838753 mslabel:localMediaStream
    a=ssrc:1421838753 label:100
2019-08-30 12:35:20.658 8450-8580 D/ZCF localconnection: onSignalingChange HAVE_LOCAL_OFFER
2019-08-30 12:35:20.692 8450-8742 I/org.webrtc.Logging: NetworkMonitorAutoDetect: capabilities changed: [ Transports: WIFI Capabilities: NOT_METERED&INTERNET&NOT_RESTRICTED&TRUSTED&NOT_VPN&VALIDATED&NOT_ROAMING&FOREGROUND&NOT_CONGESTED&NOT_SUSPENDED Unwanted:  LinkUpBandwidth>=1048576Kbps LinkDnBandwidth>=1048576Kbps SignalStrength: -40 SSID: "zcf"]
2019-08-30 12:35:20.696 8450-8580 I/ZCF: Message Sent to WebSocket={"to":"2","from":"1","type":"offer","sdp":"v=0\r\no=- 517380758811234323 2 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\na=group:BUNDLE audio video\r\na=msid-semantic: WMS localMediaStream\r\nm=audio 9 UDP\/TLS\/RTP\/SAVPF 111 103 104 9 102 0 8 106 105 13 110 112 113 126\r\nc=IN IP4 0.0.0.0\r\na=rtcp:9 IN IP4 0.0.0.0\r\na=ice-ufrag:Q6E1\r\na=ice-pwd:Mtu+EvxO9zwAIYBAMrqgphUl\r\na=ice-options:trickle renomination\r\na=fingerprint:sha-256 96:FF:68:5B:85:00:71:06:58:93:7F:92:BA:CD:68:6A:31:D7:BC:95:5B:1E:F6:A8:C6:31:66:3F:90:B6:35:03\r\na=setup:actpass\r\na=mid:audio\r\na=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level\r\na=sendrecv\r\na=rtcp-mux\r\na=rtpmap:111 opus\/48000\/2\r\na=rtcp-fb:111 transport-cc\r\na=fmtp:111 minptime=10;useinbandfec=1\r\na=rtpmap:103 ISAC\/16000\r\na=rtpmap:104 ISAC\/32000\r\na=rtpmap:9 G722\/8000\r\na=rtpmap:102 ILBC\/8000\r\na=rtpmap:0 PCMU\/8000\r\na=rtpmap:8 PCMA\/8000\r\na=rtpmap:106 CN\/32000\r\na=rtpmap:105 CN\/16000\r\na=rtpmap:13 CN\/8000\r\na=rtpmap:110 telephone-event\/48000\r\na=rtpmap:112 telephone-event\/32000\r\na=rtpmap:113 telephone-event\/16000\r\na=rtpmap:126 telephone-event\/8000\r\na=ssrc:831571398 cname:Q8DS5ia+kdlu8Q1f\r\na=ssrc:831571398 msid:localMediaStream localAudioTrack\r\na=ssrc:831571398 mslabel:localMediaStream\r\na=ssrc:831571398 label:localAudioTrack\r\nm=video 9 UDP\/TLS\/RTP\/SAVPF 96 97 98 99 100 101 127 124 125\r\nc=IN IP4 0.0.0.0\r\na=rtcp:9 IN IP4 0.0.0.0\r\na=ice-ufrag:Q6E1\r\na=ice-pwd:Mtu+EvxO9zwAIYBAMrqgphUl\r\na=ice-options:trickle renomination\r\na=fingerprint:sha-256 96:FF:68:5B:85:00:71:06:58:93:7F:92:BA:CD:68:6A:31:D7:BC:95:5B:1E:F6:A8:C6:31:66:3F:90:B6:35:03\r\na=setup:actpass\r\na=mid:video\r\na=extmap:2 urn:ietf:params:rtp-hdrext:toffset\r\na=extmap:3 http:\/\/www.webrtc.org\/experiments\/rtp-hdrext\/abs-send-time\r\na=extmap:4 urn:3gpp:video-orientation\r\na=extmap:5 http:\/\/www.ietf.org\/id\/draft-holmer-rmcat-transport-wide-cc-extensions-01\r\na=extmap:6 http:\/\/www.webrtc.org\/experiments\/rtp-hdrext\/playout-delay\r\na=extmap:7 http:\/\/www.webrtc.org\/experiments\/rtp-hdrext\/video-content-type\r\na=extmap:8 http:\/\/www.webrtc.org\/experiments\/rtp-hdrext\/video-timing\r\na=extmap:10 http:\/\/tools.ietf.org\/html\/draft-ietf-avtext-framemarking-07\r\na=extmap:12 http:\/\/www.webrtc.org\/experiments\/rtp-hdrext\/color-space\r\na=sendrecv\r\na=rtcp-mux\r\na=rtcp-rsize\r\na=rtpmap:96 VP8\/90000\r\na=rtcp-fb:96 goog-remb\r\na=rtcp-fb:96 transport-cc\r\na=rtcp-fb:96 ccm fir\r\na=rtcp-fb:96 nack\r\na=rtcp-fb:96 nack pli\r\na=rtpmap:97 rtx\/90000\r\na=fmtp:97 apt=96\r\na=rtpmap:98 VP9\/90000\r\na=rtcp-fb:98 goog-remb\r\na=rtcp-fb:98 transport-cc\r\na=rtcp-fb:98 ccm fir\r\na=rtcp-fb:98 nack\r\na=rtcp-fb:98 nack pli\r\na=rtpmap:99 rtx\/90000\r\na=fmtp:99 apt=98\r\na=rtpmap:100 H264\/90000\r\na=rtcp-fb:100 goog-remb\r\na=rtcp-fb:100 transport-cc\r\na=rtcp-fb:100 ccm fir\r\na=rtcp-fb:100 nack\r\na=rtcp-fb:100 nack pli\r\na=fmtp:100 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f\r\na=rtpmap:101 rtx\/90000\r\na=fmtp:101 apt=100\r\na=rtpmap:127 red\/90000\r\na=rtpmap:124 rtx\/90000\r\na=fmtp:124 apt=127\r\na=rtpmap:125 ulpfec\/90000\r\na=ssrc-group:FID 4145536005 1421838753\r\na=ssrc:4145536005 cname:Q8DS5ia+kdlu8Q1f\r\na=ssrc:4145536005 msid:localMediaStream 100\r\na=ssrc:4145536005 mslabel:localMediaStream\r\na=ssrc:4145536005 label:100\r\na=ssrc:1421838753 cname:Q8DS5ia+kdlu8Q1f\r\na=ssrc:1421838753 msid:localMediaStream 100\r\na=ssrc:1421838753 mslabel:localMediaStream\r\na=ssrc:1421838753 label:100\r\n"}
2019-08-30 12:35:20.696 8450-8580 I/ZCF: createOffer----> onCreateSuccess
2019-08-30 12:35:20.696 8450-8580 I/ZCF: createOffer---> connectionState: 0 NEW
2019-08-30 12:35:20.696 8450-8580 D/ZCF local set local: onSetSuccess 
2019-08-30 12:35:20.696 8450-8580 D/ZCF localconnection: onIceGatheringChange GATHERING
2019-08-30 12:35:20.712 8450-8580 I/ZCF: onIceCandidate ---> connectionState: 0 NEW
2019-08-30 12:35:20.712 8450-8580 D/ZCF localconnection: onIceCandidate audio:0:candidate:2087201215 1 udp 2122260223 192.168.1.14 41002 typ host generation 0 ufrag Q6E1 network-id 3 network-cost 10:
2019-08-30 12:35:20.713 8450-8580 I/ZCF: Message Sent to WebSocket={"type":"candidate","to":"2","from":"1","candidate":"{\"sdpMid\":\"audio\",\"sdpMLineIndex\":0,\"candidate\":\"candidate:2087201215 1 udp 2122260223 192.168.1.14 41002 typ host generation 0 ufrag Q6E1 network-id 3 network-cost 10\"}"}
2019-08-30 12:35:20.713 8450-8580 I/ZCF: onIceCandidate ---> connectionState: 0 NEW
2019-08-30 12:35:20.714 8450-8580 D/ZCF localconnection: onIceCandidate audio:0:candidate:559267639 1 udp 2122202367 ::1 41426 typ host generation 0 ufrag Q6E1 network-id 2:
2019-08-30 12:35:20.715 8450-8580 I/ZCF: Message Sent to WebSocket={"type":"candidate","to":"2","from":"1","candidate":"{\"sdpMid\":\"audio\",\"sdpMLineIndex\":0,\"candidate\":\"candidate:559267639 1 udp 2122202367 ::1 41426 typ host generation 0 ufrag Q6E1 network-id 2\"}"}
2019-08-30 12:35:20.715 8450-8580 I/ZCF: onIceCandidate ---> connectionState: 0 NEW
2019-08-30 12:35:20.715 8450-8580 D/ZCF localconnection: onIceCandidate audio:0:candidate:1510613869 1 udp 2122129151 127.0.0.1 42151 typ host generation 0 ufrag Q6E1 network-id 1:
2019-08-30 12:35:20.716 8450-8580 I/ZCF: Message Sent to WebSocket={"type":"candidate","to":"2","from":"1","candidate":"{\"sdpMid\":\"audio\",\"sdpMLineIndex\":0,\"candidate\":\"candidate:1510613869 1 udp 2122129151 127.0.0.1 42151 typ host generation 0 ufrag Q6E1 network-id 1\"}"}
2019-08-30 12:35:20.716 8450-8580 I/ZCF: onIceCandidate ---> connectionState: 0 NEW
2019-08-30 12:35:20.717 8450-8580 D/ZCF localconnection: onIceCandidate video:1:candidate:2087201215 1 udp 2122260223 192.168.1.14 40642 typ host generation 0 ufrag Q6E1 network-id 3 network-cost 10:
2019-08-30 12:35:20.718 8450-8580 I/ZCF: Message Sent to WebSocket={"type":"candidate","to":"2","from":"1","candidate":"{\"sdpMid\":\"video\",\"sdpMLineIndex\":1,\"candidate\":\"candidate:2087201215 1 udp 2122260223 192.168.1.14 40642 typ host generation 0 ufrag Q6E1 network-id 3 network-cost 10\"}"}
2019-08-30 12:35:20.718 8450-8580 I/ZCF: onIceCandidate ---> connectionState: 0 NEW
2019-08-30 12:35:20.718 8450-8580 D/ZCF localconnection: onIceCandidate video:1:candidate:559267639 1 udp 2122202367 ::1 49813 typ host generation 0 ufrag Q6E1 network-id 2:
2019-08-30 12:35:20.719 8450-8580 I/ZCF: Message Sent to WebSocket={"type":"candidate","to":"2","from":"1","candidate":"{\"sdpMid\":\"video\",\"sdpMLineIndex\":1,\"candidate\":\"candidate:559267639 1 udp 2122202367 ::1 49813 typ host generation 0 ufrag Q6E1 network-id 2\"}"}
2019-08-30 12:35:20.720 8450-8580 I/ZCF: onIceCandidate ---> connectionState: 0 NEW
2019-08-30 12:35:20.720 8450-8580 D/ZCF localconnection: onIceCandidate video:1:candidate:1510613869 1 udp 2122129151 127.0.0.1 44066 typ host generation 0 ufrag Q6E1 network-id 1:
2019-08-30 12:35:20.721 8450-8580 I/ZCF: Message Sent to WebSocket={"type":"candidate","to":"2","from":"1","candidate":"{\"sdpMid\":\"video\",\"sdpMLineIndex\":1,\"candidate\":\"candidate:1510613869 1 udp 2122129151 127.0.0.1 44066 typ host generation 0 ufrag Q6E1 network-id 1\"}"}
2019-08-30 12:35:20.801 8450-8580 I/ZCF: onIceCandidate ---> connectionState: 0 NEW
2019-08-30 12:35:20.801 8450-8580 D/ZCF localconnection: onIceCandidate audio:0:candidate:842163049 1 udp 1686052607 213.57.141.90 41002 typ srflx raddr 192.168.1.14 rport 41002 generation 0 ufrag Q6E1 network-id 3 network-cost 10:stun:159.89.29.128:80
2019-08-30 12:35:20.802 8450-8580 I/ZCF: Message Sent to WebSocket={"type":"candidate","to":"2","from":"1","candidate":"{\"sdpMid\":\"audio\",\"sdpMLineIndex\":0,\"candidate\":\"candidate:842163049 1 udp 1686052607 213.57.141.90 41002 typ srflx raddr 192.168.1.14 rport 41002 generation 0 ufrag Q6E1 network-id 3 network-cost 10\"}"}
2019-08-30 12:35:20.816 8450-8580 I/ZCF: onIceCandidate ---> connectionState: 0 NEW
2019-08-30 12:35:20.816 8450-8580 D/ZCF localconnection: onIceCandidate audio:0:candidate:1876313031 1 tcp 1518222591 ::1 37446 typ host tcptype passive generation 0 ufrag Q6E1 network-id 2:
2019-08-30 12:35:20.817 8450-8580 I/ZCF: Message Sent to WebSocket={"type":"candidate","to":"2","from":"1","candidate":"{\"sdpMid\":\"audio\",\"sdpMLineIndex\":0,\"candidate\":\"candidate:1876313031 1 tcp 1518222591 ::1 37446 typ host tcptype passive generation 0 ufrag Q6E1 network-id 2\"}"}
2019-08-30 12:35:20.818 8450-8580 I/ZCF: onIceCandidate ---> connectionState: 0 NEW
2019-08-30 12:35:20.818 8450-8580 D/ZCF localconnection: onIceCandidate audio:0:candidate:344579997 1 tcp 1518149375 127.0.0.1 42010 typ host tcptype passive generation 0 ufrag Q6E1 network-id 1:
2019-08-30 12:35:20.819 8450-8580 I/ZCF: Message Sent to WebSocket={"type":"candidate","to":"2","from":"1","candidate":"{\"sdpMid\":\"audio\",\"sdpMLineIndex\":0,\"candidate\":\"candidate:344579997 1 tcp 1518149375 127.0.0.1 42010 typ host tcptype passive generation 0 ufrag Q6E1 network-id 1\"}"}
2019-08-30 12:35:20.820 8450-8580 I/ZCF: onIceCandidate ---> connectionState: 0 NEW
2019-08-30 12:35:20.820 8450-8580 D/ZCF localconnection: onIceCandidate video:1:candidate:1876313031 1 tcp 1518222591 ::1 41321 typ host tcptype passive generation 0 ufrag Q6E1 network-id 2:
2019-08-30 12:35:20.821 8450-8580 I/ZCF: Message Sent to WebSocket={"type":"candidate","to":"2","from":"1","candidate":"{\"sdpMid\":\"video\",\"sdpMLineIndex\":1,\"candidate\":\"candidate:1876313031 1 tcp 1518222591 ::1 41321 typ host tcptype passive generation 0 ufrag Q6E1 network-id 2\"}"}
2019-08-30 12:35:20.822 8450-8580 I/ZCF: onIceCandidate ---> connectionState: 0 NEW
2019-08-30 12:35:20.822 8450-8580 D/ZCF localconnection: onIceCandidate video:1:candidate:842163049 1 udp 1686052607 213.57.141.90 40642 typ srflx raddr 192.168.1.14 rport 40642 generation 0 ufrag Q6E1 network-id 3 network-cost 10:stun:66.102.1.127:19302
2019-08-30 12:35:20.823 8450-8580 I/ZCF: Message Sent to WebSocket={"type":"candidate","to":"2","from":"1","candidate":"{\"sdpMid\":\"video\",\"sdpMLineIndex\":1,\"candidate\":\"candidate:842163049 1 udp 1686052607 213.57.141.90 40642 typ srflx raddr 192.168.1.14 rport 40642 generation 0 ufrag Q6E1 network-id 3 network-cost 10\"}"}
2019-08-30 12:35:20.828 8450-8580 I/ZCF: onIceCandidate ---> connectionState: 0 NEW
2019-08-30 12:35:20.828 8450-8580 D/ZCF localconnection: onIceCandidate video:1:candidate:344579997 1 tcp 1518149375 127.0.0.1 43485 typ host tcptype passive generation 0 ufrag Q6E1 network-id 1:
2019-08-30 12:35:20.830 8450-8580 I/ZCF: Message Sent to WebSocket={"type":"candidate","to":"2","from":"1","candidate":"{\"sdpMid\":\"video\",\"sdpMLineIndex\":1,\"candidate\":\"candidate:344579997 1 tcp 1518149375 127.0.0.1 43485 typ host tcptype passive generation 0 ufrag Q6E1 network-id 1\"}"}
2019-08-30 12:35:20.961 8450-8559 I/ZCF: Got Message From SOCKET:{"from":"2","to":"1","type":"answer","sdp":"v=0\r\no=- 147041557092641575 2 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\na=group:BUNDLE audio video\r\na=msid-semantic: WMS localMediaStream\r\nm=audio 9 UDP/TLS/RTP/SAVPF 111 103 104 9 102 0 8 106 105 13 110 112 113 126\r\nc=IN IP4 0.0.0.0\r\na=rtcp:9 IN IP4 0.0.0.0\r\na=ice-ufrag:zD1C\r\na=ice-pwd:fg2lXM5S68gQfjhYJiz4CIzc\r\na=ice-options:trickle renomination\r\na=fingerprint:sha-256 E0:B9:4E:EC:91:26:96:47:7F:09:7D:B6:21:19:AD:30:87:FB:9B:05:5B:73:9E:D3:55:A4:92:47:78:68:64:30\r\na=setup:active\r\na=mid:audio\r\na=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level\r\na=sendrecv\r\na=rtcp-mux\r\na=rtpmap:111 opus/48000/2\r\na=rtcp-fb:111 transport-cc\r\na=fmtp:111 minptime=10;useinbandfec=1\r\na=rtpmap:103 ISAC/16000\r\na=rtpmap:104 ISAC/32000\r\na=rtpmap:9 G722/8000\r\na=rtpmap:102 ILBC/8000\r\na=rtpmap:0 PCMU/8000\r\na=rtpmap:8 PCMA/8000\r\na=rtpmap:106 CN/32000\r\na=rtpmap:105 CN/16000\r\na=rtpmap:13 CN/8000\r\na=rtpmap:110 telephone-event/48000\r\na=rtpmap:112 telephone-event/32000\r\na=rtpmap:113 telephone-event/16000\r\na=rtpmap:126 telephone-event/8000\r\na=ssrc:1363396504 cname:4D2HgDuIZ41xb2u2\r\na=ssrc:1363396504 msid:localMediaStream localAudioTrack\r\na=ssrc:1363396504 mslabel:localMediaStream\r\na=ssrc:1363396504 label:localAudioTrack\r\nm=video 9 UDP/TLS/RTP/SAVPF 96 97 98 99 100 101 127 124 125\r\nc=IN IP4 0.0.0.0\r\na=rtcp:9 IN IP4 0.0.0.0\r\na=ice-ufrag:zD1C\r\na=ice-pwd:fg2lXM5S68gQfjhYJiz4CIzc\r\na=ice-options:trickle renomination\r\na=fingerprint:sha-256 E0:B9:4E:EC:91:26:96:47:7F:09:7D:B6:21:19:AD:30:87:FB:9B:05:5B:73:9E:D3:55:A4:92:47:78:68:64:30\r\na=setup:active\r\na=mid:video\r\na=extmap:2 urn:ietf:params:rtp-hdrext:toffset\r\na=extmap:3 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time\r\na=extmap:4 urn:3gpp:video-orientation\r\na=extmap:5 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01\r\na=extmap:6 http://www.webrtc.org/experiments/rtp-hdrext/playout-delay\r\na=extmap:7 http://www.webrtc.org/experiments/rtp-hdrext/video-content-type\r\na=extmap:8 http://www.webrtc.org/experiments/rtp-hdrext/video-timing\r\na=extmap:10 http://tools.ietf.org/html/draft-ietf-avtext-framemarking-07\r\na=extmap:12 http://www.webrtc.org/experiments/rtp-hdrext/color-space\r\na=sendrecv\r\na=rtcp-mux\r\na=rtcp-rsize\r\na=rtpmap:96 VP8/90000\r\na=rtcp-fb:96 goog-remb\r\na=rtcp-fb:96 transport-cc\r\na=rtcp-fb:96 ccm fir\r\na=rtcp-fb:96 nack\r\na=rtcp-fb:96 nack pli\r\na=rtpmap:97 rtx/90000\r\na=fmtp:97 apt=96\r\na=rtpmap:98 VP9/90000\r\na=rtcp-fb:98 goog-remb\r\na=rtcp-fb:98 transport-cc\r\na=rtcp-fb:98 ccm fir\r\na=rtcp-fb:98 nack\r\na=rtcp-fb:98 nack pli\r\na=rtpmap:99 rtx/90000\r\na=fmtp:99 apt=98\r\na=rtpmap:100 H264/90000\r\na=rtcp-fb:100 goog-remb\r\na=rtcp-fb:100 transport-cc\r\na=rtcp-fb:100 ccm fir\r\na=rtcp-fb:100 nack\r\na=rtcp-fb:100 nack pli\r\na=fmtp:100 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f\r\na=rtpmap:101 rtx/90000\r\na=fmtp:101 apt=100\r\na=rtpmap:127 red/90000\r\na=rtpmap:124 rtx/90000\r\na=fmtp:124 apt=127\r\na=rtpmap:125 ulpfec/90000\r\na=ssrc-group:FID 3714610068 3180849917\r\na=ssrc:3714610068 cname:4D2HgDuIZ41xb2u2\r\na=ssrc:3714610068 msid:localMediaStream 100\r\na=ssrc:3714610068 mslabel:localMediaStream\r\na=ssrc:3714610068 label:100\r\na=ssrc:3180849917 cname:4D2HgDuIZ41xb2u2\r\na=ssrc:3180849917 msid:localMediaStream 100\r\na=ssrc:3180849917 mslabel:localMediaStream\r\na=ssrc:3180849917 label:100\r\n"}
2019-08-30 12:35:20.990 8450-8580 D/ZCF localconnection: onSignalingChange STABLE
2019-08-30 12:35:21.041 8450-8580 I/ZCF: onIceConnectionChange ---> connectionState: 0 NEW
2019-08-30 12:35:21.041 8450-8580 I/ZCF: onIceConnectionChange CHECKING
2019-08-30 12:35:21.043 8450-8580 D/ZCF localconnection: onAddTrack [Lorg.webrtc.MediaStream;@72634d7
2019-08-30 12:35:21.043 8450-8580 D/ZCF localconnection: onAddTrack [Lorg.webrtc.MediaStream;@4a831c4
2019-08-30 12:35:21.044 8450-8580 I/ZCF: onAddStream ---> connectionState: 0 NEW
2019-08-30 12:35:21.044 8450-8580 D/ZCF localconnection: onAddStream [localMediaStream:A=1:V=1]
2019-08-30 12:35:21.044 8450-8580 D/ZCF localconnection: onConnectionChange CONNECTING
2019-08-30 12:35:21.044 8450-8580 D/ZCF localSetRemote: onSetSuccess 
2019-08-30 12:35:21.044 8450-8559 I/ZCF: onAnswerReceived---> connectionState: 0 CONNECTING
2019-08-30 12:35:21.045 8450-8559 I/ZCF: Got Message From SOCKET:{"candidate":"{\"sdpMid\":\"audio\",\"sdpMLineIndex\":0,\"candidate\":\"candidate:202810205 1 udp 2122260223 192.168.1.21 56587 typ host generation 0 ufrag zD1C network-id 3 network-cost 10\"}","from":"2","to":"1","type":"candidate"}
2019-08-30 12:35:21.048 8450-8559 I/ZCF: onIceCandidateReceived---> connectionState: 0 CONNECTING
2019-08-30 12:35:21.048 8450-8559 I/ZCF: Got Message From SOCKET:{"candidate":"{\"sdpMid\":\"audio\",\"sdpMLineIndex\":0,\"candidate\":\"candidate:559267639 1 udp 2122202367 ::1 35289 typ host generation 0 ufrag zD1C network-id 2\"}","from":"2","to":"1","type":"candidate"}
2019-08-30 12:35:21.051 8450-8559 I/ZCF: onIceCandidateReceived---> connectionState: 0 CONNECTING
2019-08-30 12:35:21.051 8450-8559 I/ZCF: Got Message From SOCKET:{"candidate":"{\"sdpMid\":\"audio\",\"sdpMLineIndex\":0,\"candidate\":\"candidate:1510613869 1 udp 2122129151 127.0.0.1 38621 typ host generation 0 ufrag zD1C network-id 1\"}","from":"2","to":"1","type":"candidate"}
2019-08-30 12:35:21.053 8450-8559 I/ZCF: onIceCandidateReceived---> connectionState: 0 CONNECTING
2019-08-30 12:35:21.237 8450-8559 I/ZCF: Got Message From SOCKET:{"candidate":"{\"sdpMid\":\"audio\",\"sdpMLineIndex\":0,\"candidate\":\"candidate:842163049 1 udp 1686052607 213.57.141.90 56587 typ srflx raddr 192.168.1.21 rport 56587 generation 0 ufrag zD1C network-id 3 network-cost 10\"}","from":"2","to":"1","type":"candidate"}
2019-08-30 12:35:21.240 8450-8559 I/ZCF: onIceCandidateReceived---> connectionState: 0 CONNECTING
2019-08-30 12:35:21.240 8450-8559 I/ZCF: Got Message From SOCKET:{"candidate":"{\"sdpMid\":\"audio\",\"sdpMLineIndex\":0,\"candidate\":\"candidate:1876313031 1 tcp 1518222591 ::1 44335 typ host tcptype passive generation 0 ufrag zD1C network-id 2\"}","from":"2","to":"1","type":"candidate"}
2019-08-30 12:35:21.244 8450-8559 I/ZCF: onIceCandidateReceived---> connectionState: 0 CONNECTING
2019-08-30 12:35:21.245 8450-8559 I/ZCF: Got Message From SOCKET:{"candidate":"{\"sdpMid\":\"audio\",\"sdpMLineIndex\":0,\"candidate\":\"candidate:344579997 1 tcp 1518149375 127.0.0.1 59586 typ host tcptype passive generation 0 ufrag zD1C network-id 1\"}","from":"2","to":"1","type":"candidate"}
2019-08-30 12:35:21.253 8450-8559 I/ZCF: onIceCandidateReceived---> connectionState: 0 CONNECTING
2019-08-30 12:35:21.299 8450-8580 D/ZCF localconnection: onIceGatheringChange COMPLETE
2019-08-30 12:35:53.512 8450-8580 I/ZCF: onIceConnectionChange ---> connectionState: 0 CONNECTING
2019-08-30 12:35:53.513 8450-8580 I/ZCF: onIceConnectionChange FAILED
2019-08-30 12:35:53.575 8450-8450 I/ZCF: reInitPeerConnection ---> Closing PeerConnection: 0
2019-08-30 12:35:53.579 8450-8580 I/ZCF: onIceConnectionChange ---> connectionState: 0 CONNECTING
2019-08-30 12:35:53.579 8450-8580 I/ZCF: onIceConnectionChange CLOSED
2019-08-30 12:35:53.580 8450-8580 D/ZCF localconnection: onConnectionChange CLOSED
2019-08-30 12:35:53.580 8450-8580 D/ZCF localconnection: onSignalingChange CLOSED

如何提高连接成功率?

经过多次检查、多次测试和连接尝试...... 经过这么多的日志和显示,我能够解决问题并实现 100% 的成功连接率,无论设备的网络如何!

如果你问的话,这是非常愚蠢的问题(在这种情况下总是如此),我在信令服务器端缺少 UTF8 编码,所以一些数据消息已损坏!

修复后,我的连接成功率达到了 100%!

tfrysinger, 对于你的问题,是的,我花了一些时间与 XirSys 一起聊天,但他们无法帮助我。

无论如何,我的电子邮件地址是 zionrevi@gmail.com。

谢谢, 锡安