Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(25)

Unified Diff: webrtc/examples/objc/AppRTCDemo/ARDCEODTURNClient.m

Issue 1690313002: Update iOS AppRTCDemo to use the updated Objective-C API. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Update Mac demo and other changes after updating against master Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/examples/objc/AppRTCDemo/ARDCEODTURNClient.m
diff --git a/webrtc/examples/objc/AppRTCDemo/ARDCEODTURNClient.m b/webrtc/examples/objc/AppRTCDemo/ARDCEODTURNClient.m
index 70f815a6a8bf9457961eab19fe34a55e830aaebd..af79b4a1b40d542ed8a6eb7f904f7f7ebd99ac7e 100644
--- a/webrtc/examples/objc/AppRTCDemo/ARDCEODTURNClient.m
+++ b/webrtc/examples/objc/AppRTCDemo/ARDCEODTURNClient.m
@@ -11,7 +11,7 @@
#import "ARDCEODTURNClient.h"
#import "ARDUtilities.h"
-#import "RTCICEServer+JSON.h"
+#import "RTCIceServer+JSON.h"
// TODO(tkchin): move this to a configuration object.
static NSString *kTURNOriginURLString = @"https://apprtc.appspot.com";
@@ -30,8 +30,8 @@ static NSInteger kARDCEODTURNClientErrorBadResponse = -1;
return self;
}
-- (void)requestServersWithCompletionHandler:
- (void (^)(NSArray *turnServers,
+- (void)requestServerWithCompletionHandler:
+ (void (^)(RTCIceServer *turnServer,
NSError *error))completionHandler {
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:_url];
// We need to set origin because TURN provider whitelists requests based on
@@ -42,24 +42,23 @@ static NSInteger kARDCEODTURNClientErrorBadResponse = -1;
completionHandler:^(NSURLResponse *response,
NSData *data,
NSError *error) {
- NSArray *turnServers = [NSArray array];
if (error) {
- completionHandler(turnServers, error);
+ completionHandler(nil, error);
return;
}
NSDictionary *dict = [NSDictionary dictionaryWithJSONData:data];
- turnServers = [RTCICEServer serversFromCEODJSONDictionary:dict];
- if (!turnServers) {
+ RTCIceServer *turnServer = [RTCIceServer serverFromCEODJSONDictionary:dict];
+ if (!turnServer) {
NSError *responseError =
[[NSError alloc] initWithDomain:kARDCEODTURNClientErrorDomain
code:kARDCEODTURNClientErrorBadResponse
userInfo:@{
NSLocalizedDescriptionKey: @"Bad TURN response.",
}];
- completionHandler(turnServers, responseError);
+ completionHandler(turnServer, responseError);
return;
}
- completionHandler(turnServers, nil);
+ completionHandler(turnServer, nil);
}];
}

Powered by Google App Engine
This is Rietveld 408576698