Introduce CreateDataChannelOrError

Deprecate CreateDataChannel, and make it a simple wrapper function.

Bug: webrtc:12796
Change-Id: I053d75a264596ba87ca734a29df9241de93a80c3
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/219784
Reviewed-by: Xavier Lepaul‎ <xalep@webrtc.org>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34130}
This commit is contained in:
Harald Alvestrand
2021-05-21 13:33:51 +00:00
committed by WebRTC LUCI CQ
parent 0d0ed76ac1
commit a9af50f151
12 changed files with 60 additions and 27 deletions

View File

@ -23,14 +23,12 @@
std::string labelString = [NSString stdStringForString:label];
const webrtc::DataChannelInit nativeInit =
configuration.nativeDataChannelInit;
rtc::scoped_refptr<webrtc::DataChannelInterface> dataChannel =
self.nativePeerConnection->CreateDataChannel(labelString,
&nativeInit);
if (!dataChannel) {
auto result = self.nativePeerConnection->CreateDataChannelOrError(labelString, &nativeInit);
if (!result.ok()) {
return nil;
}
return [[RTC_OBJC_TYPE(RTCDataChannel) alloc] initWithFactory:self.factory
nativeDataChannel:dataChannel];
nativeDataChannel:result.MoveValue()];
}
@end