Index: webrtc/api/objc/RTCSessionDescription.mm |
diff --git a/webrtc/api/objc/RTCSessionDescription.mm b/webrtc/api/objc/RTCSessionDescription.mm |
new file mode 100644 |
index 0000000000000000000000000000000000000000..c4737c222e5190656e363dd0dfba29ec4c63c39f |
--- /dev/null |
+++ b/webrtc/api/objc/RTCSessionDescription.mm |
@@ -0,0 +1,67 @@ |
+/* |
+ * Copyright 2015 The WebRTC project authors. All Rights Reserved. |
+ * |
+ * Use of this source code is governed by a BSD-style license |
+ * that can be found in the LICENSE file in the root of the source |
+ * tree. An additional intellectual property rights grant can be found |
+ * in the file PATENTS. All contributing project authors may |
+ * be found in the AUTHORS file in the root of the source tree. |
+ */ |
+ |
+#import "RTCSessionDescription.h" |
+ |
+#import "webrtc/api/objc/RTCSessionDescription+Private.h" |
+#import "webrtc/base/objc/NSString+StdString.h" |
+ #import "webrtc/base/objc/RTCLogging.h" |
tkchin_webrtc
2016/01/05 16:29:18
remove space
hjon
2016/01/05 22:16:20
Done.
|
+ |
+@implementation RTCSessionDescription |
+ |
+@synthesize type = _type; |
+@synthesize sdp = _sdp; |
+ |
+- (instancetype)initWithType:(NSString *)type sdp:(NSString *)sdp { |
+ NSParameterAssert(type); |
+ NSParameterAssert(sdp); |
+ if (self = [super init]) { |
+ _type = [type copy]; |
tkchin_webrtc
2016/01/05 16:29:19
indents
hjon
2016/01/05 22:16:20
Done.
|
+ _sdp = [sdp copy]; |
+ } |
+ return self; |
+} |
+ |
+- (NSString *)description { |
+ return [NSString stringWithFormat:@"RTCSessionDescription:\n%@\n%@", |
+ _type, |
+ _sdp]; |
+} |
+ |
+#pragma mark - Private |
+ |
+- (webrtc::SessionDescriptionInterface *)nativeDescription { |
+ webrtc::SessionDescriptionInterface *description; |
+ webrtc::SdpParseError error; |
+ |
+ 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.
|
+ _sdp.stdString, |
+ &error); |
+ |
+ if (!description) { |
+ RTCLog(@"Failed to create session description: %s\nline: %s", |
+ error.description.c_str(), |
+ error.line.c_str()); |
+ } |
+ |
+ return description; |
+} |
+ |
+- (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.
|
+ description { |
+ NSParameterAssert(description); |
+ std::string sdp; |
+ description->ToString(&sdp); |
+ |
+ 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.
|
+ sdp:[NSString stringForStdString:sdp]]; |
+} |
+ |
+@end |