Expose addIceCandidate with completion handler.
Bug: None Change-Id: I91c15b36e6a63f7a7ee13203de5750d9492c19c6 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/211001 Reviewed-by: Kári Helgason <kthelgason@webrtc.org> Commit-Queue: Yura Yaroshevich <yura.yaroshevich@gmail.com> Cr-Commit-Position: refs/heads/master@{#33440}
This commit is contained in:

committed by
Commit Bot

parent
31c5c9da35
commit
2d9f53ca58
@ -634,7 +634,14 @@ static int const kKbpsMultiplier = 1000;
|
||||
case kARDSignalingMessageTypeCandidate: {
|
||||
ARDICECandidateMessage *candidateMessage =
|
||||
(ARDICECandidateMessage *)message;
|
||||
[_peerConnection addIceCandidate:candidateMessage.candidate];
|
||||
__weak ARDAppClient *weakSelf = self;
|
||||
[_peerConnection addIceCandidate:candidateMessage.candidate
|
||||
completionHandler:^(NSError *error) {
|
||||
ARDAppClient *strongSelf = weakSelf;
|
||||
if (error) {
|
||||
[strongSelf.delegate appClient:strongSelf didError:error];
|
||||
}
|
||||
}];
|
||||
break;
|
||||
}
|
||||
case kARDSignalingMessageTypeCandidateRemoval: {
|
||||
|
@ -219,7 +219,12 @@ RTC_OBJC_EXPORT
|
||||
- (void)close;
|
||||
|
||||
/** Provide a remote candidate to the ICE Agent. */
|
||||
- (void)addIceCandidate:(RTC_OBJC_TYPE(RTCIceCandidate) *)candidate;
|
||||
- (void)addIceCandidate:(RTC_OBJC_TYPE(RTCIceCandidate) *)candidate
|
||||
DEPRECATED_MSG_ATTRIBUTE("Please use addIceCandidate:completionHandler: instead");
|
||||
|
||||
/** Provide a remote candidate to the ICE Agent. */
|
||||
- (void)addIceCandidate:(RTC_OBJC_TYPE(RTCIceCandidate) *)candidate
|
||||
completionHandler:(void (^)(NSError *_Nullable error))completionHandler;
|
||||
|
||||
/** Remove a group of remote candidates from the ICE Agent. */
|
||||
- (void)removeIceCandidates:(NSArray<RTC_OBJC_TYPE(RTCIceCandidate) *> *)candidates;
|
||||
|
@ -433,7 +433,24 @@ void PeerConnectionDelegateAdapter::OnRemoveTrack(
|
||||
candidate.nativeCandidate);
|
||||
_peerConnection->AddIceCandidate(iceCandidate.get());
|
||||
}
|
||||
|
||||
- (void)addIceCandidate:(RTC_OBJC_TYPE(RTCIceCandidate) *)candidate
|
||||
completionHandler:(void (^)(NSError *_Nullable error))completionHandler {
|
||||
RTC_DCHECK(completionHandler != nil);
|
||||
auto iceCandidate = webrtc::CreateIceCandidate(candidate.nativeCandidate->sdp_mid(),
|
||||
candidate.nativeCandidate->sdp_mline_index(),
|
||||
candidate.nativeCandidate->candidate());
|
||||
_peerConnection->AddIceCandidate(std::move(iceCandidate), [completionHandler](const auto &error) {
|
||||
if (error.ok()) {
|
||||
completionHandler(nil);
|
||||
} else {
|
||||
NSString *str = [NSString stringForStdString:error.message()];
|
||||
NSError *err = [NSError errorWithDomain:kRTCPeerConnectionErrorDomain
|
||||
code:static_cast<NSInteger>(error.type())
|
||||
userInfo:@{NSLocalizedDescriptionKey : str}];
|
||||
completionHandler(err);
|
||||
}
|
||||
});
|
||||
}
|
||||
- (void)removeIceCandidates:(NSArray<RTC_OBJC_TYPE(RTCIceCandidate) *> *)iceCandidates {
|
||||
std::vector<cricket::Candidate> candidates;
|
||||
for (RTC_OBJC_TYPE(RTCIceCandidate) * iceCandidate in iceCandidates) {
|
||||
|
Reference in New Issue
Block a user