我有一个标准的 GLSurfaceView 类:
public class TestSurfaceView extends GLSurfaceView {
public MainRenderer mRenderer;
public GStreamerSurfaceView(Context context) {
super(context);
setEGLContextClientVersion(2);
mRenderer = new MainRenderer(context);
setRenderer(mRenderer);
setRenderMode(GLSurfaceView.RENDERMODE_CONTINUOUSLY);
}
}
我有一个实现 GLSurfaceView.Renderer 的 Renderer 类:
public class MainRenderer implements GLSurfaceView.Renderer {
private int[] hTex;
private SurfaceTexture mSTexture;
private Context context;
MainRenderer(Context c) {
context = c;
}
public void onSurfaceCreated(GL10 unused, EGLConfig config) {
}
public void onDrawFrame(GL10 unused) {
}
public void onSurfaceChanged(GL10 unused, int width, int height) {
}
public void onSurfaceCreated(GL10 arg0, javax.microedition.khronos.egl.EGLConfig arg1) {
}
}
在一个单独的 JNI 线程中,我将一些视频数据(YUV 格式)上传到 OpenGLES 纹理。我在 Java 中收到新纹理可用的通知,并且我有相应的纹理 ID。
如何以最小的性能影响在 Renderer 类中显示此纹理的内容?