CAPTURE_MODE_ZERO_SHUTTER_LAG detection? Fallback?

36 views
Skip to first unread message

Ultima Ratio

unread,
10:28 AM (6 hours ago) 10:28 AM
to Android CameraX Discussion Group
Heyo!


Well, turns out, thats not really working.


For me on a Pixel Tablet (2023) no lens has isZslSupported = true.

Yet I can make a photo without any issue with the tablet with  captureMode = CAPTURE_MODE_ZERO_SHUTTER_LAG

Pixel 7A same. No lens has isZslSupported = true, but it works.

So I cannot use isZslSupported for anything.


Also the fallback fails horrible on my Xiaomi Mi6:

Unable to configure camera Camera@9b92dd8[id=0]
                                                                                                    java.lang.IllegalArgumentException: createDefaultRequest - invalid templateId specified
                                                                                                    at android.hardware.camera2.CameraManager.throwAsPublicException(CameraManager.java:723)
                                                                                                    at android.hardware.camera2.impl.ICameraDeviceUserWrapper.createDefaultRequest(ICameraDeviceUserWrapper.java:161)
                                                                                                    at android.hardware.camera2.impl.CameraDeviceImpl.createCaptureRequest(CameraDeviceImpl.java:777)
                                                                                                    at androidx.camera.camera2.internal.Camera2CaptureRequestBuilder.buildWithoutTarget(Camera2CaptureRequestBuilder.java:236)
                                                                                                    at androidx.camera.camera2.internal.CaptureSession.openCaptureSession(CaptureSession.java:341)
                                                                                                    at androidx.camera.camera2.internal.CaptureSession.lambda$open$0$androidx-camera-camera2-internal-CaptureSession(CaptureSession.java:222)
                                                                                                    at androidx.camera.camera2.internal.CaptureSession$$ExternalSyntheticLambda3.apply(Unknown Source:8)
                                                                                                    at androidx.camera.core.impl.utils.futures.ChainingListenableFuture.run(ChainingListenableFuture.java:201)
                                                                                                    at androidx.camera.core.impl.utils.executor.SequentialExecutor$QueueWorker.workOnQueue(SequentialExecutor.java:229)
                                                                                                    at androidx.camera.core.impl.utils.executor.SequentialExecutor$QueueWorker.run(SequentialExecutor.java:171)
                                                                                                    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
                                                                                                    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
                                                                                                    at java.lang.Thread.run(Thread.java:764)
                                                                                                    Caused by: android.os.ServiceSpecificException: createDefaultRequest - invalid templateId specified (code 3)
                                                                                                    at android.hardware.camera2.legacy.CameraDeviceUserShim.createDefaultRequest(CameraDeviceUserShim.java:635)
                                                                                                    at android.hardware.camera2.impl.ICameraDeviceUserWrapper.createDefaultRequest(ICameraDeviceUserWrapper.java:159)
                                                                                                    at android.hardware.camera2.impl.CameraDeviceImpl.createCaptureRequest(CameraDeviceImpl.java:777) 
                                                                                                    at androidx.camera.camera2.internal.Camera2CaptureRequestBuilder.buildWithoutTarget(Camera2CaptureRequestBuilder.java:236) 
                                                                                                    at androidx.camera.camera2.internal.CaptureSession.openCaptureSession(CaptureSession.java:341) 
                                                                                                    at androidx.camera.camera2.internal.CaptureSession.lambda$open$0$androidx-camera-camera2-internal-CaptureSession(CaptureSession.java:222) 
                                                                                                    at androidx.camera.camera2.internal.CaptureSession$$ExternalSyntheticLambda3.apply(Unknown Source:8) 
                                                                                                    at androidx.camera.core.impl.utils.futures.ChainingListenableFuture.run(ChainingListenableFuture.java:201) 
                                                                                                    at androidx.camera.core.impl.utils.executor.SequentialExecutor$QueueWorker.workOnQueue(SequentialExecutor.java:229) 
                                                                                                    at androidx.camera.core.impl.utils.executor.SequentialExecutor$QueueWorker.run(SequentialExecutor.java:171) 
                                                                                                    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 
                                                                                                    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
                                                                                                    at java.lang.Thread.run(Thread.java:764) 


Using 1.4.0-beta02

So, how should I detect it on phones, where its actually not working?

BR

Kailiang Chen

unread,
11:27 AM (5 hours ago) 11:27 AM
to Android CameraX Discussion Group, beh...@gmail.com
Hi,

Thanks for reporting the issue.
captureMode = CAPTURE_MODE_ZERO_SHUTTER_LAG will fallback to regular capture if this device is not supporting ZSL, so it's expected that the Pixel Tablet still works.

We will check why Xiaomi Mi6 fails with the template type.

Best,
Kailiang

Ultima Ratio

unread,
12:38 PM (4 hours ago) 12:38 PM
to Android CameraX Discussion Group, kail...@google.com, Ultima Ratio
Hi.

Thanks. Didnt want to reply private back.. 

The captureMode of the imageCapture never gets changed, when I change it to 2. So even if the fallback internaly changes it, its not doing it for the imageCapture thing. So no clue for me, how to actually find it, in what captureMode the image was taken.


But another question: Is there a way to detect, if the camera is closing again? Thats the only thing I could add a detection mechanic to it, because the camera from the cameraProvider is not null, as it fails later on and not when sticking it together. And as there is no stacktrace pointing back to my source, its really hard to actually catch the error.

The state on the preview is forever idle. But its also idle for others, for a short time.



If I cannot auto detect it, I will have to give an option to the user, to actually change it (fast, good quality or ZSL).


BR

Kailiang Chen

unread,
12:46 PM (4 hours ago) 12:46 PM
to Ultima Ratio, Android CameraX Discussion Group
Hi,

> how to actually find it, in what captureMode the image was taken.
We can add logging to print out which captureMode is being used.

> Is there a way to detect, if the camera is closing again?
You could observe on the CameraState and get camera state (e.g. CLOSED)

To change the capture mode, I think you need to rebind the ImageCapture use case.

Kailiang Chen

unread,
1:00 PM (3 hours ago) 1:00 PM
to Ultima Ratio, Android CameraX Discussion Group
For the failure on Xiaomi Mi6, I have a hypothesis that TEMPLATE_ZERO_SHUTTER_LAG is being used but the device is not guaranteed to work with this template type.
I'll verify my hypothesis and apply the fix if this is the root cause.
Reply all
Reply to author
Forward
0 new messages