Update iOS video capture to use non-deprecated APIs.
BUG=3626 R=glaznev@webrtc.org Review URL: https://webrtc-codereview.appspot.com/17279004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@7229 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@@ -204,12 +204,31 @@ using namespace webrtc::videocapturemodule;
|
||||
[_captureSession setSessionPreset:captureQuality];
|
||||
|
||||
// take care of capture framerate now
|
||||
NSArray* sessionInputs = _captureSession.inputs;
|
||||
AVCaptureDeviceInput* deviceInput = [sessionInputs count] > 0 ?
|
||||
sessionInputs[0] : nil;
|
||||
AVCaptureDevice* inputDevice = deviceInput.device;
|
||||
if (inputDevice) {
|
||||
AVCaptureDeviceFormat* activeFormat = inputDevice.activeFormat;
|
||||
NSArray* supportedRanges = activeFormat.videoSupportedFrameRateRanges;
|
||||
AVFrameRateRange* targetRange = [supportedRanges count] > 0 ?
|
||||
supportedRanges[0] : nil;
|
||||
// Find the largest supported framerate less than capability maxFPS.
|
||||
for (AVFrameRateRange* range in supportedRanges) {
|
||||
if (range.maxFrameRate <= _capability.maxFPS &&
|
||||
targetRange.maxFrameRate <= range.maxFrameRate) {
|
||||
targetRange = range;
|
||||
}
|
||||
}
|
||||
if (targetRange && [inputDevice lockForConfiguration:NULL]) {
|
||||
inputDevice.activeVideoMinFrameDuration = targetRange.minFrameDuration;
|
||||
inputDevice.activeVideoMaxFrameDuration = targetRange.minFrameDuration;
|
||||
[inputDevice unlockForConfiguration];
|
||||
}
|
||||
}
|
||||
|
||||
_connection = [currentOutput connectionWithMediaType:AVMediaTypeVideo];
|
||||
[self setRelativeVideoOrientation];
|
||||
CMTime cm_time = {1, _capability.maxFPS, kCMTimeFlags_Valid, 0};
|
||||
|
||||
[_connection setVideoMinFrameDuration:cm_time];
|
||||
[_connection setVideoMaxFrameDuration:cm_time];
|
||||
|
||||
// finished configuring, commit settings to AVCaptureSession.
|
||||
[_captureSession commitConfiguration];
|
||||
|
||||
@@ -138,12 +138,6 @@
|
||||
],
|
||||
'xcode_settings': {
|
||||
'CLANG_ENABLE_OBJC_ARC': 'YES',
|
||||
'WARNING_CFLAGS': [
|
||||
# To avoid warnings for deprecated videoMinFrameDuration and
|
||||
# videoMaxFrameDuration properties in iOS 7.0.
|
||||
# See webrtc:3705 for more details.
|
||||
'-Wno-deprecated-declarations',
|
||||
],
|
||||
},
|
||||
'all_dependent_settings': {
|
||||
'xcode_settings': {
|
||||
|
||||
Reference in New Issue
Block a user