Rajaraman Subramanian
Rajaraman Subramanian

Reputation: 801

DTLS Support for WebRTC iOS Libraries

I am trying to create an iOS application using the compiled WebRTC iOS libraries from http://webrtc.googlecode.com/svn/trunk/ and currently my backend server supports only DTLS.

Now when I try to set the remote description it returns the following error

Warning(webrtcsession.cc:146): Session description must have SDES when DTLS disabled.
Error(webrtcsession.cc:268): SetRemoteDescription failed: Called with an SDP without SDES crypto and DTLS disabled locally.

but I set DtlsSrtpKeyAgreement = true as optional constraint while creating the peer connection as follows

RTCPair *audio = [[RTCPair alloc] initWithKey:@"OfferToReceiveAudio" value:@"true"];
RTCPair *video = [[RTCPair alloc] initWithKey:@"OfferToReceiveVideo" value:@"false"];
NSArray *mandatoryConstraints = @[ audio, video ];

RTCPair *dtlsSrtpKeyAgreement = [[RTCPair alloc] initWithKey:@"DtlsSrtpKeyAgreement" value:@"true"];
NSArray *optionalConstraints = @[ dtlsSrtpKeyAgreement ];

RTCMediaConstraints *mediaConstraints = [[RTCMediaConstraints alloc]
                                            initWithMandatoryConstraints:mandatoryConstraints
                                            optionalConstraints:optionalConstraints];

[self.peerConnection createOfferWithDelegate:self constraints:mediaConstraints];

I just want to know whether WebRTC native iOS libraries supports only SDES and not DTLS at the moment?

I am getting this doubt because of following section of code in http://webrtc.googlecode.com/svn/trunk/talk/app/webrtc/objc/RTCPeerConnectionFactory.mm

(RTCPeerConnection *)
    peerConnectionWithICEServers:(NSArray *)servers
                     constraints:(RTCMediaConstraints *)constraints
                        delegate:(id<RTCPeerConnectionDelegate>)delegate {
  webrtc::PeerConnectionInterface::IceServers iceServers;
  for (RTCICEServer *server in servers) {
    iceServers.push_back(server.iceServer);
  }
  webrtc::RTCPeerConnectionObserver *observer =
      new webrtc::RTCPeerConnectionObserver(delegate);
  webrtc::DTLSIdentityServiceInterface* dummy_dtls_identity_service = NULL;
  talk_base::scoped_refptr<webrtc::PeerConnectionInterface> peerConnection =
      self.nativeFactory->CreatePeerConnection(
          iceServers, constraints.constraints, dummy_dtls_identity_service,
          observer);
  RTCPeerConnection *pc =
      [[RTCPeerConnection alloc] initWithPeerConnection:peerConnection
                                               observer:observer];
  observer->SetPeerConnection(pc);
  return pc;
}

Can somebody enlighten me?

Upvotes: 1

Views: 2928

Answers (1)

Rajaraman Subramanian
Rajaraman Subramanian

Reputation: 801

This worked after I passed the dtlsSrtpKeyAgreement constraints when the PeerConnection object is created rather during creating the offer i.e during createOfferWithDelegate call as above.

Upvotes: 3

Related Questions