Closed paulfreeman closed 2 years ago
@paulfreeman , thanks for brining this to my attention. I'll definitely check it out and work out a solution.
@paulfreeman - tried to reproduce the crash you saw, but did not see it happening.
Care to share some more details on how you managed to get it?
The device you used and it's API level.
Closing issue due to inactivity.
The same was happening with me while started the session recording
Process: com.tomerpacific.camera2api, PID: 10012 java.lang.IllegalArgumentException: CaptureRequest contains unconfigured Input/Output Surface! at android.hardware.camera2.CaptureRequest.convertSurfaceToStreamId(CaptureRequest.java:765) at android.hardware.camera2.impl.CameraDeviceImpl.submitCaptureRequest(CameraDeviceImpl.java:1268) at android.hardware.camera2.impl.CameraDeviceImpl.capture(CameraDeviceImpl.java:1105) at android.hardware.camera2.impl.CameraCaptureSessionImpl.capture(CameraCaptureSessionImpl.java:189) at com.tomerpacific.camera2api.MainActivity.takePhoto(MainActivity.kt:177) at com.tomerpacific.camera2api.MainActivity.onCreate$lambda-2$lambda-1(MainActivity.kt:72) at com.tomerpacific.camera2api.MainActivity.$r8$lambda$5SYaZ2RZ9y5DG99ZvHbub8_t9LE(Unknown Source:0) at com.tomerpacific.camera2api.MainActivity$$ExternalSyntheticLambda0.onClick(Unknown Source:2) at android.view.View.performClick(View.java:7537) at android.view.View.performClickInternal(View.java:7514) at android.view.View.-$$Nest$mperformClickInternal(Unknown Source:0) at android.view.View$PerformClick.run(View.java:29555) at android.os.Handler.handleCallback(Handler.java:984) at android.os.Handler.dispatchMessage(Handler.java:104) at android.os.Looper.loopOnce(Looper.java:238) at android.os.Looper.loop(Looper.java:357) at android.app.ActivityThread.main(ActivityThread.java:8194) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:957)
I found your article to be a useful overview and your sample code a good stripped down sample for experimentation. Thank you for the clear description of the API.
However there seems to be a problem with the ImageReader. As it is, providing it to createCaptureSession is causing a crash on line 244
cameraDevice.createCaptureSession(listOf(previewSurface, imageReader.surface), captureStateCallback, null)
The following error is logged
W/CameraDevice-JV-0: Stream configuration failed due to: endConfigure:593: Camera 0: Unsupported set of inputs/outputs provided
changing this by removing the imageReader.surface causes the preview to display
cameraDevice.createCaptureSession(listOf(previewSurface), captureStateCallback, null)
With this latter change selecting 'takePhoto' will crash for a similar reason.