尝试使用基于APpRtcDemo的Android应用程序。当从Chrome 34连接一切都很好,但是当我使用Chrome 35视频通话时,我得到了这个错误。
onSetFailure: Failed to set remote offer sdp: Called with SDP without SDES crypto.
这里是媒体约束,我想用
sdpMediaConstraints = new MediaConstraints();
sdpMediaConstraints.mandatory.add(new MediaConstraints.KeyValuePair("OfferToReceiveAudio", "true"));
sdpMediaConstraints.mandatory.add(new MediaConstraints.KeyValuePair("OfferToReceiveVideo", "true"));
sdpMediaConstraints.optional.add(new MediaConstraints.KeyValuePair("DtlsSrtpKeyAgreement", "true"));
这里是代码设置远程描述
pc.setRemoteDescription(sdpObserver, new SessionDescription(
SessionDescription.Type.OFFER, description.toString()));
通过为Peerconnection对象的创建添加约束来修复此问题。
DtlsSrtpKeyAgreement:true
pc = factory.createPeerConnection(iceServers, constraints, pcObserver);
where constraints has DtlsSrtpKeyAgreement:true key value.