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:
parent
474accebdb
commit
4781552f60
@ -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);
|
||||
}
|
||||
|
||||
@ -26,7 +26,7 @@ import javax.microedition.khronos.egl.EGLSurface;
|
||||
* Holds EGL state and utility methods for handling an egl 1.0 EGLContext, an EGLDisplay,
|
||||
* and an EGLSurface.
|
||||
*/
|
||||
class EglBase10 extends EglBase {
|
||||
class EglBase10 implements EglBase {
|
||||
// This constant is taken from EGL14.EGL_CONTEXT_CLIENT_VERSION.
|
||||
private static final int EGL_CONTEXT_CLIENT_VERSION = 0x3098;
|
||||
|
||||
@ -252,6 +252,12 @@ class EglBase10 extends EglBase {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void swapBuffers(long timeStampNs) {
|
||||
// Setting presentation time is not supported for EGL 1.0.
|
||||
swapBuffers();
|
||||
}
|
||||
|
||||
// Return an EGLDisplay, or die trying.
|
||||
private EGLDisplay getEglDisplay() {
|
||||
EGLDisplay eglDisplay = egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);
|
||||
|
||||
@ -25,7 +25,7 @@ import android.view.Surface;
|
||||
* and an EGLSurface.
|
||||
*/
|
||||
@TargetApi(18)
|
||||
class EglBase14 extends EglBase {
|
||||
class EglBase14 implements EglBase {
|
||||
private static final String TAG = "EglBase14";
|
||||
private static final int EGLExt_SDK_VERSION = android.os.Build.VERSION_CODES.JELLY_BEAN_MR2;
|
||||
private static final int CURRENT_SDK_VERSION = android.os.Build.VERSION.SDK_INT;
|
||||
@ -196,6 +196,7 @@ class EglBase14 extends EglBase {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void swapBuffers(long timeStampNs) {
|
||||
checkIsNotReleased();
|
||||
if (eglSurface == EGL14.EGL_NO_SURFACE) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user