webkit  2cdf99a9e3038c7e01b3c37e8ad903ecbe5eecf1
https://github.com/WebKit/webkit
Classes | Public Member Functions | Static Public Member Functions | List of all members
org.webrtc.SurfaceTextureHelper Class Reference

Classes

interface  OnTextureFrameAvailableListener
 

Public Member Functions

void startListening (final OnTextureFrameAvailableListener listener)
 
void stopListening ()
 
SurfaceTexture getSurfaceTexture ()
 
Handler getHandler ()
 
void returnTextureFrame ()
 
boolean isTextureInUse ()
 
void dispose ()
 
void textureToYUV (final ByteBuffer buf, final int width, final int height, final int stride, final int textureId, final float[] transformMatrix)
 

Static Public Member Functions

static SurfaceTextureHelper create (final String threadName, final EglBase.Context sharedContext)
 

Detailed Description

Helper class to create and synchronize access to a SurfaceTexture. The caller will get notified of new frames in onTextureFrameAvailable(), and should call returnTextureFrame() when done with the frame. Only one texture frame can be in flight at once, so returnTextureFrame() must be called in order to receive a new frame. Call stopListening() to stop receiveing new frames. Call dispose to release all resources once the texture frame is returned. Note that there is a C++ counter part of this class that optionally can be used. It is used for wrapping texture frames into webrtc::VideoFrames and also handles calling returnTextureFrame() when the webrtc::VideoFrame is no longer used.

Member Function Documentation

◆ create()

static SurfaceTextureHelper org.webrtc.SurfaceTextureHelper.create ( final String  threadName,
final EglBase.Context  sharedContext 
)
inlinestatic

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

◆ dispose()

void org.webrtc.SurfaceTextureHelper.dispose ( )
inline

Call disconnect() to stop receiving frames. OpenGL resources are released and the handler is stopped when the texture frame has been returned by a call to returnTextureFrame(). You are guaranteed to not receive any more onTextureFrameAvailable() after this function returns.

◆ getHandler()

Handler org.webrtc.SurfaceTextureHelper.getHandler ( )
inline

Retrieve the handler that calls onTextureFrameAvailable(). This handler is valid until dispose() is called.

◆ getSurfaceTexture()

SurfaceTexture org.webrtc.SurfaceTextureHelper.getSurfaceTexture ( )
inline

Retrieve the underlying SurfaceTexture. The SurfaceTexture should be passed in to a video producer such as a camera or decoder.

◆ isTextureInUse()

boolean org.webrtc.SurfaceTextureHelper.isTextureInUse ( )
inline

◆ returnTextureFrame()

void org.webrtc.SurfaceTextureHelper.returnTextureFrame ( )
inline

Call this function to signal that you are done with the frame received in onTextureFrameAvailable(). Only one texture frame can be in flight at once, so you must call this function in order to receive a new frame.

◆ startListening()

void org.webrtc.SurfaceTextureHelper.startListening ( final OnTextureFrameAvailableListener  listener)
inline

Start to stream textures to the given |listener|. If you need to change listener, you need to call stopListening() first.

◆ stopListening()

void org.webrtc.SurfaceTextureHelper.stopListening ( )
inline

Stop listening. The listener set in startListening() is guaranteded to not receive any more onTextureFrameAvailable() callbacks after this function returns.

◆ textureToYUV()

void org.webrtc.SurfaceTextureHelper.textureToYUV ( final ByteBuffer  buf,
final int  width,
final int  height,
final int  stride,
final int  textureId,
final float []  transformMatrix 
)
inline

The documentation for this class was generated from the following file: