Agora Java API Reference for Android
Classes | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
io.agora.mediaplayer.gl.PlayerTextureBufferPool Class Reference

Public Member Functions

VideoFrame.TextureBuffer textureCopy (VideoFrame.TextureBuffer textureBuffer, Runnable bufferReleaseCallback)
 
VideoFrame.TextureBuffer textureCopy (final int textureId, final VideoFrame.TextureBuffer.Type type, final int width, final int height, final Matrix transformMatrix, final Runnable bufferReleaseCallback)
 
void dispose ()
 

Static Public Member Functions

static PlayerTextureBufferPool create (final String threadName, final EglBase.Context sharedContext, final int maxBufferCnt)
 
static PlayerTextureBufferPool createWithinGlThread (String name, int maxBufferCnt, int glPixelFormat, Handler handler, EglBase eglBase, YuvConverter yuvConverter)
 

Static Public Attributes

static final float[] IDENTITY_MATRIX
 

Detailed Description

Texture buffer pool supports copying of a texture to a pre-allocated texture buffer slot in the pool. It should be constructed on a thread with an active EGL context, and all methods must be called with the EGL context active in the calling thread. The function dispose() must be called manually to free the gl resources.

Member Function Documentation

◆ create()

static PlayerTextureBufferPool io.agora.mediaplayer.gl.PlayerTextureBufferPool.create ( final String  threadName,
final EglBase.Context  sharedContext,
final int  maxBufferCnt 
)
static

Construct a new TextureBufferPool sharing OpenGL resources with |sharedContext|. A dedicated thread and handler is created for handling the texture buffer. May return null if EGL fails to initialize a pixel buffer surface and make it current.

◆ createWithinGlThread()

static PlayerTextureBufferPool io.agora.mediaplayer.gl.PlayerTextureBufferPool.createWithinGlThread ( String  name,
int  maxBufferCnt,
int  glPixelFormat,
Handler  handler,
EglBase  eglBase,
YuvConverter  yuvConverter 
)
static

Constructed on a thread that has an active EGL context provided by |eglBase|.

◆ textureCopy()

VideoFrame.TextureBuffer io.agora.mediaplayer.gl.PlayerTextureBufferPool.textureCopy ( VideoFrame.TextureBuffer  textureBuffer,
Runnable  bufferReleaseCallback 
)

Copy the specified texture buffer to one slot in the pool. Must only be called with EGL context active on current thread, and with |textureBuffer| accessible in the same EGL context.

Returns
return null if no buffer slot is available or input buffer is invalid.

◆ dispose()

void io.agora.mediaplayer.gl.PlayerTextureBufferPool.dispose ( )

OpenGL resources are released and the handler is stopped when all the texture buffer has been returned.

Member Data Documentation

◆ IDENTITY_MATRIX

final float [] io.agora.mediaplayer.gl.PlayerTextureBufferPool.IDENTITY_MATRIX
static

Identity matrix for general use. Don't modify or life will get weird.