FreeDcam icon indicating copy to clipboard operation
FreeDcam copied to clipboard

Frequent crashes after taking a picture

Open ScanuNicco opened this issue 1 year ago • 1 comments

Describe the bug FreeDcam works as expected until I try to take a picture, at which point the app crashes. The picture is saved to the gallery and can be viewed once the app is re-opened. This happens about 70% of the time.

To Reproduce Steps to reproduce the behavior:

  1. Open FreeDcam
  2. Take a picture

Expected behavior FreeDcam takes a picture without crashing.

Smartphone

  • Device: OnePlus 11 5G
  • OS: LineageOS 20 (No Gapps)
  • Version: 4.3.82

Additional context I found the following error in logcat during a crash

FATAL EXCEPTION: CaptureSessionHandler
Process: troop.com.freedcam, PID: 17051
java.lang.IllegalArgumentException: elements[0] is out of range of [1.000000, 340282346638528860000000000000000000000.000000] (too low)
	at com.android.internal.util.Preconditions.checkArrayElementsInRange(Preconditions.java:726)
	at android.hardware.camera2.params.LensShadingMap.<init>(LensShadingMap.java:81)
	at android.hardware.camera2.impl.CameraMetadataNative.getLensShadingMap(CameraMetadataNative.java:1044)
	at android.hardware.camera2.impl.CameraMetadataNative.-$$Nest$mgetLensShadingMap(Unknown Source:0)
	at android.hardware.camera2.impl.CameraMetadataNative$21.getValue(CameraMetadataNative.java:794)
	at android.hardware.camera2.impl.CameraMetadataNative.get(CameraMetadataNative.java:473)
	at android.hardware.camera2.impl.CameraMetadataNative.get(CameraMetadataNative.java:451)
	at android.hardware.camera2.CaptureResult.getProtected(CaptureResult.java:331)
	at android.hardware.camera2.CaptureResult.getProtected(CaptureResult.java:54)
	at android.hardware.camera2.CameraMetadata.getKeys(CameraMetadata.java:199)
	at android.hardware.camera2.CameraMetadata.getKeys(CameraMetadata.java:146)
	at android.hardware.camera2.CaptureResult.getKeys(CaptureResult.java:364)
	at freed.cam.apis.camera2.CameraValuesChangedCaptureCallback.processQcomAEValues(CameraValuesChangedCaptureCallback.java:450)
	at freed.cam.apis.camera2.CameraValuesChangedCaptureCallback.onCaptureCompleted(CameraValuesChangedCaptureCallback.java:219)
	at android.hardware.camera2.impl.CameraCaptureSessionImpl$1.lambda$onCaptureCompleted$4$android-hardware-camera2-impl-CameraCaptureSessionImpl$1(CameraCaptureSessionImpl.java:709)
	at android.hardware.camera2.impl.CameraCaptureSessionImpl$1$$ExternalSyntheticLambda1.run(Unknown Source:8)
	at android.os.Handler.handleCallback(Handler.java:942)
	at android.os.Handler.dispatchMessage(Handler.java:99)
	at android.os.Looper.loopOnce(Looper.java:201)
	at android.os.Looper.loop(Looper.java:288)
	at android.os.HandlerThread.run(HandlerThread.java:67)

ScanuNicco avatar Jul 29 '23 21:07 ScanuNicco

Hi. Looks not like its a problem from freedcam. Looks more like a problem from lineage and their camera hal.

Thats the part where it crash. https://github.com/KillerInk/FreeDcam/blob/60682b2a086988f291725f8c9866a41350abda91/app/src/main/java/freed/cam/apis/camera2/CameraValuesChangedCaptureCallback.java#L450

a possible workaround would be to catch the IllegalArgumentException. but no idea if the cam dies anyway, also if the exception get catched

KillerInk avatar Jul 30 '23 13:07 KillerInk