commit fcf82de988de57da8f480e903a459bf6fd5e9beb
parent 3718fa3e2f41ad70448a9511526bf0fed24b0b92
Author: rhunk <101876869+rhunk@users.noreply.github.com>
Date: Fri, 3 May 2024 19:06:02 +0200
revert: fix custom camera frame rate
Diffstat:
1 file changed, 0 insertions(+), 10 deletions(-)
diff --git a/core/src/main/kotlin/me/rhunk/snapenhance/core/features/impl/tweaks/CameraTweaks.kt b/core/src/main/kotlin/me/rhunk/snapenhance/core/features/impl/tweaks/CameraTweaks.kt
@@ -18,7 +18,6 @@ import me.rhunk.snapenhance.core.util.hook.hook
import me.rhunk.snapenhance.core.util.ktx.setObjectField
import java.io.ByteArrayOutputStream
import java.nio.ByteBuffer
-import kotlin.math.abs
class CameraTweaks : Feature("Camera Tweaks", loadParams = FeatureLoadParams.ACTIVITY_CREATE_SYNC) {
@@ -92,16 +91,7 @@ class CameraTweaks : Feature("Camera Tweaks", loadParams = FeatureLoadParams.ACT
arrayOf(CameraCharacteristics.LENS_FACING)
) == CameraCharacteristics.LENS_FACING_FRONT
val customFrameRate = (if (isFrontCamera) config.frontCustomFrameRate.getNullable() else config.backCustomFrameRate.getNullable())?.toIntOrNull() ?: return@hook
- val fpsRanges = param.getResult() as? Array<*> ?: return@hook
-
param.setResult(arrayOf(Range(customFrameRate, customFrameRate)))
- if (customFrameRate <= 30) return@hook
-
- val closestMaxFps = fpsRanges.mapNotNull {
- (it as? Range<*>)?.upper?.toString()?.toIntOrNull()
- }.minByOrNull { abs(it - customFrameRate) } ?: return@hook
-
- param.setResult(arrayOf(Range(closestMaxFps, closestMaxFps)))
}
}