Remove static/default interface method usage.

BUG=webrtc:8217

Review-Url: https://codereview.webrtc.org/3010233002
Cr-Original-Commit-Position: refs/heads/master@{#19741}
Cr-Mirrored-From: https://chromium.googlesource.com/external/webrtc
Cr-Mirrored-Commit: 9bc599f6da435acba6fbb2e5e8b43863dcc45c2b
diff --git a/sdk/android/api/org/webrtc/EglBase.java b/sdk/android/api/org/webrtc/EglBase.java
index 2a8d4e4..1f90588 100644
--- a/sdk/android/api/org/webrtc/EglBase.java
+++ b/sdk/android/api/org/webrtc/EglBase.java
@@ -19,8 +19,7 @@
  * 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 @@
     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);
 }
diff --git a/sdk/android/api/org/webrtc/EglRenderer.java b/sdk/android/api/org/webrtc/EglRenderer.java
index 08d66a9..d3c9151 100644
--- a/sdk/android/api/org/webrtc/EglRenderer.java
+++ b/sdk/android/api/org/webrtc/EglRenderer.java
@@ -622,8 +622,8 @@
             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 @@
             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);
diff --git a/sdk/android/api/org/webrtc/MediaCodecVideoEncoder.java b/sdk/android/api/org/webrtc/MediaCodecVideoEncoder.java
index 5ccf640..a45e709 100644
--- a/sdk/android/api/org/webrtc/MediaCodecVideoEncoder.java
+++ b/sdk/android/api/org/webrtc/MediaCodecVideoEncoder.java
@@ -616,8 +616,8 @@
         // 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();
diff --git a/sdk/android/api/org/webrtc/RendererCommon.java b/sdk/android/api/org/webrtc/RendererCommon.java
index 8f8d9fe..18d96c2 100644
--- a/sdk/android/api/org/webrtc/RendererCommon.java
+++ b/sdk/android/api/org/webrtc/RendererCommon.java
@@ -34,7 +34,6 @@
   }
 
   /** 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 @@
         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.");
+    }
   }
 
   /**
diff --git a/sdk/android/src/java/org/webrtc/EglBase10.java b/sdk/android/src/java/org/webrtc/EglBase10.java
index 70200fa..8f1c5c6 100644
--- a/sdk/android/src/java/org/webrtc/EglBase10.java
+++ b/sdk/android/src/java/org/webrtc/EglBase10.java
@@ -26,7 +26,7 @@
  * Holds EGL state and utility methods for handling an egl 1.0 EGLContext, an EGLDisplay,
  * and an EGLSurface.
  */
-class EglBase10 implements EglBase {
+class EglBase10 extends EglBase {
   // This constant is taken from EGL14.EGL_CONTEXT_CLIENT_VERSION.
   private static final int EGL_CONTEXT_CLIENT_VERSION = 0x3098;
 
diff --git a/sdk/android/src/java/org/webrtc/EglBase14.java b/sdk/android/src/java/org/webrtc/EglBase14.java
index 44d16d5..92f0958 100644
--- a/sdk/android/src/java/org/webrtc/EglBase14.java
+++ b/sdk/android/src/java/org/webrtc/EglBase14.java
@@ -25,7 +25,7 @@
  * and an EGLSurface.
  */
 @TargetApi(18)
-class EglBase14 implements EglBase {
+class EglBase14 extends 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;