【问题标题】:Android (Kotlin) WebRTC - "Failed to parse: "". Reason: Invalid SDP line"Android (Kotlin) WebRTC - “解析失败:”。原因:无效的 SDP 行“
【发布时间】:2019-12-19 16:44:45
【问题描述】:

我正在将 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.

以下是 SDP:

    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 库时,有人遇到过类似问题吗?

【问题讨论】:

    标签: kotlin webrtc-android


    【解决方案1】:

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

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

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

    【讨论】:

    • 对于我的情况(我将我的应用程序迁移到 Kotlin),只需要换行符“\n”。提醒确保本地和远程 SDP SessionDescription 均已修改。
    • 在我的情况下,最后是 2 个新行,我认为只需要 1 个新行
    猜你喜欢
    • 2017-06-26
    • 1970-01-01
    • 1970-01-01
    • 2016-10-17
    • 2022-10-20
    • 1970-01-01
    • 2019-07-26
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多