Index: webrtc/examples/objc/AppRTCDemo/ARDSignalingMessage.m |
diff --git a/webrtc/examples/objc/AppRTCDemo/ARDSignalingMessage.m b/webrtc/examples/objc/AppRTCDemo/ARDSignalingMessage.m |
index a5ca29576a0c0315194b00b938efc98e26d3be04..3fab185848513b53ab6bbe8190ccfbd6a7ae8524 100644 |
--- a/webrtc/examples/objc/AppRTCDemo/ARDSignalingMessage.m |
+++ b/webrtc/examples/objc/AppRTCDemo/ARDSignalingMessage.m |
@@ -16,7 +16,8 @@ |
#import "RTCIceCandidate+JSON.h" |
#import "RTCSessionDescription+JSON.h" |
-static NSString const *kARDSignalingMessageTypeKey = @"type"; |
+static NSString * const kARDSignalingMessageTypeKey = @"type"; |
+static NSString * const kARDTypeValueRemoveCandidates = @"remove-candidates"; |
@implementation ARDSignalingMessage |
@@ -47,6 +48,12 @@ static NSString const *kARDSignalingMessageTypeKey = @"type"; |
RTCIceCandidate *candidate = |
[RTCIceCandidate candidateFromJSONDictionary:values]; |
message = [[ARDICECandidateMessage alloc] initWithCandidate:candidate]; |
+ } else if ([typeString isEqualToString:kARDTypeValueRemoveCandidates]) { |
+ RTCLogInfo(@"Received remove-candidates message"); |
+ NSArray<RTCIceCandidate *> *candidates = |
+ [RTCIceCandidate candidatesFromJSONDictionary:values]; |
+ message = [[ARDICECandidateRemovalMessage alloc] |
+ initWithRemovedCandidates:candidates]; |
} else if ([typeString isEqualToString:@"offer"] || |
[typeString isEqualToString:@"answer"]) { |
RTCSessionDescription *description = |
@@ -84,6 +91,27 @@ static NSString const *kARDSignalingMessageTypeKey = @"type"; |
@end |
+@implementation ARDICECandidateRemovalMessage |
+ |
+@synthesize candidates = _candidates; |
+ |
+- (instancetype)initWithRemovedCandidates:( |
+ NSArray<RTCIceCandidate *> *)candidates { |
+ NSParameterAssert(candidates.count); |
+ if (self = [super initWithType:kARDSignalingMessageTypeCandidateRemoval]) { |
+ _candidates = candidates; |
+ } |
+ return self; |
+} |
+ |
+- (NSData *)JSONData { |
+ return |
+ [RTCIceCandidate JSONDataForIceCandidates:_candidates |
+ withType:kARDTypeValueRemoveCandidates]; |
+} |
+ |
+@end |
+ |
@implementation ARDSessionDescriptionMessage |
@synthesize sessionDescription = _sessionDescription; |