Remove static/default interface method usage.
BUG=webrtc:8217 Review-Url: https://codereview.webrtc.org/3010233002 Cr-Commit-Position: refs/heads/master@{#19741}
This commit is contained in:
@ -19,8 +19,7 @@ import javax.microedition.khronos.egl.EGL10;
|
||||
* Holds EGL state and utility methods for handling an egl 1.0 EGLContext, an EGLDisplay,
|
||||
* and an EGLSurface.
|
||||
*/
|
||||
@SuppressWarnings("StaticOrDefaultInterfaceMethod")
|
||||
public interface EglBase {
|
||||
public abstract class EglBase {
|
||||
// EGL wrapper for an actual EGLContext.
|
||||
public static class Context {}
|
||||
|
||||
@ -141,34 +140,34 @@ public interface EglBase {
|
||||
return new EglBase14(new EglBase14.Context(sharedContext), configAttributes);
|
||||
}
|
||||
|
||||
void createSurface(Surface surface);
|
||||
public abstract void createSurface(Surface surface);
|
||||
|
||||
// Create EGLSurface from the Android SurfaceTexture.
|
||||
void createSurface(SurfaceTexture surfaceTexture);
|
||||
public abstract void createSurface(SurfaceTexture surfaceTexture);
|
||||
|
||||
// Create dummy 1x1 pixel buffer surface so the context can be made current.
|
||||
void createDummyPbufferSurface();
|
||||
public abstract void createDummyPbufferSurface();
|
||||
|
||||
void createPbufferSurface(int width, int height);
|
||||
public abstract void createPbufferSurface(int width, int height);
|
||||
|
||||
Context getEglBaseContext();
|
||||
public abstract Context getEglBaseContext();
|
||||
|
||||
boolean hasSurface();
|
||||
public abstract boolean hasSurface();
|
||||
|
||||
int surfaceWidth();
|
||||
public abstract int surfaceWidth();
|
||||
|
||||
int surfaceHeight();
|
||||
public abstract int surfaceHeight();
|
||||
|
||||
void releaseSurface();
|
||||
public abstract void releaseSurface();
|
||||
|
||||
void release();
|
||||
public abstract void release();
|
||||
|
||||
void makeCurrent();
|
||||
public abstract void makeCurrent();
|
||||
|
||||
// Detach the current EGL context, so that it can be made current on another thread.
|
||||
void detachCurrent();
|
||||
public abstract void detachCurrent();
|
||||
|
||||
void swapBuffers();
|
||||
public abstract void swapBuffers();
|
||||
|
||||
void swapBuffers(long presentationTimeStampNs);
|
||||
public abstract void swapBuffers(long presentationTimeStampNs);
|
||||
}
|
||||
|
||||
@ -622,8 +622,8 @@ public class EglRenderer implements VideoRenderer.Callbacks, VideoSink {
|
||||
drawnFrameHeight, 0, 0, eglBase.surfaceWidth(), eglBase.surfaceHeight());
|
||||
} else {
|
||||
VideoFrame.TextureBuffer textureBuffer = (VideoFrame.TextureBuffer) buffer;
|
||||
drawer.drawTexture(textureBuffer, drawMatrix, drawnFrameWidth, drawnFrameHeight, 0, 0,
|
||||
eglBase.surfaceWidth(), eglBase.surfaceHeight());
|
||||
RendererCommon.drawTexture(drawer, textureBuffer, drawMatrix, drawnFrameWidth,
|
||||
drawnFrameHeight, 0, 0, eglBase.surfaceWidth(), eglBase.surfaceHeight());
|
||||
}
|
||||
|
||||
final long swapBuffersStartTimeNs = System.nanoTime();
|
||||
@ -689,8 +689,8 @@ public class EglRenderer implements VideoRenderer.Callbacks, VideoSink {
|
||||
frame.getRotatedWidth(), frame.getRotatedHeight(), 0, 0, scaledWidth, scaledHeight);
|
||||
} else {
|
||||
VideoFrame.TextureBuffer textureBuffer = (VideoFrame.TextureBuffer) frame.getBuffer();
|
||||
listenerAndParams.drawer.drawTexture(textureBuffer, drawMatrix, frame.getRotatedWidth(),
|
||||
frame.getRotatedHeight(), 0, 0, scaledWidth, scaledHeight);
|
||||
RendererCommon.drawTexture(listenerAndParams.drawer, textureBuffer, drawMatrix,
|
||||
frame.getRotatedWidth(), frame.getRotatedHeight(), 0, 0, scaledWidth, scaledHeight);
|
||||
}
|
||||
|
||||
final ByteBuffer bitmapBuffer = ByteBuffer.allocateDirect(scaledWidth * scaledHeight * 4);
|
||||
|
||||
@ -616,8 +616,8 @@ public class MediaCodecVideoEncoder {
|
||||
// TODO(perkj): glClear() shouldn't be necessary since every pixel is covered anyway,
|
||||
// but it's a workaround for bug webrtc:5147.
|
||||
GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);
|
||||
drawer.drawTexture(textureBuffer, new Matrix() /* renderMatrix */, width, height,
|
||||
0 /* viewportX */, 0 /* viewportY */, width, height);
|
||||
RendererCommon.drawTexture(drawer, textureBuffer, new Matrix() /* renderMatrix */, width,
|
||||
height, 0 /* viewportX */, 0 /* viewportY */, width, height);
|
||||
eglBase.swapBuffers(frame.getTimestampNs());
|
||||
} else {
|
||||
VideoFrame.I420Buffer i420Buffer = buffer.toI420();
|
||||
|
||||
@ -34,7 +34,6 @@ public class RendererCommon {
|
||||
}
|
||||
|
||||
/** Interface for rendering frames on an EGLSurface. */
|
||||
@SuppressWarnings("StaticOrDefaultInterfaceMethod")
|
||||
public static interface GlDrawer {
|
||||
/**
|
||||
* Functions for drawing frames with different sources. The rendering surface target is
|
||||
@ -49,37 +48,35 @@ public class RendererCommon {
|
||||
int viewportX, int viewportY, int viewportWidth, int viewportHeight);
|
||||
|
||||
/**
|
||||
* Draws a VideoFrame.TextureBuffer. Default implementation calls either drawOes or drawRgb
|
||||
* depending on the type of the buffer. You can supply an additional render matrix. This is
|
||||
* used multiplied together with the transformation matrix of the frame. (M = renderMatrix *
|
||||
* transformationMatrix)
|
||||
* Release all GL resources. This needs to be done manually, otherwise resources may leak.
|
||||
*/
|
||||
default void
|
||||
drawTexture(VideoFrame.TextureBuffer buffer, android.graphics.Matrix renderMatrix,
|
||||
int frameWidth, int frameHeight, int viewportX, int viewportY, int viewportWidth,
|
||||
int viewportHeight) {
|
||||
android.graphics.Matrix finalMatrix =
|
||||
new android.graphics.Matrix(buffer.getTransformMatrix());
|
||||
finalMatrix.preConcat(renderMatrix);
|
||||
float[] finalGlMatrix = convertMatrixFromAndroidGraphicsMatrix(finalMatrix);
|
||||
switch (buffer.getType()) {
|
||||
case OES:
|
||||
drawOes(buffer.getTextureId(), finalGlMatrix, frameWidth, frameHeight, viewportX,
|
||||
viewportY, viewportWidth, viewportHeight);
|
||||
break;
|
||||
case RGB:
|
||||
drawRgb(buffer.getTextureId(), finalGlMatrix, frameWidth, frameHeight, viewportX,
|
||||
viewportY, viewportWidth, viewportHeight);
|
||||
break;
|
||||
default:
|
||||
throw new RuntimeException("Unknown texture type.");
|
||||
}
|
||||
}
|
||||
void release();
|
||||
}
|
||||
|
||||
/**
|
||||
* Release all GL resources. This needs to be done manually, otherwise resources may leak.
|
||||
*/
|
||||
void release();
|
||||
/**
|
||||
* Draws a VideoFrame.TextureBuffer. Calls either drawer.drawOes or drawer.drawRgb
|
||||
* depending on the type of the buffer. You can supply an additional render matrix. This is
|
||||
* used multiplied together with the transformation matrix of the frame. (M = renderMatrix *
|
||||
* transformationMatrix)
|
||||
*/
|
||||
static void drawTexture(GlDrawer drawer, VideoFrame.TextureBuffer buffer,
|
||||
android.graphics.Matrix renderMatrix, int frameWidth, int frameHeight, int viewportX,
|
||||
int viewportY, int viewportWidth, int viewportHeight) {
|
||||
android.graphics.Matrix finalMatrix = new android.graphics.Matrix(buffer.getTransformMatrix());
|
||||
finalMatrix.preConcat(renderMatrix);
|
||||
float[] finalGlMatrix = convertMatrixFromAndroidGraphicsMatrix(finalMatrix);
|
||||
switch (buffer.getType()) {
|
||||
case OES:
|
||||
drawer.drawOes(buffer.getTextureId(), finalGlMatrix, frameWidth, frameHeight, viewportX,
|
||||
viewportY, viewportWidth, viewportHeight);
|
||||
break;
|
||||
case RGB:
|
||||
drawer.drawRgb(buffer.getTextureId(), finalGlMatrix, frameWidth, frameHeight, viewportX,
|
||||
viewportY, viewportWidth, viewportHeight);
|
||||
break;
|
||||
default:
|
||||
throw new RuntimeException("Unknown texture type.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user