Avoid using EGLContext class for Android 4.1 and below.

Support for this class was added in Android 4.2, so
disable surface decoding for lower Android versions.

BUG=3901
R=tkchin@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/31669004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@7478 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
glaznev@webrtc.org
2014-10-20 19:08:05 +00:00
parent b69ea9a35a
commit a8c0edd29f
3 changed files with 27 additions and 3 deletions

View File

@ -80,6 +80,11 @@ public class VideoRendererGui implements GLSurfaceView.Renderer {
// aspect ratio is changed if necessary.
public static enum ScalingType
{ SCALE_ASPECT_FIT, SCALE_ASPECT_FILL, SCALE_FILL };
private static final int EGL14_SDK_VERSION =
android.os.Build.VERSION_CODES.JELLY_BEAN_MR1;
// Current SDK version.
private static final int CURRENT_SDK_VERSION =
android.os.Build.VERSION.SDK_INT;
private final String VERTEX_SHADER_STRING =
"varying vec2 interp_tc;\n" +
@ -666,8 +671,10 @@ public class VideoRendererGui implements GLSurfaceView.Renderer {
public void onSurfaceCreated(GL10 unused, EGLConfig config) {
Log.d(TAG, "VideoRendererGui.onSurfaceCreated");
// Store render EGL context
eglContext = EGL14.eglGetCurrentContext();
Log.d(TAG, "VideoRendererGui EGL Context: " + eglContext);
if (CURRENT_SDK_VERSION >= EGL14_SDK_VERSION) {
eglContext = EGL14.eglGetCurrentContext();
Log.d(TAG, "VideoRendererGui EGL Context: " + eglContext);
}
// Create YUV and OES programs.
yuvProgram = createProgram(VERTEX_SHADER_STRING,