iOS SDK 10.0 compatability.

This CL adds support targeting iOS 10 as a min version.

Bug: None
Change-Id: I353a9884eb907e97387553fd73427fd7cb0dbfc2
Reviewed-on: https://webrtc-review.googlesource.com/79921
Reviewed-by: Anders Carlsson <andersc@webrtc.org>
Commit-Queue: Kári Helgason <kthelgason@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23461}
This commit is contained in:
Kári Tristan Helgason 2018-05-30 16:44:21 +02:00 committed by Commit Bot
parent 02a69190e8
commit ccac98861f
3 changed files with 13 additions and 17 deletions

View File

@ -110,7 +110,16 @@ const int64_t kNanosecondsPerSecond = 1000000000;
}
+ (NSArray<AVCaptureDevice *> *)captureDevices {
#if defined(WEBRTC_IOS) && defined(__IPHONE_10_0) && \
__IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_10_0
AVCaptureDeviceDiscoverySession *session = [AVCaptureDeviceDiscoverySession
discoverySessionWithDeviceTypes:@[ AVCaptureDeviceTypeBuiltInWideAngleCamera ]
mediaType:AVMediaTypeVideo
position:AVCaptureDevicePositionUnspecified];
return session.devices;
#else
return [AVCaptureDevice devicesWithMediaType:AVMediaTypeVideo];
#endif
}
+ (NSArray<AVCaptureDeviceFormat *> *)supportedFormatsForDevice:(AVCaptureDevice *)device {

View File

@ -45,8 +45,11 @@
[CADisplayLink displayLinkWithTarget:self
selector:@selector(displayLinkDidFire:)];
_displayLink.paused = YES;
// Set to half of screen refresh, which should be 30fps.
#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_10_0
_displayLink.preferredFramesPerSecond = 30;
#else
[_displayLink setFrameInterval:2];
#endif
[_displayLink addToRunLoop:[NSRunLoop currentRunLoop]
forMode:NSRunLoopCommonModes];
}

View File

@ -177,15 +177,6 @@ CMSampleBufferRef createTestSampleBufferRef() {
invalidFormat = nil;
}
- (void)testCaptureDevices {
OCMStub([self.deviceMock devicesWithMediaType:AVMediaTypeVideo]).andReturn(@[ [NSObject new] ]);
OCMStub([self.deviceMock devicesWithMediaType:AVMediaTypeAudio]).andReturn(@[ [NSObject new] ]);
NSArray *captureDevices = [RTCCameraVideoCapturer captureDevices];
EXPECT_EQ(captureDevices.count, 1u);
}
- (void)testDelegateCallbackNotCalledWhenInvalidBuffer {
// given
CMSampleBufferRef sampleBuffer = nullptr;
@ -504,13 +495,6 @@ TEST(RTCCameraVideoCapturerTests, SupportedFormatsForDevice) {
[test tearDown];
}
TEST(RTCCameraVideoCapturerTests, CaptureDevices) {
RTCCameraVideoCapturerTests *test = [[RTCCameraVideoCapturerTests alloc] init];
[test setup];
[test testCaptureDevices];
[test tearDown];
}
TEST(RTCCameraVideoCapturerTests, DelegateCallbackNotCalledWhenInvalidBuffer) {
RTCCameraVideoCapturerTests *test = [[RTCCameraVideoCapturerTests alloc] init];
[test setup];