Android上的LibKingle CreateAnswer上的SRTP错误

Android上的LibKingle CreateAnswer上的SRTP错误,android,webrtc,libjingle,Android,Webrtc,Libjingle,我正在构建一个android应用程序,它应该能够与另一个基于LibKingle的客户端进行音频通信 我要做的第一件事是在“另一个”客户端和我的android应用程序之间建立一个呼叫。我们使用XMPP作为信令服务 因此,在此之后: peerConnectiobObj.setRemoteDescription(sdp) 我得到了successcallback(所以我想远程描述很好?) 然后根据我的想法,我已经找到了自己的答案 @Override public void onCreateSucces

我正在构建一个android应用程序,它应该能够与另一个基于LibKingle的客户端进行音频通信

我要做的第一件事是在“另一个”客户端和我的android应用程序之间建立一个呼叫。我们使用XMPP作为信令服务

因此,在此之后:

peerConnectiobObj.setRemoteDescription(sdp)
我得到了successcallback(所以我想远程描述很好?) 然后根据我的想法,我已经找到了自己的答案

@Override
public void onCreateSuccess(SessionDescription sessionDescription)
{
    peerConnectiobObj.createAnswer(theSDPobserver, MediaConstraints);
}
但我最终进入了错误回调:(

s告诉我的

Failed to set local answer sdp: Session error code: ERROR_CONTENT. Session error description: Failed to setup SRTP filter..
我觉得很失落,我甚至不知道这意味着什么。如果有人能给我指出正确的方向,我会是一个更快乐的开发者

事实上,说到这件事,我觉得有点不知所措……)

编辑:

这就是我的本地SDP在遇到OnSetFailure(字符串s)时的样子

编辑: 我更新了libjingle.jar,并用当前主干重新编译了。 无法成功创建答案()

但当我这么做的时候

setLocalDescription()
我得到公共void onSetFailure(字符串s)CB

这是我到达该州时的本地SDP:

v=0
o=- 5609339699751423572 2 IN IP4 127.0.0.1
s=-
t=0 0
a=group:BUNDLE audio
a=msid-semantic: WMS fAy0FNrYIDVfeRwX5X0IK5TOCVTNJOXt4Cdb
m=audio 1 RTP/SAVPF 0
c=IN IP4 0.0.0.0
a=rtcp:1 IN IP4 0.0.0.0
a=ice-ufrag:HvkTUFYLQHFQYV1a
a=ice-pwd:OtBToOqg56IROXkI1zpljupo
a=mid:audio
a=sendrecv
a=rtcp-mux
a=crypto:0 AES_CM_128_HMAC_SHA1_80 inline:hMJUMLPuM1zYuIaUCEjr46aMsMwfc+MHjBM6PDES
a=rtpmap:0 PCMU/8000
a=ssrc:4099416672 cname:DO5g7daVh6dqHm/E
a=ssrc:4099416672 msid:fAy0FNrYIDVfeRwX5X0IK5TOCVTNJOXt4Cdb  fAy0FNrYIDVfeRwX5X0IK5TOCVTNJOXt4Cdb00
a=ssrc:4099416672 mslabel:fAy0FNrYIDVfeRwX5X0IK5TOCVTNJOXt4Cdb
a=ssrc:4099416672 label:fAy0FNrYIDVfeRwX5X0IK5TOCVTNJOXt4Cdb00

