【发布时间】:2021-05-11 15:25:56
【问题描述】:
我正在 iOS 上开发一个小型 Web rtc 框架,但在使用 setRemoteDescription 时遇到了困难。我编写了自己的 SDP 解析器/编写器并检查了它的各个方面。即使 SDP 看起来不错,它也总是失败:
let sessionDescription = RTCSessionDescription(type: .answer, sdp: sdp)
pc.setRemoteDescription(sessionDescription) { error in
if let error = error {
// Always fails with "SessionDescription is NULL"
}
else {
...
}
}
错误是:
Error Domain=org.webrtc.RTC_OBJC_TYPE(RTCPeerConnection) Code=-1 "SessionDescription is NULL." UserInfo={NSLocalizedDescription=SessionDescription is NULL.}
这里是sessionDescription的po:
v=0
o=clientlib 10000 1 IN IP4 0.0.0.0
s=-
t=0 0
a=ice-lite
a=fingerprint:sha-512 C9:CE:DF:4A:9A:35:95:6F:94:BF:14:82:50:A2:73:97:54:97:5D:1D:7A:C1:B0:31:A7:44:92:4A:A5:F1:ED:22:EB:A1:D2:22:7B:6F:76:96:F1:95:97:2E:49:4E:B1:A4:61:AF:D9:9E:82:55:C8:55:EA:6E:2B:56:BE:55:C4:3C
a=msid-semantic: WMS *
a=group:BUNDLE 0
m=video 7 96 97 98 99 100 101 127 123 125 122 124 100
c=IN IP4 127.0.0.1
a=rtpmap:100 VP8/90000
a=fmtp:100 x-google-start-bitrate=1000
a=extmap:4 urn:ietf:params:rtp-hdrext:sdes:mid
a=extmap:5 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id
a=extmap:6 urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id
a=extmap:2 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
a=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
a=extmap:8 http://tools.ietf.org/html/draft-ietf-avtext-framemarking-07
a=extmap:13 urn:3gpp:video-orientation
a=extmap:14 urn:ietf:params:rtp-hdrext:toffset
a=setup:active
a=mid:0
a=recvonly
a=ice-ufrag:jf3q436s5vhriv09
a=ice-pwd:s4sft4792k6gv49ml9psq9cantjt4hqj
a=candidate:udpcandidate 1 udp 1076558079 34.199.191.112 25738 typ host
a=candidate:tcpcandidate 1 tcp 1076302079 34.199.191.112 24688 typ host tcptype passive
a=end-of-candidates
a=ice-options:renomination
a=rtcp-mux
a=rtcp-rsize
对等连接 (pc) 以通常的方式创建:
let config = RTCConfiguration()
config.sdpSemantics = .unifiedPlan
let constraints = RTCMediaConstraints(mandatoryConstraints: nil, optionalConstraints: nil)
pc = peerConnectionFactory.peerConnection(with: config, constraints: constraints, delegate: self)
除了“SessionDescription is NULL”之外,还有什么方法可以获取更多关于 sdp 出了什么问题的信息? 任何提示,想法表示赞赏。
【问题讨论】:
-
你是怎么解决的?我面临同样的问题,编写了我自己的编码器/解码器,实际上在两边检查它是一样的,但我得到了同样的错误。非常感谢您的帮助。