AppRTCDemo: builds using ninja on iOS for simulator and device!
Things included in this CL:
- updated READMEs to provide an exact/reproable set of steps for getting the app
running.
- gyp changes to build the iOS AppRTCDemo sample app using gyp+ninja instead of
the hand-crafted Xcode project (which has never worked in its checked-in
form), including a gyp action to sign the sample app for deployment to an iOS
device (the app can also be used in the simulator)
- deleted the busted hand-crafted Xcode project for the sample app
- updated the sample app to match the PeerConnection API that ended up landing
(in a surprising twist of fate, the API landed quite a bit later than the
sample app and this is the first time the CR-time changes in the API are
reflected in the sample app)
- updated the sample app to reflect apprtc.appspot.com HTML/JS changes (equiv to
the AppRTCClient.java changes in http://s10/47299162)
- picked up the iossim DEPS to enable launching the sample app in the simulator
from the command-line.
- renamed some files to match capitalization of the classes they contain (Ice ->
ICE) per ObjC naming guidelines.
- ran the files involved in this CL through clang-format to deal with xcode
formatting craxy.
BUG=2106
RISK=P2
TESTED=unittest builds with ninja and passes on OS=mac; sample app builds with ninja and runs on simulator and device, though no audio flows from simulator/device (will fix in a follow-up CL)
R=andrew@webrtc.org, justincohen@google.com, wu@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/1874005
git-svn-id: http://webrtc.googlecode.com/svn/trunk@4466 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/talk/examples/ios/AppRTCDemo/APPRTCAppDelegate.m b/talk/examples/ios/AppRTCDemo/APPRTCAppDelegate.m
index 0c429a0..710f4ad 100644
--- a/talk/examples/ios/AppRTCDemo/APPRTCAppDelegate.m
+++ b/talk/examples/ios/AppRTCDemo/APPRTCAppDelegate.m
@@ -28,8 +28,8 @@
#import "APPRTCAppDelegate.h"
#import "APPRTCViewController.h"
-#import "RTCIceCandidate.h"
-#import "RTCIceServer.h"
+#import "RTCICECandidate.h"
+#import "RTCICEServer.h"
#import "RTCMediaConstraints.h"
#import "RTCMediaStream.h"
#import "RTCPair.h"
@@ -61,12 +61,12 @@
}
- (void)peerConnection:(RTCPeerConnection *)peerConnection
- onSignalingStateChange:(RTCSignalingState)stateChanged {
+ signalingStateChanged:(RTCSignalingState)stateChanged {
NSLog(@"PCO onSignalingStateChange.");
}
- (void)peerConnection:(RTCPeerConnection *)peerConnection
- onAddStream:(RTCMediaStream *)stream {
+ addedStream:(RTCMediaStream *)stream {
NSLog(@"PCO onAddStream.");
dispatch_async(dispatch_get_main_queue(), ^(void) {
NSAssert([stream.audioTracks count] >= 1,
@@ -78,7 +78,7 @@
}
- (void)peerConnection:(RTCPeerConnection *)peerConnection
- onRemoveStream:(RTCMediaStream *)stream {
+ removedStream:(RTCMediaStream *)stream {
NSLog(@"PCO onRemoveStream.");
// TODO(hughv): Remove video track.
}
@@ -90,8 +90,8 @@
}
- (void)peerConnection:(RTCPeerConnection *)peerConnection
- onIceCandidate:(RTCIceCandidate *)candidate {
- NSLog(@"PCO onIceCandidate.\n Mid[%@] Index[%d] Sdp[%@]",
+ gotICECandidate:(RTCICECandidate *)candidate {
+ NSLog(@"PCO onICECandidate.\n Mid[%@] Index[%d] Sdp[%@]",
candidate.sdpMid,
candidate.sdpMLineIndex,
candidate.sdp);
@@ -112,12 +112,12 @@
}
- (void)peerConnection:(RTCPeerConnection *)peerConnection
- onIceGatheringChange:(RTCIceGatheringState)newState {
+ iceGatheringChanged:(RTCICEGatheringState)newState {
NSLog(@"PCO onIceGatheringChange. %d", newState);
}
- (void)peerConnection:(RTCPeerConnection *)peerConnection
- onIceConnectionChange:(RTCIceConnectionState)newState {
+ iceConnectionChanged:(RTCICEConnectionState)newState {
NSLog(@"PCO onIceConnectionChange. %d", newState);
}
@@ -139,9 +139,10 @@
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
+ [RTCPeerConnectionFactory initializeSSL];
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.viewController =
- [[APPRTCViewController alloc] initWithNibName:@"RTCViewController"
+ [[APPRTCViewController alloc] initWithNibName:@"APPRTCViewController"
bundle:nil];
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
@@ -174,7 +175,7 @@
return NO;
}
self.client = [[APPRTCAppClient alloc] init];
- self.client.iceServerDelegate = self;
+ self.client.ICEServerDelegate = self;
self.client.messageHandler = self;
[self.client connectToRoom:url];
return YES;
@@ -191,23 +192,23 @@
[self.client sendData:data];
}
-#pragma mark - IceServerDelegate method
+#pragma mark - ICEServerDelegate method
-- (void)onIceServers:(NSArray *)servers {
+- (void)onICEServers:(NSArray *)servers {
self.queuedRemoteCandidates = [NSMutableArray array];
self.peerConnectionFactory = [[RTCPeerConnectionFactory alloc] init];
RTCMediaConstraints *constraints = [[RTCMediaConstraints alloc] init];
self.pcObserver = [[PCObserver alloc] initWithDelegate:self];
self.peerConnection =
- [self.peerConnectionFactory peerConnectionWithIceServers:servers
+ [self.peerConnectionFactory peerConnectionWithICEServers:servers
constraints:constraints
delegate:self.pcObserver];
RTCMediaStream *lms =
[self.peerConnectionFactory mediaStreamWithLabel:@"ARDAMS"];
// TODO(hughv): Add video.
- [lms addAudioTrack:[self.peerConnectionFactory audioTrackWithId:@"ARDAMSa0"]];
- [self.peerConnection addStream:lms withConstraints:constraints];
- [self displayLogMessage:@"onIceServers - add local stream."];
+ [lms addAudioTrack:[self.peerConnectionFactory audioTrackWithID:@"ARDAMSa0"]];
+ [self.peerConnection addStream:lms constraints:constraints];
+ [self displayLogMessage:@"onICEServers - add local stream."];
}
#pragma mark - GAEMessageHandler methods
@@ -245,14 +246,14 @@
NSString *mid = [objects objectForKey:@"id"];
NSNumber *sdpLineIndex = [objects objectForKey:@"label"];
NSString *sdp = [objects objectForKey:@"candidate"];
- RTCIceCandidate *candidate =
- [[RTCIceCandidate alloc] initWithMid:mid
+ RTCICECandidate *candidate =
+ [[RTCICECandidate alloc] initWithMid:mid
index:sdpLineIndex.intValue
sdp:sdp];
if (self.queuedRemoteCandidates) {
[self.queuedRemoteCandidates addObject:candidate];
} else {
- [self.peerConnection addIceCandidate:candidate];
+ [self.peerConnection addICECandidate:candidate];
}
} else if (([value compare:@"offer"] == NSOrderedSame) ||
([value compare:@"answer"] == NSOrderedSame)) {
@@ -283,8 +284,8 @@
#pragma mark - RTCSessionDescriptonDelegate methods
- (void)peerConnection:(RTCPeerConnection *)peerConnection
- createSessionDescriptionCompleted:(RTCSessionDescription *)sdp
- withError:(NSError *)error {
+ didCreateSessionDescription:(RTCSessionDescription *)sdp
+ error:(NSError *)error {
if (error) {
[self displayLogMessage:@"SDP onFailure."];
NSAssert(NO, error.description);
@@ -308,7 +309,7 @@
}
- (void)peerConnection:(RTCPeerConnection *)peerConnection
- setSessionDescriptionCompletedWithError:(NSError *)error {
+ didSetSessionDescriptionWithError:(NSError *)error {
if (error) {
[self displayLogMessage:@"SDP onFailure."];
NSAssert(NO, error.description);
@@ -333,14 +334,15 @@
self.peerConnection = nil;
self.peerConnectionFactory = nil;
self.pcObserver = nil;
- self.client.iceServerDelegate = nil;
+ self.client.ICEServerDelegate = nil;
self.client.messageHandler = nil;
self.client = nil;
+ [RTCPeerConnectionFactory deinitializeSSL];
}
- (void)drainRemoteCandidates {
- for (RTCIceCandidate *candidate in self.queuedRemoteCandidates) {
- [self.peerConnection addIceCandidate:candidate];
+ for (RTCICECandidate *candidate in self.queuedRemoteCandidates) {
+ [self.peerConnection addICECandidate:candidate];
}
self.queuedRemoteCandidates = nil;
}