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 "RTCSessionDescription.h" | |
| 12 | |
| 13 #import "webrtc/api/objc/RTCSessionDescription+Private.h" | |
| 14 #import "webrtc/base/objc/NSString+StdString.h" | |
| 15 #import "webrtc/base/objc/RTCLogging.h" | |
|
tkchin_webrtc
2016/01/05 16:29:18
remove space
hjon
2016/01/05 22:16:20
Done.
| |
| 16 | |
| 17 @implementation RTCSessionDescription | |
| 18 | |
| 19 @synthesize type = _type; | |
| 20 @synthesize sdp = _sdp; | |
| 21 | |
| 22 - (instancetype)initWithType:(NSString *)type sdp:(NSString *)sdp { | |
| 23 NSParameterAssert(type); | |
| 24 NSParameterAssert(sdp); | |
| 25 if (self = [super init]) { | |
| 26 _type = [type copy]; | |
|
tkchin_webrtc
2016/01/05 16:29:19
indents
hjon
2016/01/05 22:16:20
Done.
| |
| 27 _sdp = [sdp copy]; | |
| 28 } | |
| 29 return self; | |
| 30 } | |
| 31 | |
| 32 - (NSString *)description { | |
| 33 return [NSString stringWithFormat:@"RTCSessionDescription:\n%@\n%@", | |
| 34 _type, | |
| 35 _sdp]; | |
| 36 } | |
| 37 | |
| 38 #pragma mark - Private | |
| 39 | |
| 40 - (webrtc::SessionDescriptionInterface *)nativeDescription { | |
| 41 webrtc::SessionDescriptionInterface *description; | |
| 42 webrtc::SdpParseError error; | |
| 43 | |
| 44 description = webrtc::CreateSessionDescription(_type.stdString, | |
|
tkchin_webrtc
2016/01/05 16:29:18
combine 41 and 44?
hjon
2016/01/05 22:16:20
Done.
| |
| 45 _sdp.stdString, | |
| 46 &error); | |
| 47 | |
| 48 if (!description) { | |
| 49 RTCLog(@"Failed to create session description: %s\nline: %s", | |
| 50 error.description.c_str(), | |
| 51 error.line.c_str()); | |
| 52 } | |
| 53 | |
| 54 return description; | |
| 55 } | |
| 56 | |
| 57 - (instancetype)initWithDescription:(webrtc::SessionDescriptionInterface *) | |
|
tkchin_webrtc
2016/01/05 16:29:19
break after : instead of after *)
hjon
2016/01/05 22:16:20
Done.
| |
| 58 description { | |
| 59 NSParameterAssert(description); | |
| 60 std::string sdp; | |
| 61 description->ToString(&sdp); | |
| 62 | |
| 63 return [self initWithType:[NSString stringForStdString:description->type()] | |
|
tkchin_webrtc
2016/01/05 16:29:19
seems like initWithType:sdp: can be a designated i
hjon
2016/01/05 22:16:20
Done.
| |
| 64 sdp:[NSString stringForStdString:sdp]]; | |
| 65 } | |
| 66 | |
| 67 @end | |
| OLD | NEW |