首页 > 解决方案 > ReleaseTexImage 在 Android 9 中崩溃

问题描述

我有一个扩展的自定义类TextureView。在这TextureView我有一个surfaceTexturemSurfaceTexture。这是一个单缓冲表面。

根据android文档,这里

在单缓冲模式下,应用程序负责序列化对图像内容缓冲区的访问。每次要更新图像内容时,必须在图像内容生产者获得缓冲区所有权之前调用 releaseTexImage() 方法。

因此,每当图像制作者获得所有权时,我都会调用它。它在 Android 10 上运行良好,但在 android 9 上出现以下错误:

11-05 19:05:53.960 23442 24509 E AndroidRuntime: java.lang.IllegalStateException: Unable to release texture contents (see logcat for details)
11-05 19:05:53.960 23442 24509 E AndroidRuntime:    at android.graphics.SurfaceTexture.nativeReleaseTexImage(Native Method)
11-05 19:05:53.960 23442 24509 E AndroidRuntime:    at android.graphics.SurfaceTexture.releaseTexImage(SurfaceTexture.java:252)

我在打电话ANativeWindow_fromSurface。使用它之后,我还应该做一些其他的事情,比如发布 nativewindow 等吗?

关于为什么会发生这种情况以及其他任何人有类似问题的任何想法?

标签: androidgraphicstextureviewandroid-textureviewandroid-graphics

解决方案


推荐阅读