In webRTC, in SurfaceTextureHelper
the surfaceTexture
(with handle the creation/update of the openGL texture) is created inside a background thread:
final HandlerThread thread = new HandlerThread(threadName);
thread.start();
an inside this newly created thread we do
oesTextureId = GlUtil.generateTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES);
surfaceTexture = new SurfaceTexture(oesTextureId);
The problem is that the OnFrameAvailableListener
of the surfacetexture
will be called in the thread where the surfacetexture
was created (seam logical). My problem is that all the painting of my app are done in the main UI thread (and I can not change this), so here I end up by something where the texture will be updated in background thread (texture of GL_TEXTURE_EXTERNAL_OES
) but will be print on the foreground thread.
Is it possible that it's will work ? textureID never change, just the content of the texture get updated in the bakcground thread