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

Side by Side Diff: webrtc/api/objc/RTCIceCandidate.mm

Issue 1517253005: Update API for Objective-C RTCIceCandidate. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@updateRTCIceServer
Patch Set: Created 5 years 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
(Empty)
1 /*
2 * Copyright 2015 The WebRTC project authors. All Rights Reserved.
3 *
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11 #import "RTCIceCandidate.h"
12
13 #import "webrtc/api/objc/RTCIceCandidate+Private.h"
14 #import "webrtc/base/objc/NSString+StdString.h"
15
16 @implementation RTCIceCandidate
17
18 @synthesize sdpMid = _sdpMid;
19 @synthesize sdpMLineIndex = _sdpMLineIndex;
20 @synthesize sdp = _sdp;
21
22 - (instancetype)initWithSdpMid:(NSString *)sdpMid
23 sdpMLineIndex:(NSInteger)sdpMLineIndex
24 sdp:(NSString *)sdp {
25 NSParameterAssert(sdp.length);
26 if (self = [super init]) {
27 _sdpMid = [sdpMid copy];
28 _sdpMLineIndex = sdpMLineIndex;
29 _sdp = [sdp copy];
30 }
31 return self;
32 }
33
34 - (NSString *)description {
35 return [NSString stringWithFormat:@"RTCIceCandidate:\n%@\n%ld\n%@",
36 _sdpMid,
37 (long)_sdpMLineIndex,
38 _sdp];
39 }
40
41 #pragma mark - Private
42
43 - (instancetype)initWithCandidate:(webrtc::IceCandidateInterface *)candidate {
44 std::string sdp;
tkchin_webrtc 2015/12/15 01:55:44 assert on candidate
hjon 2015/12/15 17:35:44 Done.
45 candidate->ToString(&sdp);
46
47 return [self initWithSdpMid:[NSString stringForStdString:candidate->sdp_mid()]
48 sdpMLineIndex:candidate->sdp_mline_index()
49 sdp:[NSString stringForStdString:sdp]];
50 }
51
52 - (rtc::scoped_ptr<webrtc::IceCandidateInterface>)candidate {
53 webrtc::IceCandidateInterface *candidate;
54 webrtc::SdpParseError error;
55
56 candidate = webrtc::CreateIceCandidate(
57 _sdpMid.stdString, _sdpMLineIndex, _sdp.stdString, &error);
58
59 if (candidate == NULL) {
tkchin_webrtc 2015/12/15 01:55:44 if (!candidate) {
hjon 2015/12/15 17:35:44 Done.
60 NSLog(@"Failed to create ICE candidate: %s\nline: %s",
tkchin_webrtc 2015/12/15 01:55:44 RTCLog #import "webrtc/base/RTCLogging.h"
hjon 2015/12/15 17:35:44 Done.
61 error.description.c_str(),
62 error.line.c_str());
63 }
64
65 rtc::scoped_ptr<webrtc::IceCandidateInterface> iceCandidate(candidate);
tkchin_webrtc 2015/12/15 01:55:44 I don't think you need this line, it *should* invo
hjon 2015/12/15 17:35:44 I might have misunderstood this, but simply puttin
66 return iceCandidate;
67 }
68
69 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698