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/webrtc@7229 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/modules/video_capture/ios/rtc_video_capture_ios_objc.mm b/modules/video_capture/ios/rtc_video_capture_ios_objc.mm
index ac90b72..b5c53b1 100644
--- a/modules/video_capture/ios/rtc_video_capture_ios_objc.mm
+++ b/modules/video_capture/ios/rtc_video_capture_ios_objc.mm
@@ -204,12 +204,31 @@
[_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];
diff --git a/modules/video_capture/video_capture.gypi b/modules/video_capture/video_capture.gypi
index e57d97a..888d772 100644
--- a/modules/video_capture/video_capture.gypi
+++ b/modules/video_capture/video_capture.gypi
@@ -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': {