WebRTC:为什么从iPhone设备到其他iPhone设备不起作用,在其他情况下却起作用?

时间:2019-06-03 17:44:01

标签: swift webrtc-ios

我正在与Android开发人员一起进行应用程序的音频和视频通话。当我从iPhone呼叫到iPhone时出现问题,但我有黑屏,没有音频,也没有视频,即使我与候选人和sdp进行报价,发送报价,然后接收答案,用新的sdp处理答案...,开始连接 打包得当的证明是,当我从iPhone呼叫到Android时,一切正常(音频和视频有效),当Android呼叫我到iPhone时,一切也正常(音频和视频正常)。 但是我的巨大问题是,当我从iPhone拨打iPhone时,我的屏幕黑屏,没有音频,也没有视频!

我遵循WebRTC和iOS步骤的基础是本文:https://hackernoon.com/swiftywebrtc-789936b0e39b

我阅读并研究了STUN和TURN服务器,我测试的所有手机都在同一网络上,所以我认为这不是问题。

这里是要约,下面是从iPhone拨打iPhone时得到的答案。

Here is the Offer which I'm sending:
 {
  "candidates" : [
    {
      "sdpMLineIndex" : 0,
      "sdpMid" : "audio",
      "candidate" : "candidate:3573973069 1 udp 2122260223 192.168.0.102 57388 typ host generation 0 ufrag PmQa network-id 1 network-cost 10"
    },
    {
      "sdpMLineIndex" : 0,
      "sdpMid" : "audio",
      "candidate" : "candidate:467259651 1 udp 2122194687 169.254.105.176 61008 typ host generation 0 ufrag PmQa network-id 2 network-cost 10"
    },
    {
      "sdpMLineIndex" : 0,
      "sdpMid" : "audio",
      "candidate" : "candidate:2143624614 1 udp 2122129151 10.159.255.238 58772 typ host generation 0 ufrag PmQa network-id 5 network-cost 900"
    },
    {
      "sdpMLineIndex" : 1,
      "sdpMid" : "video",
      "candidate" : "candidate:3573973069 1 udp 2122260223 192.168.0.102 49473 typ host generation 0 ufrag PmQa network-id 1 network-cost 10"
    },
    {
      "sdpMLineIndex" : 1,
      "sdpMid" : "video",
      "candidate" : "candidate:467259651 1 udp 2122194687 169.254.105.176 56397 typ host generation 0 ufrag PmQa network-id 2 network-cost 10"
    },
    {
      "sdpMLineIndex" : 1,
      "sdpMid" : "video",
      "candidate" : "candidate:2143624614 1 udp 2122129151 10.159.255.238 51734 typ host generation 0 ufrag PmQa network-id 5 network-cost 900"
    },
    {
      "sdpMLineIndex" : 0,
      "sdpMid" : "audio",
      "candidate" : "candidate:1414432505 1 udp 1686052607 178.149.16.193 57388 typ srflx raddr 192.168.0.102 rport 57388 generation 0 ufrag PmQa network-id 1 network-cost 10"
    },
    {
      "sdpMLineIndex" : 1,
      "sdpMid" : "video",
      "candidate" : "candidate:1414432505 1 udp 1686052607 178.149.16.193 49473 typ srflx raddr 192.168.0.102 rport 49473 generation 0 ufrag PmQa network-id 1 network-cost 10"
    }
  ],
  "sdp" : {
    "notification_type" : "2",
    "type" : "offer",
    "sdp" : "v=0\r\no=- 7378231773976427244 2 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\na=group:BUNDLE audio video\r\na=msid-semantic: WMS RTCmS\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:PmQa\r\na=ice-pwd:qKQtexPmgIULxCfeSrhTx62R\r\na=ice-options:trickle renomination\r\na=fingerprint:sha-256 77:DF:44:BB:(one part I deleted):65\r\na=setup:actpass\r\na=mid:audio\r\na=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level\r\na=extmap:2 http:\/\/www.ietf.org\/id\/draft-holmer-rmcat-transport-wide-cc-extensions-01\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:2159577531 cname:FlqOn35bfDDYmBBX\r\na=ssrc:2159577531 msid:RTCmS RTCaS0\r\na=ssrc:2159577531 mslabel:RTCmS\r\na=ssrc:2159577531 label:RTCaS0\r\nm=video 9 UDP\/TLS\/RTP\/SAVPF 96 97 98 99 100 101 127\r\nc=IN IP4 0.0.0.0\r\na=rtcp:9 IN IP4 0.0.0.0\r\na=ice-ufrag:PmQa\r\na=ice-pwd:qKQtexPmgIULxCfeSrhTx62R\r\na=ice-options:trickle renomination\r\na=fingerprint:sha-256 77:(one part I deleted):43:06:1E:9A:F8:29:65\r\na=setup:actpass\r\na=mid:video\r\na=extmap:14 urn:ietf:params:rtp-hdrext:toffset\r\na=extmap:13 http:\/\/www.webrtc.org\/experiments\/rtp-hdrext\/abs-send-time\r\na=extmap:3 urn:3gpp:video-orientation\r\na=extmap:2 http:\/\/www.ietf.org\/id\/draft-holmer-rmcat-transport-wide-cc-extensions-01\r\na=extmap:5 http:\/\/www.webrtc.org\/experiments\/rtp-hdrext\/playout-delay\r\na=extmap:6 http:\/\/www.webrtc.org\/experiments\/rtp-hdrext\/video-content-type\r\na=extmap:7 http:\/\/www.webrtc.org\/experiments\/rtp-hdrext\/video-timing\r\na=extmap:8 http:\/\/tools.ietf.org\/html\/draft-ietf-avtext-framemarking-07\r\na=extmap:9 http:\/\/www.webrtc.org\/experiments\/rtp-hdrext\/color-space\r\na=sendrecv\r\na=rtcp-mux\r\na=rtcp-rsize\r\na=rtpmap:96 H264\/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=fmtp:96 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=640c34\r\na=rtpmap:97 rtx\/90000\r\na=fmtp:97 apt=96\r\na=rtpmap:98 H264\/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=fmtp:98 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e034\r\na=rtpmap:99 rtx\/90000\r\na=fmtp:99 apt=98\r\na=rtpmap:100 red\/90000\r\na=rtpmap:101 rtx\/90000\r\na=fmtp:101 apt=100\r\na=rtpmap:127 ulpfec\/90000\r\na=ssrc-group:FID 2644368230 122103035\r\na=ssrc:2644368230 cname:FlqOn35bfDDYmBBX\r\na=ssrc:2644368230 msid:RTCmS RTCvS0\r\na=ssrc:2644368230 mslabel:RTCmS\r\na=ssrc:2644368230 label:RTCvS0\r\na=ssrc:122103035 cname:FlqOn35bfDDYmBBX\r\na=ssrc:122103035 msid:RTCmS RTCvS0\r\na=ssrc:122103035 mslabel:RTCmS\r\na=ssrc:122103035 label:RTCvS0\r\n"
  },
  "token" : "hereIsSomeToken",
  "to" : "user2"
}


