| 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 4d58d2ad3477b9951f0307ae34edf1a625c9370e..94178abf4bb818a153b74aecfaaee1ad5872af18 100644
|
| --- a/webrtc/examples/objc/AppRTCDemo/mac/APPRTCViewController.m
|
| +++ b/webrtc/examples/objc/AppRTCDemo/mac/APPRTCViewController.m
|
| @@ -17,10 +17,10 @@
|
|
|
| #import "ARDAppClient.h"
|
|
|
| -static NSUInteger const kContentWidth = 1280;
|
| -static NSUInteger const kContentHeight = 720;
|
| +static NSUInteger const kContentWidth = 1080;
|
| +static NSUInteger const kContentHeight = 520;
|
| static NSUInteger const kRoomFieldWidth = 80;
|
| -static NSUInteger const kLogViewHeight = 280;
|
| +static NSUInteger const kLogViewHeight = 180;
|
|
|
| @class APPRTCMainView;
|
| @protocol APPRTCMainViewDelegate
|
| @@ -66,20 +66,25 @@ - (instancetype)initWithFrame:(NSRect)frame {
|
|
|
| - (void)updateConstraints {
|
| NSParameterAssert(
|
| - _roomField != nil && _scrollView != nil && _remoteVideoView != nil);
|
| + _roomField != nil && _scrollView != nil && _remoteVideoView != nil
|
| + && _localVideoView != nil);
|
| [self removeConstraints:[self constraints]];
|
| NSDictionary* viewsDictionary =
|
| NSDictionaryOfVariableBindings(_roomLabel,
|
| _roomField,
|
| _scrollView,
|
| + _localVideoView,
|
| _remoteVideoView);
|
|
|
| - NSSize remoteViewSize = [self remoteVideoViewSize];
|
| + NSSize remoteViewSize = NSMakeSize(kContentWidth, kContentHeight);
|
| + NSSize localViewSize = NSMakeSize(200, 120);
|
| NSDictionary* metrics = @{
|
| @"kLogViewHeight" : @(kLogViewHeight),
|
| @"kRoomFieldWidth" : @(kRoomFieldWidth),
|
| @"remoteViewWidth" : @(remoteViewSize.width),
|
| @"remoteViewHeight" : @(remoteViewSize.height),
|
| + @"localViewWidth" : @(localViewSize.width),
|
| + @"localViewHeight" : @(localViewSize.height),
|
| };
|
| // Declare this separately to avoid compiler warning about splitting string
|
| // within an NSArray expression.
|
| @@ -88,10 +93,12 @@ - (void)updateConstraints {
|
| "-[_remoteVideoView(remoteViewHeight)]-|";
|
| NSArray* constraintFormats = @[
|
| verticalConstraint,
|
| + @"V:|-(>=100)-[_localVideoView(localViewHeight)]-30-|",
|
| @"|-[_roomLabel]",
|
| @"|-[_roomField(kRoomFieldWidth)]",
|
| @"|-[_scrollView(remoteViewWidth)]-|",
|
| @"|-[_remoteVideoView(remoteViewWidth)]-|",
|
| + @"|-30-[_localVideoView(localViewWidth)]-(>=100)-|",
|
| ];
|
| for (NSString* constraintFormat in constraintFormats) {
|
| NSArray* constraints =
|
| @@ -134,7 +141,7 @@ - (void)videoView:(RTCNSGLVideoView*)videoView
|
| } else {
|
| return;
|
| }
|
| - [self setNeedsUpdateConstraints:YES];
|
| + //[self setNeedsUpdateConstraints:YES];
|
| }
|
|
|
| #pragma mark - Private
|
| @@ -188,8 +195,11 @@ - (void)setupViews {
|
| _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 {
|
| @@ -201,7 +211,11 @@ - (NSSize)remoteVideoViewSize {
|
| }
|
|
|
| - (NSSize)localVideoViewSize {
|
| - return NSZeroSize;
|
| + if (_localVideoSize.width > 0 && _localVideoSize.height > 0) {
|
| + return _localVideoSize;
|
| + } else {
|
| + return NSMakeSize(200, 120);
|
| + }
|
| }
|
|
|
| @end
|
| @@ -258,6 +272,7 @@ - (void)appClient:(ARDAppClient *)client
|
| - (void)appClient:(ARDAppClient *)client
|
| didReceiveLocalVideoTrack:(RTCVideoTrack *)localVideoTrack {
|
| _localVideoTrack = localVideoTrack;
|
| + [_localVideoTrack addRenderer:self.mainView.localVideoView];
|
| }
|
|
|
| - (void)appClient:(ARDAppClient *)client
|
|
|