AppRTCDemo(ios): style/cleanup fixes following cr/62871616-p10

BUG=2168
R=noahric@google.com

Review URL: https://webrtc-codereview.appspot.com/9709004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@5768 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/talk/examples/ios/AppRTCDemo/APPRTCViewController.m b/talk/examples/ios/AppRTCDemo/APPRTCViewController.m
index cacac14..8c5ccde 100644
--- a/talk/examples/ios/AppRTCDemo/APPRTCViewController.m
+++ b/talk/examples/ios/AppRTCDemo/APPRTCViewController.m
@@ -27,49 +27,40 @@
 
 #import "APPRTCViewController.h"
 
-#import "VideoView.h"
+#import "APPRTCVideoView.h"
 
 @interface APPRTCViewController ()
 
-@property (nonatomic, assign) UIInterfaceOrientation statusBarOrientation;
+@property(nonatomic, assign) UIInterfaceOrientation statusBarOrientation;
 
 @end
 
 @implementation APPRTCViewController
 
-@synthesize textField = _textField;
-@synthesize textInstructions = _textInstructions;
-@synthesize textOutput = _textOutput;
-@synthesize blackView = _blackView;
-
-@synthesize remoteVideoView = _remoteVideoView;
-@synthesize localVideoView = _localVideoView;
-
-@synthesize statusBarOrientation = _statusBarOrientation;
-
 - (void)viewDidLoad {
   [super viewDidLoad];
   self.statusBarOrientation =
-    [UIApplication sharedApplication].statusBarOrientation;
+      [UIApplication sharedApplication].statusBarOrientation;
   self.textField.delegate = self;
   [self.textField becomeFirstResponder];
 }
 
 - (void)viewDidLayoutSubviews {
-    if (self.statusBarOrientation !=
-        [UIApplication sharedApplication].statusBarOrientation) {
-        self.statusBarOrientation =
-            [UIApplication sharedApplication].statusBarOrientation;
-        [[NSNotificationCenter defaultCenter]
-         postNotificationName:@"StatusBarOrientationDidChange" object:nil];
-    }
+  if (self.statusBarOrientation !=
+      [UIApplication sharedApplication].statusBarOrientation) {
+    self.statusBarOrientation =
+        [UIApplication sharedApplication].statusBarOrientation;
+    [[NSNotificationCenter defaultCenter]
+        postNotificationName:@"StatusBarOrientationDidChange"
+                      object:nil];
+  }
 }
 
-- (void)displayText:(NSString *)text {
+- (void)displayText:(NSString*)text {
   dispatch_async(dispatch_get_main_queue(), ^(void) {
-    NSString *output =
-        [NSString stringWithFormat:@"%@\n%@", self.textOutput.text, text];
-    self.textOutput.text = output;
+      NSString* output =
+          [NSString stringWithFormat:@"%@\n%@", self.textOutput.text, text];
+      self.textOutput.text = output;
   });
 }
 
@@ -82,11 +73,11 @@
   self.textOutput.text = nil;
   self.blackView.hidden = YES;
 
-  [_remoteVideoView stop];
+  [_remoteVideoView renderVideoTrackInterface:nil];
   [_remoteVideoView removeFromSuperview];
   self.remoteVideoView = nil;
 
-  [_localVideoView stop];
+  [_remoteVideoView renderVideoTrackInterface:nil];
   [_localVideoView removeFromSuperview];
   self.localVideoView = nil;
 }
