From 409f5134acfd683f75ca1f8b9da60fc155e1cbf3 Mon Sep 17 00:00:00 2001 From: Jan Herling Date: Mon, 6 Jan 2025 11:48:33 -0800 Subject: [PATCH] Improved custom exposure in AVFLiveVideo Summary: 1. Moved the lock statement above the value statement 2. Increase precision Reviewed By: enpe Differential Revision: D67608722 fbshipit-source-id: 2b28c3307798e69e97616b60dbbee04db4bbf2be --- impl/ocean/media/avfoundation/AVFLiveVideo.mm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/impl/ocean/media/avfoundation/AVFLiveVideo.mm b/impl/ocean/media/avfoundation/AVFLiveVideo.mm index 8ec2d485..6052eca1 100644 --- a/impl/ocean/media/avfoundation/AVFLiveVideo.mm +++ b/impl/ocean/media/avfoundation/AVFLiveVideo.mm @@ -317,10 +317,11 @@ - (void)captureOutput:(AVCaptureOutput *)captureOutput didOutputSampleBuffer:(CM } else { - const CMTime exposureDuration = CMTimeMake(int64_t(duration * 1000.0 + 0.5), 1000); + const CMTime exposureDuration = CMTimeMakeWithSeconds(duration, 1000 * 1000 * 10); - [captureDevice_ setExposureModeCustomWithDuration:exposureDuration ISO:[captureDevice_ ISO] completionHandler:nil]; [captureDevice_ setExposureMode:AVCaptureExposureModeLocked]; + [captureDevice_ setExposureModeCustomWithDuration:exposureDuration ISO:AVCaptureISOCurrent completionHandler:nil]; + result = true; }