0

我正在尝试 iPhone 设备之间的 webRTC 视频通话。一个应用程序正在创建报价 SDP,如下所示。当我尝试设置此 SDP 时,在另一个应用程序中出现错误

错误 Domain=org.webrtc.RTCPeerConnection Code=-1 “无法设置远程报价 sdp:无法设置远程视频描述发送参数。” UserInfo={NSLocalizedDescription=设置远程offer sdp失败:设置远程视频描述发送参数失败。}

以下是用于设置报价和创建答案的代码。第二行self.peerConnection?.setRemoteDescription抛出错误。

 let sessionDescription = RTCSessionDescription(type: .offer, sdp: remoteSdp)
        self.peerConnection?.setRemoteDescription(sessionDescription, completionHandler: { [weak self] (error) in
            guard let this = self else { return }
            if let error = error {
                this.delegate?.webrtcClient(client: this, didReceiveError: error)
            } else {
                this.handleRemoteDescriptionSet()
                // create answer
                peerConnection.answer(for: this.callConstraint, completionHandler:
                    { (sdp, error) in
                        if let error = error {
                            this.delegate?.webrtcClient(client: this, didReceiveError: error)
                        } else {
                            this.handleSdpGenerated(sdpDescription: sdp)
                        }
                })
            }
        })

以下是Offer SDP格式

v=0

o=- 271054486825926104 2 IN IP4 127.0.0.1

s=-

t=0 0

a=group:BUNDLE video

a=msid-semantic: WMS ARDAMS

m=video 9 UDP/TLS/RTP/SAVPF 100 101 116 117 96

c=IN IP4 0.0.0.0

a=rtcp:9 IN IP4 0.0.0.0

a=ice-ufrag:mwCLNm7ZLzmDrtCu

a=ice-pwd:+alfGXoarzyKjISWRYAGyIH4

a=fingerprint:sha-256 44:0D:11:54:EC:62:CD:51:D0:E3:BB:A5:47:35:D1:27:48:4E:08:3B:AD:98:72:98:02:BA:06:C8:CC:12:0E:C0

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:101 VP9/90000

a=rtcp-fb:101 ccm fir

a=rtcp-fb:101 nack

a=rtcp-fb:101 nack pli

a=rtcp-fb:101 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 1767367305 3714792746

a=ssrc:1767367305 cname:9wPGj45IHVxtvO6N

a=ssrc:1767367305 msid:ARDAMS ARDAMSv0

a=ssrc:1767367305 mslabel:ARDAMS

a=ssrc:1767367305 label:ARDAMSv0

a=ssrc:3714792746 cname:9wPGj45IHVxtvO6N

a=ssrc:3714792746 msid:ARDAMS ARDAMSv0

a=ssrc:3714792746 mslabel:ARDAMS

a=ssrc:3714792746 label:ARDAMSv0
4

1 回答 1

0

您的报价 sdp中没有候选人。在您的 sdp 生成中,您必须等待生成候选人。您可以一次生成所有候选,也可以增量收集。无论如何,我没有看到任何冰候选人交换。也许检查一些开源项目。

于 2020-02-04T15:53:31.343 回答