我该怎么办时,BufferQueue已被放弃? [英] What can I do when the BufferQueue has been abandoned?

查看:5178
本文介绍了我该怎么办时,BufferQueue已被放弃?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用一个纹理视图来显示相机在我的Andr​​oid应用程序的preVIEW。我注意到,不过,是每一个我的应用程序被暂停的时候,我收到此错误:

  03-18 18:23:44.315:W / BufferQueue(19582):未命名-19582-20】cancelBuffer:BufferQueue已被放弃!
 

谁能告诉我这是怎么回事?当我的应用程序将暂停所有我做的是取消初始化一切都像这样,从 onSurfaceTextureDestroyed()

 公共布尔onSurfaceTextureDestroyed(表面表面纹理){
    mCamera.set previewCallback(空);
    mCamera.stop preVIEW();
    mCamera.release();
    返回true;
}
 

解决方案

你在做什么本质是什么的写在的 TextureView文档,所以它应该工作。

该错误消息表示,生产者的 BufferQueue (摄像机)的侧抢下一个缓冲区,并且现在可以通过<$试图取消抓住它( C $ C> cancelBuffer())。但是,消费者方(表面纹理)已经消失。因为消费者方拥有的队列中, BufferQueue 被视为放弃,并没有进一步的行动是可能的。

这听起来像它只是一个时间问题 - 生产商正试图在表面纹理已被破坏后做业务。这是没有意义的,因为你关上了制片人倒在 onSurfaceTextureDestroyed(),和ST没有得到释放,除非及直至该回调返回。 (这可能是有趣的,在回调方法的开头和结尾添加日志消息,看看是否抛弃抱怨之前或之后,它们会发生。使用的logcat -v threadtime 看线程ID。)

所以,我真的不知道为什么会这样。好消息是,它不应对你的应用程序影响 - 生产者将正确判断,消费者已经消失,而会抱怨,但不会崩溃。所以这是嘈杂,但不是explody。

出于好奇,你从你的设备看到这样的消息,如果你运行实况摄像头(TextureView),在 Grafika ?这项活动是直出的 TextureView 的文档,我看不出有任何的抱怨时,我在我的设备上运行。

(约和表面纹理BufferQueue的更多信息,可以发现这里 。)

I am using a texture view to show the preview of the camera in my android app. What I noticed, however, is that every time my app gets paused, I am getting this error:

03-18 18:23:44.315: W/BufferQueue(19582): [unnamed-19582-20] cancelBuffer: BufferQueue has been abandoned!

Can someone tell me what's going on here? When my app pauses all I do is deinitialize everything like this from onSurfaceTextureDestroyed()

 public boolean onSurfaceTextureDestroyed(SurfaceTexture surface) {
    mCamera.setPreviewCallback(null);
    mCamera.stopPreview();
    mCamera.release();
    return true;
}

What you're doing is essentially what's written in the TextureView docs, so it should work.

The error message means that the "producer" side of the BufferQueue (the camera) grabbed a buffer, and is now trying to un-grab it (via cancelBuffer()). However, the "consumer" side (the SurfaceTexture) has gone away. Because the "consumer" side owns the queue, the BufferQueue is considered abandoned, and no further operations are possible.

This sounds like it's just a timing issue -- the producer is trying to do operations after the SurfaceTexture has been destroyed. Which doesn't make sense, because you're shutting the producer down in onSurfaceTextureDestroyed(), and the ST doesn't get released unless and until that callback returns true. (It might be interesting to add log messages at the start and end of the callback method, and see if the "abandoned" complaint happens before or after them. Use logcat -v threadtime to see the thread IDs.)

So I'm not really sure why this is happening. The good news is that it should not adversely affect your application -- the producer will correctly determine that the consumer has gone away, and will complain but not crash. So it's noisy but not explody.

Out of curiosity, do you see messages like this from your device if you run "Live camera (TextureView)" in Grafika? That activity is straight out of the TextureView docs, and I don't see any complaints when I run it on my device.

(Additional information about SurfaceTexture and BufferQueue can be found here.)

这篇关于我该怎么办时,BufferQueue已被放弃?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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