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

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 the format. 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 serverUrl:(NSString *)serverUrl {
27 NSParameterAssert(sdp.length); 29 NSParameterAssert(sdp.length);
28 if (self = [super init]) { 30 if (self = [super init]) {
29 _sdpMid = [sdpMid copy]; 31 _sdpMid = [sdpMid copy];
30 _sdpMLineIndex = sdpMLineIndex; 32 _sdpMLineIndex = sdpMLineIndex;
31 _sdp = [sdp copy]; 33 _sdp = [sdp copy];
34 _serverUrl = [serverUrl copy];
32 } 35 }
33 return self; 36 return self;
34 } 37 }
35 38
36 - (NSString *)description { 39 - (NSString *)description {
37 return [NSString stringWithFormat:@"RTCIceCandidate:\n%@\n%d\n%@", 40 return [NSString stringWithFormat:@"RTCIceCandidate:\n%@\n%d\n%@\n%@",
38 _sdpMid, 41 _sdpMid,
39 _sdpMLineIndex, 42 _sdpMLineIndex,
40 _sdp]; 43 _sdp,
44 _serverUrl];
41 } 45 }
42 46
43 #pragma mark - Private 47 #pragma mark - Private
44 48
45 - (instancetype)initWithNativeCandidate: 49 - (instancetype)initWithNativeCandidate:
46 (const webrtc::IceCandidateInterface *)candidate { 50 (const webrtc::IceCandidateInterface *)candidate {
47 NSParameterAssert(candidate); 51 NSParameterAssert(candidate);
48 std::string sdp; 52 std::string sdp;
49 candidate->ToString(&sdp); 53 candidate->ToString(&sdp);
50 54
51 return [self initWithSdp:[NSString stringForStdString:sdp] 55 return [self initWithSdp:[NSString stringForStdString:sdp]
52 sdpMLineIndex:candidate->sdp_mline_index() 56 sdpMLineIndex:candidate->sdp_mline_index()
53 sdpMid:[NSString stringForStdString:candidate->sdp_mid()]]; 57 sdpMid:[NSString stringForStdString:candidate->sdp_mid()]
58 serverUrl:[NSString stringForStdString:candidate->server_url()] ];
54 } 59 }
55 60
56 - (std::unique_ptr<webrtc::IceCandidateInterface>)nativeCandidate { 61 - (std::unique_ptr<webrtc::IceCandidateInterface>)nativeCandidate {
57 webrtc::SdpParseError error; 62 webrtc::SdpParseError error;
58 63
59 webrtc::IceCandidateInterface *candidate = webrtc::CreateIceCandidate( 64 webrtc::IceCandidateInterface *candidate = webrtc::CreateIceCandidate(
60 _sdpMid.stdString, _sdpMLineIndex, _sdp.stdString, &error); 65 _sdpMid.stdString, _sdpMLineIndex, _sdp.stdString, &error);
61 66
62 if (!candidate) { 67 if (!candidate) {
63 RTCLog(@"Failed to create ICE candidate: %s\nline: %s", 68 RTCLog(@"Failed to create ICE candidate: %s\nline: %s",
64 error.description.c_str(), 69 error.description.c_str(),
65 error.line.c_str()); 70 error.line.c_str());
66 } 71 }
67 72
68 return std::unique_ptr<webrtc::IceCandidateInterface>(candidate); 73 return std::unique_ptr<webrtc::IceCandidateInterface>(candidate);
69 } 74 }
70 75
71 @end 76 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698