Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(119)

Side by Side Diff: webrtc/sdk/objc/Framework/Classes/RTCIceCandidate.mm

Issue 2688943003: Add the URL attribute to cricket::Candiate. (Objc wrapper) (Closed)
Patch Set: Fix format and typo. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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> 13 #include <memory>
14 14
15 #import "NSString+StdString.h" 15 #import "NSString+StdString.h"
16 #import "WebRTC/RTCLogging.h" 16 #import "WebRTC/RTCLogging.h"
17 17
18 @implementation RTCIceCandidate 18 @implementation RTCIceCandidate
19 19
20 @synthesize sdpMid = _sdpMid; 20 @synthesize sdpMid = _sdpMid;
21 @synthesize sdpMLineIndex = _sdpMLineIndex; 21 @synthesize sdpMLineIndex = _sdpMLineIndex;
22 @synthesize sdp = _sdp; 22 @synthesize sdp = _sdp;
23 @synthesize serverUrl = _serverUrl;
23 24
24 - (instancetype)initWithSdp:(NSString *)sdp 25 - (instancetype)initWithSdp:(NSString *)sdp
25 sdpMLineIndex:(int)sdpMLineIndex 26 sdpMLineIndex:(int)sdpMLineIndex
26 sdpMid:(NSString *)sdpMid { 27 sdpMid:(NSString *)sdpMid {
28 return [self initWithSdpAndServerUrl:sdp
29 sdpMLineIndex:sdpMLineIndex
30 sdpMid:sdpMid
31 serverUrl:@""];
32 }
33
34 - (instancetype)initWithSdpAndServerUrl:(NSString *)sdp
tkchin_webrtc 2017/02/14 21:58:55 remove this ctor since it's only ever used private
Zhi Huang 2017/02/15 00:22:48 Done.
35 sdpMLineIndex:(int)sdpMLineIndex
36 sdpMid:(NSString *)sdpMid
37 serverUrl:(NSString *)serverUrl {
27 NSParameterAssert(sdp.length); 38 NSParameterAssert(sdp.length);
28 if (self = [super init]) { 39 if (self = [super init]) {
29 _sdpMid = [sdpMid copy]; 40 _sdpMid = [sdpMid copy];
30 _sdpMLineIndex = sdpMLineIndex; 41 _sdpMLineIndex = sdpMLineIndex;
31 _sdp = [sdp copy]; 42 _sdp = [sdp copy];
43 _serverUrl = [serverUrl copy];
tkchin_webrtc 2017/02/14 21:58:55 remove
Zhi Huang 2017/02/15 00:22:49 Done.
32 } 44 }
33 return self; 45 return self;
34 } 46 }
35 47
36 - (NSString *)description { 48 - (NSString *)description {
37 return [NSString stringWithFormat:@"RTCIceCandidate:\n%@\n%d\n%@", 49 return [NSString stringWithFormat:@"RTCIceCandidate:\n%@\n%d\n%@\n%@",
38 _sdpMid, 50 _sdpMid,
39 _sdpMLineIndex, 51 _sdpMLineIndex,
40 _sdp]; 52 _sdp,
53 _serverUrl];
41 } 54 }
42 55
43 #pragma mark - Private 56 #pragma mark - Private
44 57
45 - (instancetype)initWithNativeCandidate: 58 - (instancetype)initWithNativeCandidate:
46 (const webrtc::IceCandidateInterface *)candidate { 59 (const webrtc::IceCandidateInterface *)candidate {
47 NSParameterAssert(candidate); 60 NSParameterAssert(candidate);
48 std::string sdp; 61 std::string sdp;
49 candidate->ToString(&sdp); 62 candidate->ToString(&sdp);
50 63
51 return [self initWithSdp:[NSString stringForStdString:sdp] 64 return [self initWithSdpAndServerUrl:[NSString stringForStdString:sdp]
tkchin_webrtc 2017/02/14 21:58:55 RTCIceCandidate *candidate = [self initWithSdp:sdp
Zhi Huang 2017/02/15 00:22:49 Done.
52 sdpMLineIndex:candidate->sdp_mline_index() 65 sdpMLineIndex:candidate->sdp_mline_index()
53 sdpMid:[NSString stringForStdString:candidate->sdp_mid()]]; 66 sdpMid:[NSString stringForStdString:candidate->s dp_mid()]
67 serverUrl:[NSString stringForStdString:candidate->s erver_url()]];
54 } 68 }
55 69
56 - (std::unique_ptr<webrtc::IceCandidateInterface>)nativeCandidate { 70 - (std::unique_ptr<webrtc::IceCandidateInterface>)nativeCandidate {
57 webrtc::SdpParseError error; 71 webrtc::SdpParseError error;
58 72
59 webrtc::IceCandidateInterface *candidate = webrtc::CreateIceCandidate( 73 webrtc::IceCandidateInterface *candidate = webrtc::CreateIceCandidate(
60 _sdpMid.stdString, _sdpMLineIndex, _sdp.stdString, &error); 74 _sdpMid.stdString, _sdpMLineIndex, _sdp.stdString, &error);
61 75
62 if (!candidate) { 76 if (!candidate) {
63 RTCLog(@"Failed to create ICE candidate: %s\nline: %s", 77 RTCLog(@"Failed to create ICE candidate: %s\nline: %s",
64 error.description.c_str(), 78 error.description.c_str(),
65 error.line.c_str()); 79 error.line.c_str());
66 } 80 }
67 81
68 return std::unique_ptr<webrtc::IceCandidateInterface>(candidate); 82 return std::unique_ptr<webrtc::IceCandidateInterface>(candidate);
69 } 83 }
70 84
71 @end 85 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698