From 00bef6f6b080445764bd08392159dae2a36067ea Mon Sep 17 00:00:00 2001 From: zhaoyuan <1044523901@qq.com> Date: Thu, 4 Aug 2016 15:36:31 +0800 Subject: [PATCH] fix bug on an iPhone 4S --- LFLiveKit/Vendor/GPUImage/GPUImageVideoCamera.m | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/LFLiveKit/Vendor/GPUImage/GPUImageVideoCamera.m b/LFLiveKit/Vendor/GPUImage/GPUImageVideoCamera.m index 18aa60c3..edc29d6a 100644 --- a/LFLiveKit/Vendor/GPUImage/GPUImageVideoCamera.m +++ b/LFLiveKit/Vendor/GPUImage/GPUImageVideoCamera.m @@ -216,7 +216,12 @@ - (id)initWithSessionPreset:(NSString *)sessionPreset cameraPosition:(AVCaptureD } _captureSessionPreset = sessionPreset; - [_captureSession setSessionPreset:_captureSessionPreset]; + // iPhone 4S 不支持720p以上的,4S 不判断会崩溃 + if ([_captureSession canSetSessionPreset:_captureSessionPreset]) { + [_captureSession setSessionPreset:_captureSessionPreset]; + }else{ + [_captureSession setSessionPreset:AVCaptureSessionPreset640x480]; + } // This will let you get 60 FPS video from the 720p preset on an iPhone 4S, but only that device and that preset // AVCaptureConnection *conn = [videoOutput connectionWithMediaType:AVMediaTypeVideo];