//Here is the Answer which I'm sending

Print the Answer:
 ["candidates": <__NSArrayM 0x28143eaf0>(
{
    candidate = "candidate:2131708102 1 udp 2122260223 192.168.0.100 50663 typ host generation 0 ufrag 7o7T network-id 1 network-cost 10";
    sdpMLineIndex = 0;
    sdpMid = audio;
},
{
    candidate = "candidate:831304758 1 tcp 1518280447 192.168.0.100 57132 typ host tcptype passive generation 0 ufrag 7o7T network-id 1 network-cost 10";
    sdpMLineIndex = 0;
    sdpMid = audio;
},
{
    candidate = "candidate:4266086002 1 udp 1686052607 178.149.16.193 50663 typ srflx raddr 192.168.0.100 rport 50663 generation 0 ufrag 7o7T network-id 1 network-cost 10";
    sdpMLineIndex = 0;
    sdpMid = audio;
},
{
    candidate = "candidate:4080636139 1 udp 41885439 51.254.34.143 48237 typ relay raddr 178.149.16.193 rport 50663 generation 0 ufrag 7o7T network-id 1 network-cost 10";
    sdpMLineIndex = 0;
    sdpMid = audio;
}
)
, "sdp": {
    sdp = "v=0
\no=- 8739635082235066639 2 IN IP4 127.0.0.1
\ns=-
\nt=0 0
\na=group:BUNDLE audio video
\na=msid-semantic: WMS RTCmS
\nm=audio 9 UDP/TLS/RTP/SAVPF 111 103 104 9 102 0 8 106 105 13 110 112 113 126
\nc=IN IP4 0.0.0.0
\na=rtcp:9 IN IP4 0.0.0.0
\na=ice-ufrag:7o7T
\na=ice-pwd:3tnoCmgsMLSJLpQSt2ZTuUbY
\na=ice-options:trickle renomination
\na=fingerprint:sha-256 89:(one part I deleted):CC:AD
\na=setup:active
\na=mid:audio
\na=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level
\na=extmap:2 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
\na=sendrecv
\na=rtcp-mux
\na=rtpmap:111 opus/48000/2
\na=rtcp-fb:111 transport-cc
\na=fmtp:111 minptime=10;useinbandfec=1
\na=rtpmap:103 ISAC/16000
\na=rtpmap:104 ISAC/32000
\na=rtpmap:9 G722/8000
\na=rtpmap:102 ILBC/8000
\na=rtpmap:0 PCMU/8000
\na=rtpmap:8 PCMA/8000
\na=rtpmap:106 CN/32000
\na=rtpmap:105 CN/16000
\na=rtpmap:13 CN/8000
\na=rtpmap:110 telephone-event/48000
\na=rtpmap:112 telephone-event/32000
\na=rtpmap:113 telephone-event/16000
\na=rtpmap:126 telephone-event/8000
\na=ssrc:2064335125 cname:qptbzDyOV8fCjisY
\na=ssrc:2064335125 msid:RTCmS RTCaS0
\na=ssrc:2064335125 mslabel:RTCmS
\na=ssrc:2064335125 label:RTCaS0
\nm=video 9 UDP/TLS/RTP/SAVPF 96 97 98 99 100 101 127
\nc=IN IP4 0.0.0.0
\na=rtcp:9 IN IP4 0.0.0.0
\na=ice-ufrag:7o7T
\na=ice-pwd:3tnoCmgsMLSJLpQSt2ZTuUbY
\na=ice-options:trickle renomination
\na=fingerprint:sha-256 89:(one part I deleted):CC:AD
\na=setup:active
\na=mid:video
\na=extmap:14 urn:ietf:params:rtp-hdrext:toffset
\na=extmap:13 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
\na=extmap:3 urn:3gpp:video-orientation
\na=extmap:2 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
\na=extmap:5 http://www.webrtc.org/experiments/rtp-hdrext/playout-delay
\na=extmap:6 http://www.webrtc.org/experiments/rtp-hdrext/video-content-type
\na=extmap:7 http://www.webrtc.org/experiments/rtp-hdrext/video-timing
\na=extmap:8 http://tools.ietf.org/html/draft-ietf-avtext-framemarking-07
\na=extmap:9 http://www.webrtc.org/experiments/rtp-hdrext/color-space
\na=sendrecv
\na=rtcp-mux
\na=rtcp-rsize
\na=rtpmap:96 H264/90000
\na=rtcp-fb:96 goog-remb
\na=rtcp-fb:96 transport-cc
\na=rtcp-fb:96 ccm fir
\na=rtcp-fb:96 nack
\na=rtcp-fb:96 nack pli
\na=fmtp:96 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=640c2a
\na=rtpmap:97 rtx/90000
\na=fmtp:97 apt=96
\na=rtpmap:98 H264/90000
\na=rtcp-fb:98 goog-remb
\na=rtcp-fb:98 transport-cc
\na=rtcp-fb:98 ccm fir
\na=rtcp-fb:98 nack
\na=rtcp-fb:98 nack pli
\na=fmtp:98 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e02a
\na=rtpmap:99 rtx/90000
\na=fmtp:99 apt=98
\na=rtpmap:100 red/90000
\na=rtpmap:101 rtx/90000
\na=fmtp:101 apt=100
\na=rtpmap:127 ulpfec/90000
\na=ssrc-group:FID 1099932280 478675757
\na=ssrc:1099932280 cname:qptbzDyOV8fCjisY
\na=ssrc:1099932280 msid:RTCmS RTCvS0
\na=ssrc:1099932280 mslabel:RTCmS
\na=ssrc:1099932280 label:RTCvS0
\na=ssrc:478675757 cname:qptbzDyOV8fCjisY
\na=ssrc:478675757 msid:RTCmS RTCvS0
\na=ssrc:478675757 mslabel:RTCmS
\na=ssrc:478675757 label:RTCvS0
\n";
    type = answer;
}, "signal_from": user2, "signal_to": user1]

这是一个大问题,我没有出现任何错误。对于RTCIceConnectionState,我得到RTCIceConnectionStateConnected。 我已经不知道会有什么问题了。

谁能告诉我问题出在哪里或可能是什么问题?

每个想法都可以引起问题,我们对此表示欢迎。 同样,我仍然可以探索和挖掘哪个方向。

0 个答案:

没有答案