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

Side by Side Diff: webrtc/examples/objc/AppRTCMobile/ARDCaptureController.m

Issue 2862493003: Make fps NSInteger in startCaptureWithDevice. (Closed)
Patch Set: Print NSInteger directly. Created 3 years, 7 months 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 unified diff | Download patch
« no previous file with comments | « no previous file | webrtc/sdk/objc/Framework/Classes/RTCCameraVideoCapturer.m » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2017 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2017 The WebRTC Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 16 matching lines...) Expand all
27 } 27 }
28 28
29 return self; 29 return self;
30 } 30 }
31 31
32 - (void)startCapture { 32 - (void)startCapture {
33 AVCaptureDevicePosition position = 33 AVCaptureDevicePosition position =
34 _usingFrontCamera ? AVCaptureDevicePositionFront : AVCaptureDevicePosition Back; 34 _usingFrontCamera ? AVCaptureDevicePositionFront : AVCaptureDevicePosition Back;
35 AVCaptureDevice *device = [self findDeviceForPosition:position]; 35 AVCaptureDevice *device = [self findDeviceForPosition:position];
36 AVCaptureDeviceFormat *format = [self selectFormatForDevice:device]; 36 AVCaptureDeviceFormat *format = [self selectFormatForDevice:device];
37 int fps = [self selectFpsForFormat:format]; 37 NSInteger fps = [self selectFpsForFormat:format];
38 38
39 [_capturer startCaptureWithDevice:device format:format fps:fps]; 39 [_capturer startCaptureWithDevice:device format:format fps:fps];
40 } 40 }
41 41
42 - (void)stopCapture { 42 - (void)stopCapture {
43 [_capturer stopCapture]; 43 [_capturer stopCapture];
44 } 44 }
45 45
46 - (void)switchCamera { 46 - (void)switchCamera {
47 _usingFrontCamera = !_usingFrontCamera; 47 _usingFrontCamera = !_usingFrontCamera;
(...skipping 26 matching lines...) Expand all
74 if (diff < currentDiff) { 74 if (diff < currentDiff) {
75 selectedFormat = format; 75 selectedFormat = format;
76 currentDiff = diff; 76 currentDiff = diff;
77 } 77 }
78 } 78 }
79 79
80 NSAssert(selectedFormat != nil, @"No suitable capture format found."); 80 NSAssert(selectedFormat != nil, @"No suitable capture format found.");
81 return selectedFormat; 81 return selectedFormat;
82 } 82 }
83 83
84 - (int)selectFpsForFormat:(AVCaptureDeviceFormat *)format { 84 - (NSInteger)selectFpsForFormat:(AVCaptureDeviceFormat *)format {
85 Float64 maxFramerate = 0; 85 Float64 maxFramerate = 0;
86 for (AVFrameRateRange *fpsRange in format.videoSupportedFrameRateRanges) { 86 for (AVFrameRateRange *fpsRange in format.videoSupportedFrameRateRanges) {
87 maxFramerate = fmax(maxFramerate, fpsRange.maxFrameRate); 87 maxFramerate = fmax(maxFramerate, fpsRange.maxFrameRate);
88 } 88 }
89 return maxFramerate; 89 return maxFramerate;
90 } 90 }
91 91
92 @end 92 @end
OLDNEW
« no previous file with comments | « no previous file | webrtc/sdk/objc/Framework/Classes/RTCCameraVideoCapturer.m » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698