Chromium Code Reviews| OLD | NEW |
|---|---|
| (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 "RTCIceServer.h" | |
| 12 | |
| 13 #include <vector> | |
|
tkchin_webrtc
2015/12/04 20:17:09
do you still need this include?
hjon
2015/12/07 20:03:53
Done.
| |
| 14 | |
| 15 #import "webrtc/api/objc/RTCIceServer+Private.h" | |
| 16 #import "webrtc/base/objc/NSString+StdString.h" | |
| 17 | |
| 18 @implementation RTCIceServer | |
| 19 | |
| 20 @synthesize urls = _urls; | |
| 21 @synthesize username = _username; | |
| 22 @synthesize credential = _credential; | |
| 23 | |
| 24 - (instancetype)initWithURLStrings:(NSArray<NSString *> *)urls { | |
| 25 return [self initWithURLStrings:urls | |
| 26 username:nil | |
| 27 credential:nil]; | |
| 28 } | |
| 29 | |
| 30 - (instancetype)initWithURLStrings:(NSArray<NSString *> *)urls | |
| 31 username:(NSString *)username | |
| 32 credential:(NSString *)credential { | |
| 33 NSParameterAssert(urls.count); | |
| 34 if (self = [super init]) { | |
| 35 _urls = [[NSArray alloc] initWithArray:urls copyItems:YES]; | |
| 36 _username = [username copy]; | |
| 37 _credential = [credential copy]; | |
| 38 } | |
| 39 return self; | |
| 40 } | |
| 41 | |
| 42 - (NSString *)description { | |
| 43 return [NSString stringWithFormat:@"RTCIceServer:\n%@\n%@\n%@", | |
| 44 _urls, | |
| 45 _username, | |
| 46 _credential]; | |
| 47 } | |
| 48 | |
| 49 #pragma mark - Private | |
| 50 | |
| 51 - (webrtc::PeerConnectionInterface::IceServer)iceServer { | |
| 52 __block webrtc::PeerConnectionInterface::IceServer iceServer; | |
| 53 | |
| 54 iceServer.username = [NSString stdStringForString:_username]; | |
| 55 iceServer.password = [NSString stdStringForString:_credential]; | |
| 56 | |
| 57 [_urls enumerateObjectsUsingBlock:^(NSString *url, | |
| 58 NSUInteger idx, | |
| 59 BOOL *stop) { | |
| 60 iceServer.urls.push_back(url.stdString); | |
| 61 }]; | |
| 62 return iceServer; | |
| 63 } | |
| 64 | |
| 65 @end | |
| OLD | NEW |