有人知道有什么问题吗(

您的sdp不完整。它应该有几个用于建立连接的ice候选对象。您应该以以下方式将ice候选对象添加到peerConnection对象中:

@Override
public void onIceCandidate(IceCandidate iceCandidate) {
    peerConnection.addIceCandidate(iceCandidate);
}
并在PeerConnection.IceGatheringState在OniceAgheringChange方法中完成后将您的sdp发送到另一个客户端。这不是唯一的方法,但它工作起来非常简单。完整sdp的示例如下:

offer=v=0
o=- 8080295062834070855 2 IN IP4 127.0.0.1
s=-
t=0 0
a=group:BUNDLE audio video
a=msid-semantic: WMS ARDAMS
m=audio 13491 RTP/SAVPF 111 103 9 102 0 8 106 105 13 127 126
c=IN IP4 54.77.231.253
a=rtcp:18373 IN IP4 54.77.231.253
a=candidate:1858001140 1 udp 2122260223 10.215.226.16 40647 typ host generation 0
a=candidate:1858001140 2 udp 2122260222 10.215.226.16 51975 typ host generation 0
a=candidate:540877828 1 tcp 1518280447 10.215.226.16 54789 typ host tcptype passive generation 0
a=candidate:540877828 2 tcp 1518280446 10.215.226.16 60723 typ host tcptype passive generation 0
a=candidate:4025933376 1 udp 1686052607 217.118.93.137 49688 typ srflx raddr 10.215.226.16 rport 40647 generation 0
a=candidate:4025933376 2 udp 1686052606 217.118.93.137 49689 typ srflx raddr 10.215.226.16 rport 51975 generation 0
a=candidate:4025933376 2 udp 1686052606 217.118.93.137 53707 typ srflx raddr 10.215.226.16 rport 51975 generation 0
a=candidate:4025933376 1 udp 1686052607 217.118.93.137 53709 typ srflx raddr 10.215.226.16 rport 40647 generation 0
a=candidate:1718996300 1 udp 41885439 54.77.231.253 13491 typ relay raddr 217.118.93.137 rport 53710 generation 0
a=candidate:1718996300 2 udp 41885438 54.77.231.253 18373 typ relay raddr 217.118.93.137 rport 53711 generation 0
a=ice-ufrag:vveSvzaR39lenaX1
a=ice-pwd:g7ouF2sZNGOh5Y7O42HaV+a2
a=fingerprint:sha-256 7D:E2:C3:49:0E:33:81:E8:1A:24:44:A2:FB:D9:E0:D9:BA:2A:40:B0:9E:BA:B1:BE:ED:EF:22:E0:F6:54:39:F3
a=setup:actpass
a=mid:audio
a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level
a=extmap:3 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
a=sendrecv
a=rtcp-mux
a=rtpmap:111 opus/48000/2
a=fmtp:111 minptime=10; useinbandfec=1
a=rtpmap:103 ISAC/16000
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:127 red/8000
a=rtpmap:126 telephone-event/8000
a=maxptime:60
a=ssrc:3583862867 cname:ily01dbTSMDARdSy
a=ssrc:3583862867 msid:ARDAMS ARDAMSa0
a=ssrc:3583862867 mslabel:ARDAMS
a=ssrc:3583862867 label:ARDAMSa0
m=video 16750 RTP/SAVPF 100 116 117 96
c=IN IP4 54.77.231.253
a=rtcp:10591 IN IP4 54.77.231.253
a=candidate:1858001140 1 udp 2122260223 10.215.226.16 36169 typ host generation 0
a=candidate:1858001140 2 udp 2122260222 10.215.226.16 55549 typ host generation 0
a=candidate:540877828 1 tcp 1518280447 10.215.226.16 33189 typ host tcptype passive generation 0
a=candidate:540877828 2 tcp 1518280446 10.215.226.16 40769 typ host tcptype passive generation 0
a=candidate:4025933376 1 udp 1686052607 217.118.93.137 49687 typ srflx raddr 10.215.226.16 rport 36169 generation 0
a=candidate:4025933376 2 udp 1686052606 217.118.93.137 49690 typ srflx raddr 10.215.226.16 rport 55549 generation 0
a=candidate:4025933376 1 udp 1686052607 217.118.93.137 53714 typ srflx raddr 10.215.226.16 rport 36169 generation 0
a=candidate:4025933376 2 udp 1686052606 217.118.93.137 53708 typ srflx raddr 10.215.226.16 rport 55549 generation 0
a=candidate:1718996300 1 udp 41885439 54.77.231.253 16750 typ relay raddr 217.118.93.137 rport 53713 generation 0
a=candidate:1718996300 2 udp 41885438 54.77.231.253 10591 typ relay raddr 217.118.93.137 rport 53712 generation 0
a=ice-ufrag:vveSvzaR39lenaX1
a=ice-pwd:g7ouF2sZNGOh5Y7O42HaV+a2
a=fingerprint:sha-256 7D:E2:C3:49:0E:33:81:E8:1A:24:44:A2:FB:D9:E0:D9:BA:2A:40:B0:9E:BA:B1:BE:ED:EF:22:E0:F6:54:39:F3
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:116 red/90000
a=rtpmap:117 ulpfec/90000
a=rtpmap:96 rtx/90000
a=fmtp:96 apt=100
a=ssrc-group:FID 382374264 1436972716
a=ssrc:382374264 cname:ily01dbTSMDARdSy
a=ssrc:382374264 msid:ARDAMS ARDAMSv0
a=ssrc:382374264 mslabel:ARDAMS
a=ssrc:382374264 label:ARDAMSv0
a=ssrc:1436972716 cname:ily01dbTSMDARdSy
a=ssrc:1436972716 msid:ARDAMS ARDAMSv0
a=ssrc:1436972716 mslabel:ARDAMS
a=ssrc:1436972716 label:ARDAMSv0

希望这有帮助!

在创建到的对等连接时尝试更改约束

MediaConstraints pcConstraints=新的MediaConstraints()

pcConstraints.optional.add(新的KeyValuePair(“DtlsSrtpKeyAgreement”,“true”); pcConstraints.optional.add(新的KeyValuePair(“RtpDataChannels”,“true”);
createPeerConnection(配置、pcConstraints、新PcObserver())

您的本地SDP是什么样子的?您能发布它吗?我假设createanswer会创建我的本地SDP。因此,也许我应该在创建应答之前自己设置本地SDP?不,设置远程SDP,然后创建您的应答SDP,然后设置刚刚在本地创建的SDP(应答)作为您的本地sdp。所有这些都必须在交换Ice候选人之前完成。好的,但是应答sdp是如何创建的?@PvPlatten,我可以知道您是如何将叮当声会话数据转换为sdp描述的吗?
@Override
public void onIceCandidate(IceCandidate iceCandidate) {
    peerConnection.addIceCandidate(iceCandidate);
}
offer=v=0
o=- 8080295062834070855 2 IN IP4 127.0.0.1
s=-
t=0 0
a=group:BUNDLE audio video
a=msid-semantic: WMS ARDAMS
m=audio 13491 RTP/SAVPF 111 103 9 102 0 8 106 105 13 127 126
c=IN IP4 54.77.231.253
a=rtcp:18373 IN IP4 54.77.231.253
a=candidate:1858001140 1 udp 2122260223 10.215.226.16 40647 typ host generation 0
a=candidate:1858001140 2 udp 2122260222 10.215.226.16 51975 typ host generation 0
a=candidate:540877828 1 tcp 1518280447 10.215.226.16 54789 typ host tcptype passive generation 0
a=candidate:540877828 2 tcp 1518280446 10.215.226.16 60723 typ host tcptype passive generation 0
a=candidate:4025933376 1 udp 1686052607 217.118.93.137 49688 typ srflx raddr 10.215.226.16 rport 40647 generation 0
a=candidate:4025933376 2 udp 1686052606 217.118.93.137 49689 typ srflx raddr 10.215.226.16 rport 51975 generation 0
a=candidate:4025933376 2 udp 1686052606 217.118.93.137 53707 typ srflx raddr 10.215.226.16 rport 51975 generation 0
a=candidate:4025933376 1 udp 1686052607 217.118.93.137 53709 typ srflx raddr 10.215.226.16 rport 40647 generation 0
a=candidate:1718996300 1 udp 41885439 54.77.231.253 13491 typ relay raddr 217.118.93.137 rport 53710 generation 0
a=candidate:1718996300 2 udp 41885438 54.77.231.253 18373 typ relay raddr 217.118.93.137 rport 53711 generation 0
a=ice-ufrag:vveSvzaR39lenaX1
a=ice-pwd:g7ouF2sZNGOh5Y7O42HaV+a2
a=fingerprint:sha-256 7D:E2:C3:49:0E:33:81:E8:1A:24:44:A2:FB:D9:E0:D9:BA:2A:40:B0:9E:BA:B1:BE:ED:EF:22:E0:F6:54:39:F3
a=setup:actpass
a=mid:audio
a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level
a=extmap:3 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
a=sendrecv
a=rtcp-mux
a=rtpmap:111 opus/48000/2
a=fmtp:111 minptime=10; useinbandfec=1
a=rtpmap:103 ISAC/16000
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:127 red/8000
a=rtpmap:126 telephone-event/8000
a=maxptime:60
a=ssrc:3583862867 cname:ily01dbTSMDARdSy
a=ssrc:3583862867 msid:ARDAMS ARDAMSa0
a=ssrc:3583862867 mslabel:ARDAMS
a=ssrc:3583862867 label:ARDAMSa0
m=video 16750 RTP/SAVPF 100 116 117 96
c=IN IP4 54.77.231.253
a=rtcp:10591 IN IP4 54.77.231.253
a=candidate:1858001140 1 udp 2122260223 10.215.226.16 36169 typ host generation 0
a=candidate:1858001140 2 udp 2122260222 10.215.226.16 55549 typ host generation 0
a=candidate:540877828 1 tcp 1518280447 10.215.226.16 33189 typ host tcptype passive generation 0
a=candidate:540877828 2 tcp 1518280446 10.215.226.16 40769 typ host tcptype passive generation 0
a=candidate:4025933376 1 udp 1686052607 217.118.93.137 49687 typ srflx raddr 10.215.226.16 rport 36169 generation 0
a=candidate:4025933376 2 udp 1686052606 217.118.93.137 49690 typ srflx raddr 10.215.226.16 rport 55549 generation 0
a=candidate:4025933376 1 udp 1686052607 217.118.93.137 53714 typ srflx raddr 10.215.226.16 rport 36169 generation 0
a=candidate:4025933376 2 udp 1686052606 217.118.93.137 53708 typ srflx raddr 10.215.226.16 rport 55549 generation 0
a=candidate:1718996300 1 udp 41885439 54.77.231.253 16750 typ relay raddr 217.118.93.137 rport 53713 generation 0
a=candidate:1718996300 2 udp 41885438 54.77.231.253 10591 typ relay raddr 217.118.93.137 rport 53712 generation 0
a=ice-ufrag:vveSvzaR39lenaX1
a=ice-pwd:g7ouF2sZNGOh5Y7O42HaV+a2
a=fingerprint:sha-256 7D:E2:C3:49:0E:33:81:E8:1A:24:44:A2:FB:D9:E0:D9:BA:2A:40:B0:9E:BA:B1:BE:ED:EF:22:E0:F6:54:39:F3
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:116 red/90000
a=rtpmap:117 ulpfec/90000
a=rtpmap:96 rtx/90000
a=fmtp:96 apt=100
a=ssrc-group:FID 382374264 1436972716
a=ssrc:382374264 cname:ily01dbTSMDARdSy
a=ssrc:382374264 msid:ARDAMS ARDAMSv0
a=ssrc:382374264 mslabel:ARDAMS
a=ssrc:382374264 label:ARDAMSv0
a=ssrc:1436972716 cname:ily01dbTSMDARdSy
a=ssrc:1436972716 msid:ARDAMS ARDAMSv0
a=ssrc:1436972716 mslabel:ARDAMS
a=ssrc:1436972716 label:ARDAMSv0