OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2014 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 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 @implementation ARDSessionDescriptionMessage | 87 @implementation ARDSessionDescriptionMessage |
88 | 88 |
89 @synthesize sessionDescription = _sessionDescription; | 89 @synthesize sessionDescription = _sessionDescription; |
90 | 90 |
91 - (instancetype)initWithDescription:(RTCSessionDescription *)description { | 91 - (instancetype)initWithDescription:(RTCSessionDescription *)description { |
92 ARDSignalingMessageType messageType = kARDSignalingMessageTypeOffer; | 92 ARDSignalingMessageType messageType = kARDSignalingMessageTypeOffer; |
93 RTCSdpType sdpType = description.type; | 93 RTCSdpType sdpType = description.type; |
94 switch (sdpType) { | 94 switch (sdpType) { |
95 case RTCSdpTypeOffer: | 95 case RTCSdpTypeOffer: |
96 messageType = kARDSignalingMessageTypeOffer; | 96 messageType = kARDSignalingMessageTypeOffer; |
| 97 break; |
97 case RTCSdpTypeAnswer: | 98 case RTCSdpTypeAnswer: |
98 messageType = kARDSignalingMessageTypeAnswer; | 99 messageType = kARDSignalingMessageTypeAnswer; |
| 100 break; |
99 case RTCSdpTypePrAnswer: | 101 case RTCSdpTypePrAnswer: |
100 NSAssert(NO, @"Unexpected type: %@", | 102 NSAssert(NO, @"Unexpected type: %@", |
101 [RTCSessionDescription stringForType:sdpType]); | 103 [RTCSessionDescription stringForType:sdpType]); |
| 104 break; |
102 } | 105 } |
103 if (self = [super initWithType:messageType]) { | 106 if (self = [super initWithType:messageType]) { |
104 _sessionDescription = description; | 107 _sessionDescription = description; |
105 } | 108 } |
106 return self; | 109 return self; |
107 } | 110 } |
108 | 111 |
109 - (NSData *)JSONData { | 112 - (NSData *)JSONData { |
110 return [_sessionDescription JSONData]; | 113 return [_sessionDescription JSONData]; |
111 } | 114 } |
112 | 115 |
113 @end | 116 @end |
114 | 117 |
115 @implementation ARDByeMessage | 118 @implementation ARDByeMessage |
116 | 119 |
117 - (instancetype)init { | 120 - (instancetype)init { |
118 return [super initWithType:kARDSignalingMessageTypeBye]; | 121 return [super initWithType:kARDSignalingMessageTypeBye]; |
119 } | 122 } |
120 | 123 |
121 - (NSData *)JSONData { | 124 - (NSData *)JSONData { |
122 NSDictionary *message = @{ | 125 NSDictionary *message = @{ |
123 @"type": @"bye" | 126 @"type": @"bye" |
124 }; | 127 }; |
125 return [NSJSONSerialization dataWithJSONObject:message | 128 return [NSJSONSerialization dataWithJSONObject:message |
126 options:NSJSONWritingPrettyPrinted | 129 options:NSJSONWritingPrettyPrinted |
127 error:NULL]; | 130 error:NULL]; |
128 } | 131 } |
129 | 132 |
130 @end | 133 @end |
OLD | NEW |