SurfaceEglRenderer

Display the video stream on a Surface. renderFrame() is asynchronous to avoid blocking the calling thread. This class is thread safe and handles access from potentially three different threads: Interaction from the main app in init, release and setMirror. Interaction from C++ rtc::VideoSinkInterface in renderFrame. Interaction from SurfaceHolder lifecycle in surfaceCreated, surfaceChanged, and surfaceDestroyed.

Constructors

Link copied to clipboard
constructor(name: String)
In order to render something, you must first call init().

Functions

Link copied to clipboard
Link copied to clipboard
open fun init(sharedContext: EglBase.Context, configAttributes: Array<Int>, drawer: RendererCommon.GlDrawer)
Same as above with usePresentationTimeStamp set to false.
open fun init(sharedContext: EglBase.Context, rendererEvents: RendererCommon.RendererEvents, configAttributes: Array<Int>, drawer: RendererCommon.GlDrawer)
Initialize this class, sharing resources with `sharedContext`.
Link copied to clipboard
open fun onFrame(frame: VideoFrame)
Implementations should call frame.retain() if they need to hold a reference to the frame after this function returns.
Link copied to clipboard
open fun pauseVideo()
Link copied to clipboard
open fun setFpsReduction(fps: Float)
Limit render framerate.
Link copied to clipboard
open fun surfaceChanged(holder: SurfaceHolder, format: Int, width: Int, height: Int)
Link copied to clipboard
open fun surfaceCreated(holder: SurfaceHolder)
Link copied to clipboard

Inherited functions

Link copied to clipboard
open fun addFrameListener(listener: EglRenderer.FrameListener, scale: Float, @Nullable drawerParam: RendererCommon.GlDrawer, applyFpsReduction: Boolean)
Register a callback to be invoked when a new video frame has been received.
Link copied to clipboard
open fun clearImage()
Post a task to clear the surface to a transparent uniform color.
open fun clearImage(r: Float, g: Float, b: Float, a: Float)
Post a task to clear the surface to a specific color.
Link copied to clipboard
open fun createEglSurface(surfaceTexture: SurfaceTexture)
open fun createEglSurface(surface: Surface)
Link copied to clipboard
open fun init(eglThread: EglThread, drawer: RendererCommon.GlDrawer, usePresentationTimeStamp: Boolean)

open fun init(@Nullable sharedContext: EglBase.Context, configAttributes: Array<Int>, drawer: RendererCommon.GlDrawer, usePresentationTimeStamp: Boolean)
Initialize this class, sharing resources with `sharedContext`.
Link copied to clipboard
open fun printStackTrace()
Link copied to clipboard
open fun release()
Block until any pending frame is returned and all GL resources released, even if an interrupt occurs.
Link copied to clipboard
open fun releaseEglSurface(completionCallback: Runnable)
Release EGL surface.
Link copied to clipboard
Remove any pending callback that was added with addFrameListener.
Link copied to clipboard
Can be set in order to be notified about errors encountered during rendering.
Link copied to clipboard
open fun setLayoutAspectRatio(layoutAspectRatio: Float)
Set layout aspect ratio.
Link copied to clipboard
open fun setMirror(mirror: Boolean)
Set if the video stream should be mirrored horizontally or not.
Link copied to clipboard
open fun setMirrorVertically(mirrorVertically: Boolean)
Set if the video stream should be mirrored vertically or not.