闵undequeued缓冲器计数超标 [英] Min undequeued buffer count exceeded

查看:1693
本文介绍了闵undequeued缓冲器计数超标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是表面纹理得到preVIEW帧以下列方式。

I am using a SurfaceTexture to get preview frames in the following way.

首先,我设置了preVIEW质地:

First, I set a preview texture:

camera.setPreviewTexture(new SurfaceTexture(0));

然后,就开始preVIEW然后每次上previewFrame 调用之前,我设置回调缓冲是这样的:

Then, just before starting the preview and then each time onPreviewFrame is called, I set the callback buffer like this:

camera.addCallbackBuffer(buffer);
camera.setPreviewCallbackWithBuffer(this);

它的工作原理。有时候,我需要使用图片 camera.takePicture(NULL,NULL,回调),这将导致调用 onPictureTaken 成功。在保存图像。因为我要重新启动preVIEW照片拍摄后,我做以下内容:

It works. Sometimes, I take a picture using camera.takePicture(null, null, callback), which results in calling onPictureTaken successfully. The image is saved. Since I want to restart the preview after the picture has been taken, I do the following:

try
{
    camera.setPreviewTexture(new SurfaceTexture(0));
    camera.startPreview();
}
...

在preVIEW重新启动,一切都似乎是罚款。但是,据报道在我的logcat以下错误,preVIEW已重新启动后,看似:

The preview restarts and everything seems to be fine. But the following error is reported in my Logcat, seemingly after the preview has be restarted:

E/BufferQueue﹕ [unnamed-5682-5] dequeueBuffer: min undequeued buffer count (2) exceeded (dequeued=5 undequeudCount=1)

我缺少的东西吗?我应该在某个时候释放旧的质感?

Am I missing something? Should I release the old texture at some point?

配置:三星Galaxy S4,三星Galaxy S5的Nexus 5,Android KitKat上运行

Configuration: Samsung Galaxy S4, Samsung Galaxy S5, Nexus 5, running on Android KitKat.

编辑:我不知道它阉链接或没有,但经过一段时间,我的应用程序不拍照了,且以下消息在我logcat中连续出现:

I am not sure wether it is linked or not, but after a while, my App does not take pictures anymore and the following messages appear continuously in my Logcat:

E/LocSvc_api_v02(  318): I/---> locClientSendReq line 2332         QMI_LOC_INJECT_SENSOR_DATA_REQ_V02
E/gsiff_dmn(  318): I/loc_api_resp_ind_callback: Received LocAPI Resp ind = 77
E/LocSvc_api_v02(  318): D/loc_sync_process_ind:172]: loc_sync_array not in use 
E/LocSvc_utils_q(  318): D/msg_q_rcv: Received message 0xB899D940 rv = 0
E/gsiff_dmn(  318): I/gsiff_data_task: Handling message type = 4
E/gsiff_dmn(  318): I/gsiff_daemon_inject_sensor_data_handler: Sending Sensor Data to     LocApi. opaque_id = 1226

E/LocSvc_api_v02(  318): I/---> locClientSendReq line 2332 QMI_LOC_INJECT_SENSOR_DATA_REQ_V02
E/gsiff_dmn(  318): I/loc_api_resp_ind_callback: Received LocAPI Resp ind = 77
E/LocSvc_api_v02(  318): D/loc_sync_process_ind:172]: loc_sync_array not in use 
E/mm-camera(  284): [cpp_hardware_process_frame:997] Too many cpp frames dropped!!
E/mm-camera(  284): cpp_thread_handle_process_buf_event:224] get buffer fail. drop frame id:1845 identity:0x20002

W/QCamera2HWI(  269): [CHECK_BUF_LOCK] Too many preview buffer is locked by     surfaceflinger : 29
E/mm-camera(  284): [cpp_hardware_process_frame:997] Too many cpp frames dropped!!
E/mm-camera(  284): cpp_thread_handle_process_buf_event:224] get buffer fail. drop frame     id:1846 identity:0x20002

编辑2:如果,而不是新的表面纹理(0),我总是使用相同的表面纹理(即我一直成为会员),那么一些错误消失和App继续工作。在分钟undequeued缓冲器计数超过错误和太多preVIEW缓冲区由SurfaceFlinger的锁定预警服务。

EDIT 2: If, instead of a new SurfaceTexture(0), I always use the same SurfaceTexture (that I keep as a member), then some errors disappear and the App continues to work. The min undequeued buffer count exceeded error and the Too many preview buffer is locked by surfaceflinger warning stay.

推荐答案

似乎相机持有其缓冲区不是由您的活动离队的东西。你必须找到当你开始一个新的preVIEW清除相机缓冲的方式。

It seems that the camera is holding something in its buffer that is not dequeued by your activity. You have to find the way to clear the camera buffer when you start a new preview.

你可以对摄像头的Andr​​oid类文档中找到:

As you can find in Android documentation about Camera class :

缓冲队列会,如果这种方法[一套previewCallbackWithBuffer]是带一个空的回调,清除设置previewCallback(相机。previewCallback)被调用,或setOneShot previewCallback(摄像头。previewCallback)被调用。

The buffer queue will be cleared if this method [setPreviewCallbackWithBuffer] is called with a null callback, setPreviewCallback(Camera.PreviewCallback) is called, or setOneShotPreviewCallback(Camera.PreviewCallback) is called.

所以,也许这是不够,当你拍张照片,然后reinstatiate它,当您重新启动preVIEW删除您的回调。

So maybe it is enough to remove your callback when you take a picture and then reinstatiate it when you restart your preview.

这篇关于闵undequeued缓冲器计数超标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