From ac637cb6de78782e205e40dc4dc4e4903d62fe90 Mon Sep 17 00:00:00 2001 From: Robert Till Date: Thu, 4 Jun 2020 16:23:33 -0400 Subject: [PATCH] Update refresh rate selection to choose the highest FPS with the widest range in order to improve compatibility across devices and avoid selecting obscenely low fps values. --- .../Android/CameraAccess/CameraController.android.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/ZXing.Net.Mobile/Android/CameraAccess/CameraController.android.cs b/ZXing.Net.Mobile/Android/CameraAccess/CameraController.android.cs index 484be6074..ddcb7f713 100644 --- a/ZXing.Net.Mobile/Android/CameraAccess/CameraController.android.cs +++ b/ZXing.Net.Mobile/Android/CameraAccess/CameraController.android.cs @@ -242,12 +242,11 @@ void ApplyCameraSettings() var selectedFps = parameters.SupportedPreviewFpsRange.FirstOrDefault(); if (selectedFps != null) { - // This will make sure we select a range with the lowest minimum FPS - // and maximum FPS which still has the lowest minimum - // This should help maximize performance / support for hardware + // This will make sure we select a range with the highest maximum fps + // which still has the lowest minimum fps (Widest Range) foreach (var fpsRange in parameters.SupportedPreviewFpsRange) { - if (fpsRange[0] <= selectedFps[0] && fpsRange[1] > selectedFps[1]) + if (fpsRange[1] > selectedFps[1] || fpsRange[1] == selectedFps[1] && fpsRange[0] < selectedFps[0]) selectedFps = fpsRange; } parameters.SetPreviewFpsRange(selectedFps[0], selectedFps[1]);