简体   繁体   English

Android Camera2图片显示非常慢

[英]Android Camera2 picture display very slow

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. 我正在使用android camera2组件,但在理解为什么拍摄照片后要花很多时间才能将其显示在另一个活动中时遇到问题。 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. 基本上发生的是,当我拍摄并保存照片时,我打开了一个新的活动,该活动应显示所拍摄的照片,但会在大约5秒钟后显示。 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! 我将不胜感激任何形式的帮助或建议!

It seems you are not using AsyncTask to perform the capture operation. 似乎您没有使用AsyncTask执行捕获操作。 You may refer to this link and check if it helps you. 您可以参考链接并检查它是否对您有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM