Android (Kotlin) WebRTC - "Failed to parse: " ". Reason: Invalid SDP line"



我正在努力将WebRTC集成到项目中,并使用"实现'org.webrtc:google-webrtc:1.0.30039'"。当我只使用来自 Google 源 https://webrtc.googlesource.com/src/的示例项目时,它工作正常,没有任何问题。但是,当将所有 Java 文件转换为 Kotlin 并运行时,它总是抛出以下错误(SDP 行无效(。我确实验证了 Java 和 Kotlin 项目之间的 SDP 是相似的。我也尝试按照某些论坛的建议在SDP的末尾添加新行,也没有帮助。

以下是我在尝试创建报价时在 Logcat 中看到的错误:

E/webrtc_sdp.cc: (line 402): Failed to parse: "". Reason: Invalid SDP line.
E/PCRTCClient: Peerconnection error: setSDP error: SessionDescription is NULL.

以下是社民党:

v=0
o=- 3703865506153758141 2 IN IP4 127.0.0.1
s=-
t=0 0
a=group:BUNDLE 0 1
a=msid-semantic: WMS ARDAMS
m=video 9 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:WMCz
a=ice-pwd:7U8pMIKV8KizMp6zeYgpnD6X
a=ice-options:trickle renomination
a=mid:0
a=extmap:14 urn:ietf:params:rtp-hdrext:toffset
a=extmap:2 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
a=extmap:13 urn:3gpp:video-orientation
a=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
a=extmap:12 http://www.webrtc.org/experiments/rtp-hdrext/playout-delay
a=extmap:11 http://www.webrtc.org/experiments/rtp-hdrext/video-content-type
a=extmap:7 http://www.webrtc.org/experiments/rtp-hdrext/video-timing
a=extmap:8 http://tools.ietf.org/html/draft-ietf-avtext-framemarking-07
a=extmap:9 http://www.webrtc.org/experiments/rtp-hdrext/color-space
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=sendrecv
a=msid:ARDAMS ARDAMSv0
a=rtcp-mux
a=rtcp-rsize
a=crypto:0 AES_CM_128_HMAC_SHA1_80 inline:xpIiJ7ZL8lDPOZbcBrMV8Q0kH/7K2bwborNljNEq
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 3892029952 1800496854
a=ssrc:3892029952 cname:1P/brKdD8UOBMgTV
a=ssrc:3892029952 msid:ARDAMS ARDAMSv0
a=ssrc:3892029952 mslabel:ARDAMS
a=ssrc:3892029952 label:ARDAMSv0
a=ssrc:1800496854 cname:1P/brKdD8UOBMgTV
a=ssrc:1800496854 msid:ARDAMS ARDAMSv0
a=ssrc:1800496854 mslabel:ARDAMS
a=ssrc:1800496854 label:ARDAMSv0
m=audio 9 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:WMCz
a=ice-pwd:7U8pMIKV8KizMp6zeYgpnD6X
a=ice-options:trickle renomination
a=mid:1
a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level
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: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=sendrecv
a=msid:ARDAMS ARDAMSa0
a=rtcp-mux
a=crypto:0 AES_CM_128_HMAC_SHA1_80 inline:xpIiJ7ZL8lDPOZbcBrMV8Q0kH/7K2bwborNljNEq
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:167068800 cname:1P/brKdD8UOBMgTV
a=ssrc:167068800 msid:ARDAMS ARDAMSa0
a=ssrc:167068800 mslabel:ARDAMS
a=ssrc:167068800 label:ARDAMSa0 

有人在基于 Kotlin 的 android 应用程序中使用 WebRTC 库时看到类似的问题吗?

我刚刚遇到了同样的问题。问题是,根据这个 discuss-webrtc 邮件列表线程,会话描述的末尾需要rn。 您可以通过在构造SessionDescription对象时简单地在描述字符串的末尾附加rn来解决此问题,例如:

val sdp = SessionDescription(origSdp.type, "${sdpDescription.trim()}rn")

还有一个跟踪此神秘错误消息的错误。

最新更新