OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #import "RTCIceCandidate+Private.h" | 11 #import "RTCIceCandidate+Private.h" |
12 | 12 |
| 13 #include <memory> |
| 14 |
13 #import "NSString+StdString.h" | 15 #import "NSString+StdString.h" |
14 #import "WebRTC/RTCLogging.h" | 16 #import "WebRTC/RTCLogging.h" |
15 | 17 |
16 @implementation RTCIceCandidate | 18 @implementation RTCIceCandidate |
17 | 19 |
18 @synthesize sdpMid = _sdpMid; | 20 @synthesize sdpMid = _sdpMid; |
19 @synthesize sdpMLineIndex = _sdpMLineIndex; | 21 @synthesize sdpMLineIndex = _sdpMLineIndex; |
20 @synthesize sdp = _sdp; | 22 @synthesize sdp = _sdp; |
21 | 23 |
22 - (instancetype)initWithSdp:(NSString *)sdp | 24 - (instancetype)initWithSdp:(NSString *)sdp |
(...skipping 21 matching lines...) Expand all Loading... |
44 (const webrtc::IceCandidateInterface *)candidate { | 46 (const webrtc::IceCandidateInterface *)candidate { |
45 NSParameterAssert(candidate); | 47 NSParameterAssert(candidate); |
46 std::string sdp; | 48 std::string sdp; |
47 candidate->ToString(&sdp); | 49 candidate->ToString(&sdp); |
48 | 50 |
49 return [self initWithSdp:[NSString stringForStdString:sdp] | 51 return [self initWithSdp:[NSString stringForStdString:sdp] |
50 sdpMLineIndex:candidate->sdp_mline_index() | 52 sdpMLineIndex:candidate->sdp_mline_index() |
51 sdpMid:[NSString stringForStdString:candidate->sdp_mid()]]; | 53 sdpMid:[NSString stringForStdString:candidate->sdp_mid()]]; |
52 } | 54 } |
53 | 55 |
54 - (rtc::scoped_ptr<webrtc::IceCandidateInterface>)nativeCandidate { | 56 - (std::unique_ptr<webrtc::IceCandidateInterface>)nativeCandidate { |
55 webrtc::SdpParseError error; | 57 webrtc::SdpParseError error; |
56 | 58 |
57 webrtc::IceCandidateInterface *candidate = webrtc::CreateIceCandidate( | 59 webrtc::IceCandidateInterface *candidate = webrtc::CreateIceCandidate( |
58 _sdpMid.stdString, _sdpMLineIndex, _sdp.stdString, &error); | 60 _sdpMid.stdString, _sdpMLineIndex, _sdp.stdString, &error); |
59 | 61 |
60 if (!candidate) { | 62 if (!candidate) { |
61 RTCLog(@"Failed to create ICE candidate: %s\nline: %s", | 63 RTCLog(@"Failed to create ICE candidate: %s\nline: %s", |
62 error.description.c_str(), | 64 error.description.c_str(), |
63 error.line.c_str()); | 65 error.line.c_str()); |
64 } | 66 } |
65 | 67 |
66 return rtc::scoped_ptr<webrtc::IceCandidateInterface>(candidate); | 68 return std::unique_ptr<webrtc::IceCandidateInterface>(candidate); |
67 } | 69 } |
68 | 70 |
69 @end | 71 @end |
OLD | NEW |