public void acquireSurfaceTexture() { mExtTexture = new ExtTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES); mExtTexture.setSize(mWidth, mHeight); mSurfaceTexture = new SurfaceTexture(mExtTexture.getId()); mSurfaceTexture.setDefaultBufferSize(mWidth, mHeight); mSurfaceTexture.setOnFrameAvailableListener(this); synchronized (this) { mHasTexture = true; } }
public void releaseSurfaceTexture() { synchronized (this) { mHasTexture = false; } mExtTexture.recycle(); mExtTexture = null; mSurfaceTexture.release(); mSurfaceTexture = null; }