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

Unified Diff: webrtc/examples/objc/AppRTCDemo/ios/ARDVideoCallView.m

Issue 1497393002: Add new view that renders local video using AVCaptureLayerPreview. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Removing duplicated check in presubmit.py Created 5 years 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/ios/ARDVideoCallView.m
diff --git a/webrtc/examples/objc/AppRTCDemo/ios/ARDVideoCallView.m b/webrtc/examples/objc/AppRTCDemo/ios/ARDVideoCallView.m
index 4048b84bb2bf3a874fa941109bfab231df0a1b86..4c9c9d284e0ef0bd5c1baaa919cb01cfb524f0ae 100644
--- a/webrtc/examples/objc/AppRTCDemo/ios/ARDVideoCallView.m
+++ b/webrtc/examples/objc/AppRTCDemo/ios/ARDVideoCallView.m
@@ -25,7 +25,6 @@ static CGFloat const kStatusBarHeight = 20;
@implementation ARDVideoCallView {
UIButton *_cameraSwitchButton;
UIButton *_hangupButton;
- CGSize _localVideoSize;
CGSize _remoteVideoSize;
BOOL _useRearCamera;
}
@@ -42,10 +41,7 @@ static CGFloat const kStatusBarHeight = 20;
_remoteVideoView.delegate = self;
[self addSubview:_remoteVideoView];
- // TODO(tkchin): replace this with a view that renders layer from
- // AVCaptureSession.
- _localVideoView = [[RTCEAGLVideoView alloc] initWithFrame:CGRectZero];
- _localVideoView.delegate = self;
+ _localVideoView = [[RTCCameraPreviewView alloc] initWithFrame:CGRectZero];
[self addSubview:_localVideoView];
_statsView = [[ARDStatsView alloc] initWithFrame:CGRectZero];
@@ -114,22 +110,15 @@ static CGFloat const kStatusBarHeight = 20;
_remoteVideoView.frame = bounds;
}
- if (_localVideoSize.width && _localVideoSize.height > 0) {
- // Aspect fit local video view into a square box.
- CGRect localVideoFrame =
- CGRectMake(0, 0, kLocalVideoViewSize, kLocalVideoViewSize);
- localVideoFrame =
- AVMakeRectWithAspectRatioInsideRect(_localVideoSize, localVideoFrame);
-
- // Place the view in the bottom right.
- localVideoFrame.origin.x = CGRectGetMaxX(bounds)
- - localVideoFrame.size.width - kLocalVideoViewPadding;
- localVideoFrame.origin.y = CGRectGetMaxY(bounds)
- - localVideoFrame.size.height - kLocalVideoViewPadding;
- _localVideoView.frame = localVideoFrame;
- } else {
- _localVideoView.frame = bounds;
- }
+ // Aspect fit local video view into a square box.
+ CGRect localVideoFrame =
+ CGRectMake(0, 0, kLocalVideoViewSize, kLocalVideoViewSize);
+ // Place the view in the bottom right.
+ localVideoFrame.origin.x = CGRectGetMaxX(bounds)
+ - localVideoFrame.size.width - kLocalVideoViewPadding;
+ localVideoFrame.origin.y = CGRectGetMaxY(bounds)
+ - localVideoFrame.size.height - kLocalVideoViewPadding;
+ _localVideoView.frame = localVideoFrame;
// Place stats at the top.
CGSize statsSize = [_statsView sizeThatFits:bounds.size];
@@ -159,10 +148,7 @@ static CGFloat const kStatusBarHeight = 20;
#pragma mark - RTCEAGLVideoViewDelegate
- (void)videoView:(RTCEAGLVideoView*)videoView didChangeVideoSize:(CGSize)size {
- if (videoView == _localVideoView) {
- _localVideoSize = size;
- _localVideoView.hidden = CGSizeEqualToSize(CGSizeZero, _localVideoSize);
- } else if (videoView == _remoteVideoView) {
+ if (videoView == _remoteVideoView) {
_remoteVideoSize = size;
}
[self setNeedsLayout];

Powered by Google App Engine
This is Rietveld 408576698