mirror of
https://github.com/DrKLO/Telegram.git
synced 2024-12-22 14:35:03 +01:00
feat: add custom fps range
This commit is contained in:
parent
b35feb64ad
commit
69d6af9b58
1 changed files with 18 additions and 1 deletions
|
@ -477,7 +477,8 @@ public class Camera2Session {
|
|||
}
|
||||
|
||||
if (recordingVideo) {
|
||||
captureRequestBuilder.set(CaptureRequest.CONTROL_AE_TARGET_FPS_RANGE, new Range<Integer>(30, 60));
|
||||
Range<Integer> targetFpsRange = selectOptimalFpsRange();
|
||||
captureRequestBuilder.set(CaptureRequest.CONTROL_AE_TARGET_FPS_RANGE, targetFpsRange);
|
||||
captureRequestBuilder.set(CaptureRequest.CONTROL_CAPTURE_INTENT, CaptureRequest.CONTROL_CAPTURE_INTENT_VIDEO_RECORD);
|
||||
|
||||
isStabilizationAvailable(captureRequestBuilder);
|
||||
|
@ -505,6 +506,22 @@ public class Camera2Session {
|
|||
}
|
||||
}
|
||||
|
||||
private Range<Integer> selectOptimalFpsRange() {
|
||||
Range<Integer>[] fpsRange = cameraCharacteristics.get(CameraCharacteristics.CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES);
|
||||
Range<Integer> optimalRange = new Range<>(30, 30);
|
||||
|
||||
assert fpsRange != null;
|
||||
for (Range<Integer> range : fpsRange) {
|
||||
if (range.getLower() <= 30 && range.getUpper() >= 30) {
|
||||
optimalRange = range;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
FileLog.d("Camera2Session selected FPS range: " + optimalRange);
|
||||
return optimalRange;
|
||||
}
|
||||
|
||||
private void isStabilizationAvailable(CaptureRequest.Builder builder) {
|
||||
if (setModeIfAvailable(
|
||||
CameraCharacteristics.LENS_INFO_AVAILABLE_OPTICAL_STABILIZATION,
|
||||
|
|
Loading…
Reference in a new issue