@@ -94,61 +85,62 @@
 // TODO(fischman): Use video dimensions from the incoming video stream
 // and resize the Video View accordingly w.r.t. aspect ratio.
 enum {
-    // Remote video view dimensions.
-    kRemoteVideoWidth = 640,
-    kRemoteVideoHeight = 480,
-    // Padding space for local video view with its parent.
-    kLocalViewPadding = 20
+  // Remote video view dimensions.
+  kRemoteVideoWidth = 640,
+  kRemoteVideoHeight = 480,
+  // Padding space for local video view with its parent.
+  kLocalViewPadding = 20
 };
 
 - (void)setupCaptureSession {
-    self.blackView.hidden = NO;
+  self.blackView.hidden = NO;
 
-    CGRect frame = CGRectMake((self.blackView.bounds.size.width
-                               -kRemoteVideoWidth)/2,
-                              (self.blackView.bounds.size.height
-                               -kRemoteVideoHeight)/2,
-                              kRemoteVideoWidth,
-                              kRemoteVideoHeight);
-    VideoView *videoView = [[VideoView alloc] initWithFrame:frame];
-    videoView.isRemote = TRUE;
+  CGRect frame =
+      CGRectMake((self.blackView.bounds.size.width - kRemoteVideoWidth) / 2,
+                 (self.blackView.bounds.size.height - kRemoteVideoHeight) / 2,
+                 kRemoteVideoWidth,
+                 kRemoteVideoHeight);
+  APPRTCVideoView* videoView = [[APPRTCVideoView alloc] initWithFrame:frame];
+  videoView.isRemote = TRUE;
 
-    [self.blackView addSubview:videoView];
-    videoView.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin |
-                                    UIViewAutoresizingFlexibleRightMargin |
-                                    UIViewAutoresizingFlexibleBottomMargin |
-                                    UIViewAutoresizingFlexibleTopMargin;
-    videoView.translatesAutoresizingMaskIntoConstraints = YES;
-    _remoteVideoView = videoView;
+  [self.blackView addSubview:videoView];
+  videoView.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin |
+                               UIViewAutoresizingFlexibleRightMargin |
+                               UIViewAutoresizingFlexibleBottomMargin |
+                               UIViewAutoresizingFlexibleTopMargin;
+  videoView.translatesAutoresizingMaskIntoConstraints = YES;
+  _remoteVideoView = videoView;
 
-    CGSize screenSize = [[UIScreen mainScreen] bounds].size;
-    CGFloat localVideoViewWidth =
-        UIInterfaceOrientationIsPortrait(self.statusBarOrientation) ?
-                        screenSize.width/4 : screenSize.height/4;
-    CGFloat localVideoViewHeight =
-        UIInterfaceOrientationIsPortrait(self.statusBarOrientation) ?
-                        screenSize.height/4 : screenSize.width/4;
-    frame = CGRectMake(self.blackView.bounds.size.width
-                       -localVideoViewWidth-kLocalViewPadding,
-                       kLocalViewPadding,
-                       localVideoViewWidth,
-                       localVideoViewHeight);
-    videoView = [[VideoView alloc] initWithFrame:frame];
-    videoView.isRemote = FALSE;
+  CGSize screenSize = [[UIScreen mainScreen] bounds].size;
+  CGFloat localVideoViewWidth =
+      UIInterfaceOrientationIsPortrait(self.statusBarOrientation)
+          ? screenSize.width / 4
+          : screenSize.height / 4;
+  CGFloat localVideoViewHeight =
+      UIInterfaceOrientationIsPortrait(self.statusBarOrientation)
+          ? screenSize.height / 4
+          : screenSize.width / 4;
+  frame = CGRectMake(self.blackView.bounds.size.width - localVideoViewWidth -
+                         kLocalViewPadding,
+                     kLocalViewPadding,
+                     localVideoViewWidth,
+                     localVideoViewHeight);
+  videoView = [[APPRTCVideoView alloc] initWithFrame:frame];
+  videoView.isRemote = FALSE;
 
-    [self.blackView addSubview:videoView];
-    videoView.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin |
-                                    UIViewAutoresizingFlexibleBottomMargin |
-                                    UIViewAutoresizingFlexibleHeight |
-                                    UIViewAutoresizingFlexibleWidth;
-    videoView.translatesAutoresizingMaskIntoConstraints = YES;
-    _localVideoView = videoView;
+  [self.blackView addSubview:videoView];
+  videoView.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin |
+                               UIViewAutoresizingFlexibleBottomMargin |
+                               UIViewAutoresizingFlexibleHeight |
+                               UIViewAutoresizingFlexibleWidth;
+  videoView.translatesAutoresizingMaskIntoConstraints = YES;
+  _localVideoView = videoView;
 }
 
 #pragma mark - UITextFieldDelegate
 
-- (void)textFieldDidEndEditing:(UITextField *)textField {
-  NSString *room = textField.text;
+- (void)textFieldDidEndEditing:(UITextField*)textField {
+  NSString* room = textField.text;
   if ([room length] == 0) {
     return;
   }
@@ -159,16 +151,14 @@
   // prepopulating the textField with a valid URL missing the room.  This allows
   // the user to have the simplicity of just entering the room or the ability to
   // override to a custom appspot instance.  Remove apprtc:// when this is done.
-  NSString *url =
+  NSString* url =
       [NSString stringWithFormat:@"apprtc://apprtc.appspot.com/?r=%@", room];
   [[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];
 
-  dispatch_async(dispatch_get_main_queue(), ^{
-      [self setupCaptureSession];
-  });
+  dispatch_async(dispatch_get_main_queue(), ^{ [self setupCaptureSession]; });
 }
 
-- (BOOL)textFieldShouldReturn:(UITextField *)textField {
+- (BOOL)textFieldShouldReturn:(UITextField*)textField {
   // There is no other control that can take focus, so manually resign focus
   // when return (Join) is pressed to trigger |textFieldDidEndEditing|.
   [textField resignFirstResponder];