Chromium Code Reviews| Index: talk/app/webrtc/java/android/org/webrtc/EglBase14.java |
| diff --git a/talk/app/webrtc/java/android/org/webrtc/EglBase14.java b/talk/app/webrtc/java/android/org/webrtc/EglBase14.java |
| index 580a3c6826fb517389e88039e7cc9e0c67edd46b..9622656ac6629b8ddd1784e3b569ee33ff039f21 100644 |
| --- a/talk/app/webrtc/java/android/org/webrtc/EglBase14.java |
| +++ b/talk/app/webrtc/java/android/org/webrtc/EglBase14.java |
| @@ -33,6 +33,7 @@ import android.opengl.EGL14; |
| import android.opengl.EGLConfig; |
| import android.opengl.EGLContext; |
| import android.opengl.EGLDisplay; |
| +import android.opengl.EGLExt; |
| import android.opengl.EGLSurface; |
| import android.view.Surface; |
| @@ -42,10 +43,10 @@ import org.webrtc.Logging; |
| * Holds EGL state and utility methods for handling an EGL14 EGLContext, an EGLDisplay, |
| * and an EGLSurface. |
| */ |
| -@TargetApi(17) |
| +@TargetApi(18) |
| final class EglBase14 extends EglBase { |
| private static final String TAG = "EglBase14"; |
| - private static final int EGL14_SDK_VERSION = android.os.Build.VERSION_CODES.JELLY_BEAN_MR1; |
| + 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; |
| private EGLContext eglContext; |
| private EGLConfig eglConfig; |
| @@ -54,8 +55,8 @@ final class EglBase14 extends EglBase { |
| public static boolean isEGL14Supported() { |
|
magjed_webrtc
2015/12/17 12:20:02
This name is also a bit strange. BTW, do you reall
perkj_webrtc
2015/12/17 14:11:12
AS we talked about off line. Added a comment.
|
| Logging.d(TAG, "SDK version: " + CURRENT_SDK_VERSION |
| - + ". isEGL14Supported: " + (CURRENT_SDK_VERSION >= EGL14_SDK_VERSION)); |
| - return (CURRENT_SDK_VERSION >= EGL14_SDK_VERSION); |
| + + ". isEGL14Supported: " + (CURRENT_SDK_VERSION >= EGLExt_SDK_VERSION)); |
| + return (CURRENT_SDK_VERSION >= EGLExt_SDK_VERSION); |
| } |
| public static class Context extends EglBase.Context { |
| @@ -201,6 +202,16 @@ final class EglBase14 extends EglBase { |
| EGL14.eglSwapBuffers(eglDisplay, eglSurface); |
| } |
| + public void swapBuffers(long timeStampNs) { |
| + checkIsNotReleased(); |
| + if (eglSurface == EGL14.EGL_NO_SURFACE) { |
| + throw new RuntimeException("No EGLSurface - can't swap buffers"); |
| + } |
| + // See https://android.googlesource.com/platform/frameworks/native/+/tools_r22.2/opengl/specs/EGL_ANDROID_presentation_time.txt |
| + EGLExt.eglPresentationTimeANDROID(eglDisplay, eglSurface, timeStampNs); |
| + EGL14.eglSwapBuffers(eglDisplay, eglSurface); |
| + } |
| + |
| // Return an EGLDisplay, or die trying. |
| private static EGLDisplay getEglDisplay() { |
| EGLDisplay eglDisplay = EGL14.eglGetDisplay(EGL14.EGL_DEFAULT_DISPLAY); |