0

I'm working with the android camera2 component and I have problems with understanding why after taking a picture it takes a lot of time before it will be displayed in another activity. Basically what happens is, that when I take the picture and save it, I open up a new activity that should display the picture taken, which it does but after around 5 sec. Then I get these messages in the log:

12-08 11:39:15.507 21995-22727/com.artlandapp.cameratest       E/CameraDeviceGLThread-0: Received exception on GL render thread: 
                                                                                   java.lang.IllegalStateException: swapBuffers: EGL error: 0x300d
                                                                                      at android.hardware.camera2.legacy.SurfaceTextureRenderer.checkEglError(SurfaceTextureRenderer.java:530)
                                                                                   at android.hardware.camera2.legacy.SurfaceTextureRenderer.swapBuffers(SurfaceTextureRenderer.java:523)
                                                                                   at android.hardware.camera2.legacy.SurfaceTextureRenderer.drawIntoSurfaces(SurfaceTextureRenderer.java:727)
                                                                                   at android.hardware.camera2.legacy.GLThreadManager$1.handleMessage(GLThreadManager.java:105)
                                                                                   at android.os.Handler.dispatchMessage(Handler.java:98)
                                                                                   at android.os.Looper.loop(Looper.java:168)
                                                                                       at android.os.HandlerThread.run(HandlerThread.java:61)
12-08 11:39:15.507 21995-22727/com.artlandapp.cameratest I/CameraDeviceState: Legacy camera service transitioning to state ERROR
12-08 11:39:19.421 21995-22725/com.artlandapp.cameratest E/RequestThread-0: Timed out while waiting for request to complete.
12-08 11:39:19.421 21995-22725/com.artlandapp.cameratest W/CaptureCollector: Preview buffers dropped for request: 0
12-08 11:39:19.421 21995-22725/com.artlandapp.cameratest E/CameraDeviceState: Cannot receive result while in state: 0
12-08 11:39:19.433 21995-22725/com.artlandapp.cameratest E/CameraDeviceState: Cannot receive result while in state: 0
12-08 11:39:19.445 21995-22104/com.artlandapp.cameratest E/BufferQueueProducer: [SurfaceTexture-1-21995-3] queueBuffer: BufferQueue has been abandoned
12-08 11:39:19.446 21995-22006/com.artlandapp.cameratest E/BufferQueueProducer: [SurfaceTexture-1-21995-3] dequeueBuffer: BufferQueue has been abandoned
12-08 11:39:19.471 21995-22007/com.artlandapp.cameratest E/BufferQueueProducer: [SurfaceTexture-1-21995-3] cancelBuffer: BufferQueue has been abandoned
12-08 11:39:19.471 21995-22104/com.artlandapp.cameratest E/BufferQueueProducer: [SurfaceTexture-1-21995-3] cancelBuffer: BufferQueue has been abandoned
12-08 11:39:19.471 21995-22006/com.artlandapp.cameratest E/BufferQueueProducer: [SurfaceTexture-1-21995-3] cancelBuffer: BufferQueue has been abandoned
12-08 11:39:19.472 21995-22007/com.artlandapp.cameratest E/BufferQueueProducer: [SurfaceTexture-1-21995-3] cancelBuffer: BufferQueue has been abandoned
12-08 11:39:19.612 21995-21995/com.artlandapp.cameratest I/Choreographer: Skipped 245 frames!  The application may be doing too much work on its main thread.

I would highly appreciate any type of help or suggestion!

Austie
  • 67
  • 7

1 Answers1

-1

It seems you are not using AsyncTask to perform the capture operation. You may refer to this link and check if it helps you.

Community
  • 1
  • 1
Shubham
  • 165
  • 2
  • 11
  • Just to clarify - you suggest to wrap the image display method into an AsyncTask? When I take the image, I'm creating a new Intent to final activity that is supposed to only display the photo which has been taken. I am passing the Uri to the photo in the intent extras and then using Glide library to load it into the imageView. Therefore, loading with Glide should be done in the AsyncTask according to you? I will try that – Austie Dec 08 '16 at 12:26
  • You can try that and without actually looking into your code, I am not in a state to suggest you more than this. – Shubham Dec 08 '16 at 12:52
  • such question such answer.. – Nick Kovalsky Jul 03 '23 at 16:22