| Index: webrtc/examples/objc/AppRTCDemo/mac/APPRTCViewController.m
|
| diff --git a/webrtc/examples/objc/AppRTCDemo/mac/APPRTCViewController.m b/webrtc/examples/objc/AppRTCDemo/mac/APPRTCViewController.m
|
| index 0f5bc386d7af65518d8fd8acd91f8756092d50b4..710b8a5ea40e1264c73d60d2c9be953e84111d93 100644
|
| --- a/webrtc/examples/objc/AppRTCDemo/mac/APPRTCViewController.m
|
| +++ b/webrtc/examples/objc/AppRTCDemo/mac/APPRTCViewController.m
|
| @@ -21,6 +21,7 @@ static NSUInteger const kContentWidth = 1280;
|
| static NSUInteger const kContentHeight = 720;
|
| static NSUInteger const kRoomFieldWidth = 80;
|
| static NSUInteger const kLogViewHeight = 280;
|
| +static NSUInteger const kPreviewWidth = 490;
|
|
|
| @class APPRTCMainView;
|
| @protocol APPRTCMainViewDelegate
|
| @@ -74,14 +75,18 @@ static NSUInteger const kLogViewHeight = 280;
|
| NSDictionaryOfVariableBindings(_roomLabel,
|
| _roomField,
|
| _scrollView,
|
| - _remoteVideoView);
|
| + _remoteVideoView,
|
| + _localVideoView);
|
|
|
| NSSize remoteViewSize = [self remoteVideoViewSize];
|
| NSDictionary* metrics = @{
|
| @"kLogViewHeight" : @(kLogViewHeight),
|
| + @"kPreviewWidth" : @(kPreviewWidth),
|
| @"kRoomFieldWidth" : @(kRoomFieldWidth),
|
| @"remoteViewWidth" : @(remoteViewSize.width),
|
| @"remoteViewHeight" : @(remoteViewSize.height),
|
| + @"localViewHeight" : @(remoteViewSize.height),
|
| + @"scrollViewWidth" : @(kContentWidth - kPreviewWidth),
|
| };
|
| // Declare this separately to avoid compiler warning about splitting string
|
| // within an NSArray expression.
|
| @@ -90,10 +95,14 @@ static NSUInteger const kLogViewHeight = 280;
|
| "-[_remoteVideoView(remoteViewHeight)]-|";
|
| NSArray* constraintFormats = @[
|
| verticalConstraint,
|
| + @"V:[_localVideoView]-[_remoteVideoView]",
|
| + @"V:[_localVideoView(kLogViewHeight)]",
|
| @"|-[_roomLabel]",
|
| @"|-[_roomField(kRoomFieldWidth)]",
|
| - @"|-[_scrollView(remoteViewWidth)]-|",
|
| + @"|-[_scrollView(scrollViewWidth)]",
|
| + @"[_scrollView]-[_localVideoView]",
|
| @"|-[_remoteVideoView(remoteViewWidth)]-|",
|
| + @"[_localVideoView(kPreviewWidth)]-|",
|
| ];
|
| for (NSString* constraintFormat in constraintFormats) {
|
| NSArray* constraints =
|
| @@ -190,20 +199,17 @@ static NSUInteger const kLogViewHeight = 280;
|
| _remoteVideoView.delegate = self;
|
| [self addSubview:_remoteVideoView];
|
|
|
| - // TODO(tkchin): create local video view.
|
| - // https://code.google.com/p/webrtc/issues/detail?id=3417.
|
| + _localVideoView = [[RTCNSGLVideoView alloc] initWithFrame:NSZeroRect
|
| + pixelFormat:pixelFormat];
|
| + [_localVideoView setTranslatesAutoresizingMaskIntoConstraints:NO];
|
| + _localVideoView.delegate = self;
|
| + [self addSubview:_localVideoView];
|
| }
|
|
|
| - (NSSize)remoteVideoViewSize {
|
| - if (_remoteVideoSize.width > 0 && _remoteVideoSize.height > 0) {
|
| - return _remoteVideoSize;
|
| - } else {
|
| - return NSMakeSize(kContentWidth, kContentHeight);
|
| - }
|
| -}
|
| -
|
| -- (NSSize)localVideoViewSize {
|
| - return NSZeroSize;
|
| + NSInteger width = MAX(_remoteVideoSize.width, kContentWidth);
|
| + NSInteger height = (width/16) * 9;
|
| + return NSMakeSize(width, height);
|
| }
|
|
|
| @end
|
| @@ -260,6 +266,7 @@ static NSUInteger const kLogViewHeight = 280;
|
| - (void)appClient:(ARDAppClient *)client
|
| didReceiveLocalVideoTrack:(RTCVideoTrack *)localVideoTrack {
|
| _localVideoTrack = localVideoTrack;
|
| + [_localVideoTrack addRenderer:self.mainView.localVideoView];
|
| }
|
|
|
| - (void)appClient:(ARDAppClient *)client
|
| @@ -306,8 +313,11 @@ static NSUInteger const kLogViewHeight = 280;
|
|
|
| - (void)resetUI {
|
| [_remoteVideoTrack removeRenderer:self.mainView.remoteVideoView];
|
| + [_localVideoTrack removeRenderer:self.mainView.localVideoView];
|
| _remoteVideoTrack = nil;
|
| + _localVideoTrack = nil;
|
| [self.mainView.remoteVideoView renderFrame:nil];
|
| + [self.mainView.localVideoView renderFrame:nil];
|
| }
|
|
|
| - (void)disconnect {
|
|
|