mirror of https://github.com/oxen-io/session-ios
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
858 B
Swift
29 lines
858 B
Swift
import WebRTC
|
|
|
|
extension CallManager {
|
|
|
|
public func handleCandidateMessage(_ candidate: RTCIceCandidate) {
|
|
candidateQueue.append(candidate)
|
|
}
|
|
|
|
public func handleRemoteDescription(_ sdp: RTCSessionDescription) {
|
|
peerConnection.setRemoteDescription(sdp, completionHandler: { [weak self] error in
|
|
if let error = error {
|
|
SNLog("Couldn't set SDP due to error: \(error).")
|
|
} else {
|
|
guard let self = self else { return }
|
|
if sdp.type == .offer, self.peerConnection.localDescription == nil {
|
|
self.acceptCall()
|
|
}
|
|
}
|
|
})
|
|
}
|
|
|
|
public func drainMessageQueue() {
|
|
for candidate in candidateQueue {
|
|
peerConnection.add(candidate)
|
|
}
|
|
candidateQueue.removeAll()
|
|
}
|
|
}
|