Refactor EglBase configuration.

Delete EglBase.ConfigType, instead pass arrays of attributes, and define
constant arrays for the common cases.

Both in progress NativeToI420 and extending GlRectDrawer to other shapes (with alpha) needs this.

BUG=b/25694445

Review URL: https://codereview.webrtc.org/1498003002

Cr-Commit-Position: refs/heads/master@{#10908}
This commit is contained in:
nisse 2015-12-07 01:17:16 -08:00 committed by Commit bot
parent a8565425bc
commit 03f80ebb83
8 changed files with 54 additions and 113 deletions

View File

@ -96,7 +96,7 @@ public final class GlRectDrawerTest extends ActivityTestCase {
@SmallTest @SmallTest
public void testRgbRendering() { public void testRgbRendering() {
// Create EGL base with a pixel buffer as display output. // Create EGL base with a pixel buffer as display output.
final EglBase eglBase = EglBase.create(null, EglBase.ConfigType.PIXEL_BUFFER); final EglBase eglBase = EglBase.create(null, EglBase.CONFIG_PIXEL_BUFFER);
eglBase.createPbufferSurface(WIDTH, HEIGHT); eglBase.createPbufferSurface(WIDTH, HEIGHT);
eglBase.makeCurrent(); eglBase.makeCurrent();
@ -133,7 +133,7 @@ public final class GlRectDrawerTest extends ActivityTestCase {
@SmallTest @SmallTest
public void testYuvRendering() { public void testYuvRendering() {
// Create EGL base with a pixel buffer as display output. // Create EGL base with a pixel buffer as display output.
EglBase eglBase = EglBase.create(null, EglBase.ConfigType.PIXEL_BUFFER); EglBase eglBase = EglBase.create(null, EglBase.CONFIG_PIXEL_BUFFER);
eglBase.createPbufferSurface(WIDTH, HEIGHT); eglBase.createPbufferSurface(WIDTH, HEIGHT);
eglBase.makeCurrent(); eglBase.makeCurrent();
@ -229,7 +229,7 @@ public final class GlRectDrawerTest extends ActivityTestCase {
public StubOesTextureProducer( public StubOesTextureProducer(
EglBase.Context sharedContext, SurfaceTexture surfaceTexture, int width, EglBase.Context sharedContext, SurfaceTexture surfaceTexture, int width,
int height) { int height) {
eglBase = EglBase.create(sharedContext, EglBase.ConfigType.PLAIN); eglBase = EglBase.create(sharedContext, EglBase.CONFIG_PLAIN);
surfaceTexture.setDefaultBufferSize(width, height); surfaceTexture.setDefaultBufferSize(width, height);
eglBase.createSurface(surfaceTexture); eglBase.createSurface(surfaceTexture);
assertEquals(eglBase.surfaceWidth(), width); assertEquals(eglBase.surfaceWidth(), width);
@ -263,7 +263,7 @@ public final class GlRectDrawerTest extends ActivityTestCase {
} }
// Create EGL base with a pixel buffer as display output. // Create EGL base with a pixel buffer as display output.
final EglBase eglBase = EglBase.create(null, EglBase.ConfigType.PIXEL_BUFFER); final EglBase eglBase = EglBase.create(null, EglBase.CONFIG_PIXEL_BUFFER);
eglBase.createPbufferSurface(WIDTH, HEIGHT); eglBase.createPbufferSurface(WIDTH, HEIGHT);
// Create resources for generating OES textures. // Create resources for generating OES textures.

View File

@ -143,7 +143,7 @@ public final class MediaCodecVideoEncoderTest extends ActivityTestCase {
final int height = 480; final int height = 480;
final long presentationTs = 2; final long presentationTs = 2;
final EglBase eglOesBase = EglBase.create(null, EglBase.ConfigType.PIXEL_BUFFER); final EglBase eglOesBase = EglBase.create(null, EglBase.CONFIG_PIXEL_BUFFER);
eglOesBase.createDummyPbufferSurface(); eglOesBase.createDummyPbufferSurface();
eglOesBase.makeCurrent(); eglOesBase.makeCurrent();
int oesTextureId = GlUtil.generateTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES); int oesTextureId = GlUtil.generateTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES);

View File

@ -107,7 +107,7 @@ public final class SurfaceTextureHelperTest extends ActivityTestCase {
final int width = 16; final int width = 16;
final int height = 16; final int height = 16;
// Create EGL base with a pixel buffer as display output. // Create EGL base with a pixel buffer as display output.
final EglBase eglBase = EglBase.create(null, EglBase.ConfigType.PIXEL_BUFFER); final EglBase eglBase = EglBase.create(null, EglBase.CONFIG_PIXEL_BUFFER);
eglBase.createPbufferSurface(width, height); eglBase.createPbufferSurface(width, height);
final GlRectDrawer drawer = new GlRectDrawer(); final GlRectDrawer drawer = new GlRectDrawer();
@ -121,7 +121,7 @@ public final class SurfaceTextureHelperTest extends ActivityTestCase {
// Create resources for stubbing an OES texture producer. |eglOesBase| has the SurfaceTexture in // Create resources for stubbing an OES texture producer. |eglOesBase| has the SurfaceTexture in
// |surfaceTextureHelper| as the target EGLSurface. // |surfaceTextureHelper| as the target EGLSurface.
final EglBase eglOesBase = final EglBase eglOesBase =
EglBase.create(eglBase.getEglBaseContext(), EglBase.ConfigType.PLAIN); EglBase.create(eglBase.getEglBaseContext(), EglBase.CONFIG_PLAIN);
eglOesBase.createSurface(surfaceTextureHelper.getSurfaceTexture()); eglOesBase.createSurface(surfaceTextureHelper.getSurfaceTexture());
assertEquals(eglOesBase.surfaceWidth(), width); assertEquals(eglOesBase.surfaceWidth(), width);
assertEquals(eglOesBase.surfaceHeight(), height); assertEquals(eglOesBase.surfaceHeight(), height);
@ -175,7 +175,7 @@ public final class SurfaceTextureHelperTest extends ActivityTestCase {
final int width = 16; final int width = 16;
final int height = 16; final int height = 16;
// Create EGL base with a pixel buffer as display output. // Create EGL base with a pixel buffer as display output.
final EglBase eglBase = EglBase.create(null, EglBase.ConfigType.PIXEL_BUFFER); final EglBase eglBase = EglBase.create(null, EglBase.CONFIG_PIXEL_BUFFER);
eglBase.createPbufferSurface(width, height); eglBase.createPbufferSurface(width, height);
// Create SurfaceTextureHelper and listener. // Create SurfaceTextureHelper and listener.
@ -188,7 +188,7 @@ public final class SurfaceTextureHelperTest extends ActivityTestCase {
// Create resources for stubbing an OES texture producer. |eglOesBase| has the SurfaceTexture in // Create resources for stubbing an OES texture producer. |eglOesBase| has the SurfaceTexture in
// |surfaceTextureHelper| as the target EGLSurface. // |surfaceTextureHelper| as the target EGLSurface.
final EglBase eglOesBase = final EglBase eglOesBase =
EglBase.create(eglBase.getEglBaseContext(), EglBase.ConfigType.PLAIN); EglBase.create(eglBase.getEglBaseContext(), EglBase.CONFIG_PLAIN);
eglOesBase.createSurface(surfaceTextureHelper.getSurfaceTexture()); eglOesBase.createSurface(surfaceTextureHelper.getSurfaceTexture());
assertEquals(eglOesBase.surfaceWidth(), width); assertEquals(eglOesBase.surfaceWidth(), width);
assertEquals(eglOesBase.surfaceHeight(), height); assertEquals(eglOesBase.surfaceHeight(), height);
@ -244,7 +244,7 @@ public final class SurfaceTextureHelperTest extends ActivityTestCase {
final MockTextureListener listener = new MockTextureListener(); final MockTextureListener listener = new MockTextureListener();
surfaceTextureHelper.setListener(listener); surfaceTextureHelper.setListener(listener);
// Create EglBase with the SurfaceTexture as target EGLSurface. // Create EglBase with the SurfaceTexture as target EGLSurface.
final EglBase eglBase = EglBase.create(null, EglBase.ConfigType.PLAIN); final EglBase eglBase = EglBase.create(null, EglBase.CONFIG_PLAIN);
eglBase.createSurface(surfaceTextureHelper.getSurfaceTexture()); eglBase.createSurface(surfaceTextureHelper.getSurfaceTexture());
eglBase.makeCurrent(); eglBase.makeCurrent();
// Assert no frame has been received yet. // Assert no frame has been received yet.
@ -299,7 +299,7 @@ public final class SurfaceTextureHelperTest extends ActivityTestCase {
// Create resources for stubbing an OES texture producer. |eglOesBase| has the // Create resources for stubbing an OES texture producer. |eglOesBase| has the
// SurfaceTexture in |surfaceTextureHelper| as the target EGLSurface. // SurfaceTexture in |surfaceTextureHelper| as the target EGLSurface.
final EglBase eglOesBase = EglBase.create(null, EglBase.ConfigType.PLAIN); final EglBase eglOesBase = EglBase.create(null, EglBase.CONFIG_PLAIN);
eglOesBase.createSurface(surfaceTextureHelper.getSurfaceTexture()); eglOesBase.createSurface(surfaceTextureHelper.getSurfaceTexture());
eglOesBase.makeCurrent(); eglOesBase.makeCurrent();
// Draw a frame onto the SurfaceTexture. // Draw a frame onto the SurfaceTexture.
@ -335,7 +335,7 @@ public final class SurfaceTextureHelperTest extends ActivityTestCase {
// Create resources for stubbing an OES texture producer. |eglOesBase| has the // Create resources for stubbing an OES texture producer. |eglOesBase| has the
// SurfaceTexture in |surfaceTextureHelper| as the target EGLSurface. // SurfaceTexture in |surfaceTextureHelper| as the target EGLSurface.
final EglBase eglOesBase = EglBase.create(null, EglBase.ConfigType.PLAIN); final EglBase eglOesBase = EglBase.create(null, EglBase.CONFIG_PLAIN);
eglOesBase.createSurface(surfaceTextureHelper.getSurfaceTexture()); eglOesBase.createSurface(surfaceTextureHelper.getSurfaceTexture());
eglOesBase.makeCurrent(); eglOesBase.makeCurrent();
// Draw a frame onto the SurfaceTexture. // Draw a frame onto the SurfaceTexture.

View File

@ -34,7 +34,6 @@ import android.view.Surface;
import android.view.SurfaceHolder; import android.view.SurfaceHolder;
import org.webrtc.Logging; import org.webrtc.Logging;
import org.webrtc.EglBase.ConfigType;
import org.webrtc.EglBase.Context; import org.webrtc.EglBase.Context;
import javax.microedition.khronos.egl.EGL10; import javax.microedition.khronos.egl.EGL10;
@ -60,7 +59,6 @@ public class EglBase {
private final EGL10 egl; private final EGL10 egl;
private EGLContext eglContext; private EGLContext eglContext;
private ConfigType configType;
private EGLConfig eglConfig; private EGLConfig eglConfig;
private EGLDisplay eglDisplay; private EGLDisplay eglDisplay;
private EGLSurface eglSurface = EGL10.EGL_NO_SURFACE; private EGLSurface eglSurface = EGL10.EGL_NO_SURFACE;
@ -74,41 +72,53 @@ public class EglBase {
} }
} }
// EGLConfig constructor type. Influences eglChooseConfig arguments. public static final int[] CONFIG_PLAIN = {
public static enum ConfigType { EGL10.EGL_RED_SIZE, 8,
// No special parameters. EGL10.EGL_GREEN_SIZE, 8,
PLAIN, EGL10.EGL_BLUE_SIZE, 8,
// Configures with EGL_SURFACE_TYPE = EGL_PBUFFER_BIT. EGL10.EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
PIXEL_BUFFER, EGL10.EGL_NONE
// Configures with EGL_RECORDABLE_ANDROID = 1. };
// Discourages EGL from using pixel formats that cannot efficiently be public static final int[] CONFIG_PIXEL_BUFFER = {
// converted to something usable by the video encoder. EGL10.EGL_RED_SIZE, 8,
RECORDABLE EGL10.EGL_GREEN_SIZE, 8,
} EGL10.EGL_BLUE_SIZE, 8,
EGL10.EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
EGL10.EGL_SURFACE_TYPE, EGL10.EGL_PBUFFER_BIT,
EGL10.EGL_NONE
};
public static final int[] CONFIG_RECORDABLE = {
EGL10.EGL_RED_SIZE, 8,
EGL10.EGL_GREEN_SIZE, 8,
EGL10.EGL_BLUE_SIZE, 8,
EGL10.EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
EGL_RECORDABLE_ANDROID, 1,
EGL10.EGL_NONE
};
// Create a new context with the specified config type, sharing data with sharedContext. // Create a new context with the specified config attributes, sharing data with sharedContext.
// |sharedContext| can be null. // |sharedContext| can be null.
public static EglBase create(Context sharedContext, ConfigType configType) { public static EglBase create(Context sharedContext, int[] configAttributes) {
return (EglBase14.isEGL14Supported() return (EglBase14.isEGL14Supported()
&& (sharedContext == null || sharedContext instanceof EglBase14.Context)) && (sharedContext == null || sharedContext instanceof EglBase14.Context))
? new EglBase14((EglBase14.Context) sharedContext, configType) ? new EglBase14((EglBase14.Context) sharedContext, configAttributes)
: new EglBase(sharedContext, configType); : new EglBase(sharedContext, configAttributes);
} }
public static EglBase create() { public static EglBase create() {
return create(null, ConfigType.PLAIN); return create(null, CONFIG_PLAIN);
} }
//Create root context without any EGLSurface or parent EGLContext. This can be used for branching //Create root context without any EGLSurface or parent EGLContext. This can be used for branching
// new contexts that share data. // new contexts that share data.
@Deprecated @Deprecated
public EglBase() { public EglBase() {
this((Context) null, ConfigType.PLAIN); this((Context) null, CONFIG_PLAIN);
} }
@Deprecated @Deprecated
public EglBase(EGLContext sharedContext, ConfigType configType) { public EglBase(EGLContext sharedContext, int[] configAttributes) {
this(new Context(sharedContext), configType); this(new Context(sharedContext), configAttributes);
Logging.d(TAG, "EglBase created"); Logging.d(TAG, "EglBase created");
} }
@ -118,11 +128,10 @@ public class EglBase {
} }
// Create a new context with the specified config type, sharing data with sharedContext. // Create a new context with the specified config type, sharing data with sharedContext.
EglBase(Context sharedContext, ConfigType configType) { EglBase(Context sharedContext, int[] configAttributes) {
this.egl = (EGL10) EGLContext.getEGL(); this.egl = (EGL10) EGLContext.getEGL();
this.configType = configType;
eglDisplay = getEglDisplay(); eglDisplay = getEglDisplay();
eglConfig = getEglConfig(eglDisplay, configType); eglConfig = getEglConfig(eglDisplay, configAttributes);
eglContext = createEglContext(sharedContext, eglDisplay, eglConfig); eglContext = createEglContext(sharedContext, eglDisplay, eglConfig);
} }
@ -211,9 +220,6 @@ public class EglBase {
throw new IllegalStateException("Input must be either a SurfaceHolder or SurfaceTexture"); throw new IllegalStateException("Input must be either a SurfaceHolder or SurfaceTexture");
} }
checkIsNotReleased(); checkIsNotReleased();
if (configType == ConfigType.PIXEL_BUFFER) {
Logging.w(TAG, "This EGL context is configured for PIXEL_BUFFER, but uses regular Surface");
}
if (eglSurface != EGL10.EGL_NO_SURFACE) { if (eglSurface != EGL10.EGL_NO_SURFACE) {
throw new RuntimeException("Already has an EGLSurface"); throw new RuntimeException("Already has an EGLSurface");
} }
@ -231,10 +237,6 @@ public class EglBase {
public void createPbufferSurface(int width, int height) { public void createPbufferSurface(int width, int height) {
checkIsNotReleased(); checkIsNotReleased();
if (configType != ConfigType.PIXEL_BUFFER) {
throw new RuntimeException(
"This EGL context is not configured to use a pixel buffer: " + configType);
}
if (eglSurface != EGL10.EGL_NO_SURFACE) { if (eglSurface != EGL10.EGL_NO_SURFACE) {
throw new RuntimeException("Already has an EGLSurface"); throw new RuntimeException("Already has an EGLSurface");
} }
@ -330,38 +332,12 @@ public class EglBase {
} }
// Return an EGLConfig, or die trying. // Return an EGLConfig, or die trying.
private EGLConfig getEglConfig(EGLDisplay eglDisplay, ConfigType configType) { private EGLConfig getEglConfig(EGLDisplay eglDisplay, int[] configAttributes) {
// Always RGB888, GLES2.
int[] configAttributes = {
EGL10.EGL_RED_SIZE, 8,
EGL10.EGL_GREEN_SIZE, 8,
EGL10.EGL_BLUE_SIZE, 8,
EGL10.EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
EGL10.EGL_NONE, 0, // Allocate dummy fields for specific options.
EGL10.EGL_NONE
};
// Fill in dummy fields based on configType.
switch (configType) {
case PLAIN:
break;
case PIXEL_BUFFER:
configAttributes[configAttributes.length - 3] = EGL10.EGL_SURFACE_TYPE;
configAttributes[configAttributes.length - 2] = EGL10.EGL_PBUFFER_BIT;
break;
case RECORDABLE:
configAttributes[configAttributes.length - 3] = EGL_RECORDABLE_ANDROID;
configAttributes[configAttributes.length - 2] = 1;
break;
default:
throw new IllegalArgumentException();
}
EGLConfig[] configs = new EGLConfig[1]; EGLConfig[] configs = new EGLConfig[1];
int[] numConfigs = new int[1]; int[] numConfigs = new int[1];
if (!egl.eglChooseConfig( if (!egl.eglChooseConfig(
eglDisplay, configAttributes, configs, configs.length, numConfigs)) { eglDisplay, configAttributes, configs, configs.length, numConfigs)) {
throw new RuntimeException("Unable to find RGB888 " + configType + " EGL config"); throw new RuntimeException("Unable to find any matching EGL config");
} }
return configs[0]; return configs[0];
} }

View File

@ -51,7 +51,6 @@ final class EglBase14 extends EglBase {
private static final int EGL_RECORDABLE_ANDROID = 0x3142; private static final int EGL_RECORDABLE_ANDROID = 0x3142;
private EGLContext eglContext; private EGLContext eglContext;
private ConfigType configType;
private EGLConfig eglConfig; private EGLConfig eglConfig;
private EGLDisplay eglDisplay; private EGLDisplay eglDisplay;
private EGLSurface eglSurface = EGL14.EGL_NO_SURFACE; private EGLSurface eglSurface = EGL14.EGL_NO_SURFACE;
@ -73,11 +72,10 @@ final class EglBase14 extends EglBase {
// Create a new context with the specified config type, sharing data with sharedContext. // Create a new context with the specified config type, sharing data with sharedContext.
// |sharedContext| may be null. // |sharedContext| may be null.
EglBase14(EglBase14.Context sharedContext, ConfigType configType) { EglBase14(EglBase14.Context sharedContext, int[] configAttributes) {
super(true /* dummy */); super(true /* dummy */);
this.configType = configType;
eglDisplay = getEglDisplay(); eglDisplay = getEglDisplay();
eglConfig = getEglConfig(eglDisplay, configType); eglConfig = getEglConfig(eglDisplay, configAttributes);
eglContext = createEglContext(sharedContext, eglDisplay, eglConfig); eglContext = createEglContext(sharedContext, eglDisplay, eglConfig);
} }
@ -99,9 +97,6 @@ final class EglBase14 extends EglBase {
throw new IllegalStateException("Input must be either a Surface or SurfaceTexture"); throw new IllegalStateException("Input must be either a Surface or SurfaceTexture");
} }
checkIsNotReleased(); checkIsNotReleased();
if (configType == ConfigType.PIXEL_BUFFER) {
Logging.w(TAG, "This EGL context is configured for PIXEL_BUFFER, but uses regular Surface");
}
if (eglSurface != EGL14.EGL_NO_SURFACE) { if (eglSurface != EGL14.EGL_NO_SURFACE) {
throw new RuntimeException("Already has an EGLSurface"); throw new RuntimeException("Already has an EGLSurface");
} }
@ -120,10 +115,6 @@ final class EglBase14 extends EglBase {
@Override @Override
public void createPbufferSurface(int width, int height) { public void createPbufferSurface(int width, int height) {
checkIsNotReleased(); checkIsNotReleased();
if (configType != ConfigType.PIXEL_BUFFER) {
throw new RuntimeException(
"This EGL context is not configured to use a pixel buffer: " + configType);
}
if (eglSurface != EGL14.EGL_NO_SURFACE) { if (eglSurface != EGL14.EGL_NO_SURFACE) {
throw new RuntimeException("Already has an EGLSurface"); throw new RuntimeException("Already has an EGLSurface");
} }
@ -229,38 +220,12 @@ final class EglBase14 extends EglBase {
} }
// Return an EGLConfig, or die trying. // Return an EGLConfig, or die trying.
private static EGLConfig getEglConfig(EGLDisplay eglDisplay, ConfigType configType) { private static EGLConfig getEglConfig(EGLDisplay eglDisplay, int[] configAttributes) {
// Always RGB888, GLES2.
int[] configAttributes = {
EGL14.EGL_RED_SIZE, 8,
EGL14.EGL_GREEN_SIZE, 8,
EGL14.EGL_BLUE_SIZE, 8,
EGL14.EGL_RENDERABLE_TYPE, EGL14.EGL_OPENGL_ES2_BIT,
EGL14.EGL_NONE, 0, // Allocate dummy fields for specific options.
EGL14.EGL_NONE
};
// Fill in dummy fields based on configType.
switch (configType) {
case PLAIN:
break;
case PIXEL_BUFFER:
configAttributes[configAttributes.length - 3] = EGL14.EGL_SURFACE_TYPE;
configAttributes[configAttributes.length - 2] = EGL14.EGL_PBUFFER_BIT;
break;
case RECORDABLE:
configAttributes[configAttributes.length - 3] = EGL_RECORDABLE_ANDROID;
configAttributes[configAttributes.length - 2] = 1;
break;
default:
throw new IllegalArgumentException();
}
EGLConfig[] configs = new EGLConfig[1]; EGLConfig[] configs = new EGLConfig[1];
int[] numConfigs = new int[1]; int[] numConfigs = new int[1];
if (!EGL14.eglChooseConfig( if (!EGL14.eglChooseConfig(
eglDisplay, configAttributes, 0, configs, 0, configs.length, numConfigs, 0)) { eglDisplay, configAttributes, 0, configs, 0, configs.length, numConfigs, 0)) {
throw new RuntimeException("Unable to find RGB888 " + configType + " EGL config"); throw new RuntimeException("Unable to find any matching EGL config");
} }
return configs[0]; return configs[0];
} }

View File

@ -112,7 +112,7 @@ class SurfaceTextureHelper {
this.handler = handler; this.handler = handler;
this.isOwningThread = isOwningThread; this.isOwningThread = isOwningThread;
eglBase = EglBase.create(sharedContext, EglBase.ConfigType.PIXEL_BUFFER); eglBase = EglBase.create(sharedContext, EglBase.CONFIG_PIXEL_BUFFER);
eglBase.createDummyPbufferSurface(); eglBase.createDummyPbufferSurface();
eglBase.makeCurrent(); eglBase.makeCurrent();

View File

@ -163,7 +163,7 @@ public class SurfaceViewRenderer extends SurfaceView
renderThread = new HandlerThread(TAG); renderThread = new HandlerThread(TAG);
renderThread.start(); renderThread.start();
drawer = new GlRectDrawer(); drawer = new GlRectDrawer();
eglBase = EglBase.create(sharedContext, EglBase.ConfigType.PLAIN); eglBase = EglBase.create(sharedContext, EglBase.CONFIG_PLAIN);
renderThreadHandler = new Handler(renderThread.getLooper()); renderThreadHandler = new Handler(renderThread.getLooper());
} }
tryCreateEglSurface(); tryCreateEglSurface();

View File

@ -321,7 +321,7 @@ public class MediaCodecVideoEncoder {
format, null, null, MediaCodec.CONFIGURE_FLAG_ENCODE); format, null, null, MediaCodec.CONFIGURE_FLAG_ENCODE);
if (useSurface) { if (useSurface) {
eglBase = EglBase.create(sharedContext, EglBase.ConfigType.RECORDABLE); eglBase = EglBase.create(sharedContext, EglBase.CONFIG_RECORDABLE);
// Create an input surface and keep a reference since we must release the surface when done. // Create an input surface and keep a reference since we must release the surface when done.
inputSurface = mediaCodec.createInputSurface(); inputSurface = mediaCodec.createInputSurface();
eglBase.createSurface(inputSurface); eglBase.createSurface(inputSurface);