Android: Expose EglBase.swapBuffers with presentation time

This function is currently only available in EglBase14, which is not in
the api. This CL adds the swapBuffer method to the public EglBase
interface. For EglBase10, the presentation time is just ignored.

BUG=webrtc:8155

Review-Url: https://codereview.webrtc.org/3003843002
Cr-Commit-Position: refs/heads/master@{#19518}
This commit is contained in:
magjed
2017-08-25 06:28:00 -07:00
committed by Commit Bot
parent 474accebdb
commit 4781552f60
3 changed files with 28 additions and 18 deletions

View File

@ -19,7 +19,8 @@ import javax.microedition.khronos.egl.EGL10;
* Holds EGL state and utility methods for handling an egl 1.0 EGLContext, an EGLDisplay,
* and an EGLSurface.
*/
public abstract class EglBase {
@SuppressWarnings("StaticOrDefaultInterfaceMethod")
public interface EglBase {
// EGL wrapper for an actual EGLContext.
public static class Context {}
@ -33,9 +34,9 @@ public abstract class EglBase {
// https://android.googlesource.com/platform/frameworks/base/+/master/opengl/java/android/opengl/EGL14.java
// This is similar to how GlSurfaceView does:
// http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/5.1.1_r1/android/opengl/GLSurfaceView.java#760
private static final int EGL_OPENGL_ES2_BIT = 4;
public static final int EGL_OPENGL_ES2_BIT = 4;
// Android-specific extension.
private static final int EGL_RECORDABLE_ANDROID = 0x3142;
public static final int EGL_RECORDABLE_ANDROID = 0x3142;
// clang-format off
public static final int[] CONFIG_PLAIN = {
@ -140,32 +141,34 @@ public abstract class EglBase {
return new EglBase14(new EglBase14.Context(sharedContext), configAttributes);
}
public abstract void createSurface(Surface surface);
void createSurface(Surface surface);
// Create EGLSurface from the Android SurfaceTexture.
public abstract void createSurface(SurfaceTexture surfaceTexture);
void createSurface(SurfaceTexture surfaceTexture);
// Create dummy 1x1 pixel buffer surface so the context can be made current.
public abstract void createDummyPbufferSurface();
void createDummyPbufferSurface();
public abstract void createPbufferSurface(int width, int height);
void createPbufferSurface(int width, int height);
public abstract Context getEglBaseContext();
Context getEglBaseContext();
public abstract boolean hasSurface();
boolean hasSurface();
public abstract int surfaceWidth();
int surfaceWidth();
public abstract int surfaceHeight();
int surfaceHeight();
public abstract void releaseSurface();
void releaseSurface();
public abstract void release();
void release();
public abstract void makeCurrent();
void makeCurrent();
// Detach the current EGL context, so that it can be made current on another thread.
public abstract void detachCurrent();
void detachCurrent();
public abstract void swapBuffers();
void swapBuffers();
void swapBuffers(long presentationTimeStampNs);
}