RedApparat / Fotoapparat

Making Camera for Android more friendly. 📸
Apache License 2.0
3.81k stars 405 forks source link

Low Frame Rate for both CameraView preview and Frame Processing #404

Open jeffreyfjohnson opened 4 years ago

jeffreyfjohnson commented 4 years ago

What are you trying to achieve or the steps to reproduce?

On my Moto G7, as well as other Android devices that I've tested, Fotoapparat has a low frame rate, as evidenced by two things. The CameraView that previews the frames the camera is capturing is choppy, and a println that I added in my FrameProcessor shows the callback is only invoked 2-4 times every second.

By contrast, I did a quick implementation using the Android CameraX framework, and the camera preview was very smooth, and the equivalent of the frame processor was getting 20-30 callbacks per second. Same exact device, same exact use case.

How did you initialize FA?

 private val camera = Fotoapparat(
        context = context,
        view = cameraView,
        lensPosition = back(),
        scaleType = ScaleType.CenterInside,
        cameraConfiguration = CameraConfiguration(frameProcessor = frameProcessor),
        cameraErrorCallback = { error ->
            logError("Camera error", error)
        }
    )

Are there any knobs I can tweak in order to get better performance out of Fotoapparat. It is clear that my device is capable of better performance, it can get that out of the CameraX framework.

Context: