2014-02-20 104 views
1

我正嘗試使用編譯的WebRTC iOS庫從http://webrtc.googlecode.com/svn/trunk/創建iOS應用程序,目前我的後端服務器僅支持DTLS。對WebRTC iOS庫的DTLS支持

現在,當我試圖把它返回以下錯誤

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. 

遠程描述,但我設置DtlsSrtpKeyAgreement = TRUE作爲可選的約束而產生的對等連接如下

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]; 

我只是想知道WebRTC本機iOS庫是否僅支持SDES而不支持DTLS?

我正因爲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; 
} 

的代碼下面的部分的這種懷疑有人可以告訴我嗎?

+0

嗨,你可以分享一些代碼或本地iOS應用程序中的webrtc使用示例/教程?我四處尋找,無法得到它。我構建了所有的庫並將其集成到我的自定義項目中,但我不知道應該採取哪些步驟才能使其工作。我在代碼示例\解釋中發現的唯一一件事是https://tech.appear.in/2015/05/25/Getting-started-with-WebRTC-on-iOS/,但它對我來說很糟糕,並且不清楚。謝謝。 – Aft3rmath

回答

3

當我在創建PeerConnection對象時通過了dtlsSrtpKeyAgreement約束,而在創建報價期間,即在上述createOfferWithDelegate調用期間,這工作。