Package io.agora.rtc2.internal.gdp
Class EglCore
java.lang.Object
io.agora.rtc2.internal.gdp.EglCore
Core EGL state (display, context, config).
The EGLContext must only be attached to one thread at a time. This class is not thread-safe.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intConstructor flag: surface must be recordable.static final intConstructor flag: ask for GLES3, fall back to GLES2 if not available. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcheckEglError(String msg) Checks for EGL errors.EGLSurfacecreateOffscreenSurface(int width, int height) Creates an EGL surface associated with an offscreen buffer.EGLConfiggetConfig(int flags, int version) Finds a suitable EGLConfig.voidmakeCurrent(EGLSurface eglSurface) Makes our EGL context current, using the supplied surface for both "draw" and "read".voidrelease()Discards all resources held by this class, notably the EGL context.voidreleaseSurface(EGLSurface eglSurface) Destroys the specified surface.static voidsetMockNonEGLContext(boolean mock)
-
Field Details
-
FLAG_RECORDABLE
public static final int FLAG_RECORDABLEConstructor flag: surface must be recordable. This discourages EGL from using a pixel format that cannot be converted efficiently to something usable by the video encoder.- See Also:
-
FLAG_TRY_GLES3
public static final int FLAG_TRY_GLES3Constructor flag: ask for GLES3, fall back to GLES2 if not available. Without this flag, GLES2 is used.- See Also:
-
-
Constructor Details
-
EglCore
public EglCore()Prepares EGL display and context.Equivalent to EglCore(null, 0).
-
EglCore
public EglCore(EGLContext sharedContext, int flags) Prepares EGL display and context.- Parameters:
sharedContext- The context to share, or null if sharing is not desired.flags- Configuration bit flags, e.g. FLAG_RECORDABLE.
-
-
Method Details
-
setMockNonEGLContext
public static void setMockNonEGLContext(boolean mock) -
getConfig
public EGLConfig getConfig(int flags, int version) Finds a suitable EGLConfig.- Parameters:
flags- Bit flags from constructor.version- Must be 2 or 3.
-
release
public void release()Discards all resources held by this class, notably the EGL context. This must be called from the thread where the context was created.On completion, no context will be current.
-
releaseSurface
public void releaseSurface(EGLSurface eglSurface) Destroys the specified surface. Note the EGLSurface won't actually be destroyed if it's still current in a context. -
createOffscreenSurface
public EGLSurface createOffscreenSurface(int width, int height) Creates an EGL surface associated with an offscreen buffer. -
makeCurrent
public void makeCurrent(EGLSurface eglSurface) Makes our EGL context current, using the supplied surface for both "draw" and "read". -
checkEglError
Checks for EGL errors. Throws an exception if an error has been raised.
-