Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

I get crash in some devices when i add overlay effect

102 views
Skip to first unread message
Assigned to xi...@google.com by charco...@google.com

Bhushan Bhadane

unread,
Jan 9, 2025, 6:41:51 AMJan 9
to Android CameraX Discussion Group
Exception java.lang.IllegalStateException: Unable to update texture contents (see logcat for details)
  at android.graphics.SurfaceTexture.nativeUpdateTexImage
  at android.graphics.SurfaceTexture.updateTexImage (SurfaceTexture.java:249)
  at androidx.camera.effects.internal.SurfaceProcessorImpl.blockAndPostOverlay (SurfaceProcessorImpl.java:411)
  at androidx.camera.effects.internal.SurfaceProcessorImpl.drawOverlay (SurfaceProcessorImpl.java:385)
  at androidx.camera.effects.internal.SurfaceProcessorImpl.onFrameAvailable (SurfaceProcessorImpl.java:194)
  at android.graphics.SurfaceTexture$1.handleMessage (SurfaceTexture.java:212)
  at android.os.Handler.dispatchMessage (Handler.java:106)
  at android.os.Looper.loopOnce (Looper.java:233)
  at android.os.Looper.loop (Looper.java:334)
  at android.app.ActivityThread.main (ActivityThread.java:8396)
  at java.lang.reflect.Method.invoke
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:582)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1068)


here is my code block, please help me i am struggling from many days

cameraProvider!!.unbindAll()
camera = cameraProvider!!.bindToLifecycle(
lifecycleOwner,
extensionSelector ?: lensFacing,
UseCaseGroup.Builder()
.addUseCase(preview!!)
.addUseCase(imageCapture!!)
.addUseCase(videoCapture!!)
.addEffect(overlayEffect)
.setViewPort(cameraView.viewFinder.viewPort!!)
.build()
)

Xi Zhang

unread,
Jan 21, 2025, 12:30:46 PMJan 21
to Android CameraX Discussion Group, b...@susampinfotech.com

Thank you for reporting the issue. Does it happen every time? Do you update the texture from the same GL thread where the texture is created? It would be helpful if you could provide the full logcat.

Bhushan Bhadane

unread,
Feb 6, 2025, 11:11:55 PMFeb 6
to Android CameraX Discussion Group, xi...@google.com, Bhushan Bhadane
Thanks to reply, Issue is solved and it working good now. I found that it is because of i unbind and bind camera multiple times. so i manage proper lifecycle and then issue is resolved.
Reply all
Reply to author
Forward
0 new messages