Android: Generalize and make TextureBufferImpl public

This CL generalizes TextureBufferImpl so it's useful from other contexts than
from a SurfaceTextureHelper, and fixes a bug in cropAndScale(). It also exposes
the class in the api so that clients don't have to duplicate the logic.

Bug: None
Change-Id: Ib82aa8bee025ec14de74a7be9d91fd4e5298a248
Reviewed-on: https://webrtc-review.googlesource.com/69819
Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
Commit-Queue: Magnus Jedvert <magjed@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22875}
diff --git a/sdk/android/api/org/webrtc/SurfaceTextureHelper.java b/sdk/android/api/org/webrtc/SurfaceTextureHelper.java
index eefc153..700a7b9 100644
--- a/sdk/android/api/org/webrtc/SurfaceTextureHelper.java
+++ b/sdk/android/api/org/webrtc/SurfaceTextureHelper.java
@@ -320,12 +320,7 @@
    * buffer calls returnTextureFrame() when it is released.
    */
   public TextureBuffer createTextureBuffer(int width, int height, Matrix transformMatrix) {
-    return new TextureBufferImpl(
-        width, height, TextureBuffer.Type.OES, oesTextureId, transformMatrix, this, new Runnable() {
-          @Override
-          public void run() {
-            returnTextureFrame();
-          }
-        });
+    return new TextureBufferImpl(width, height, TextureBuffer.Type.OES, oesTextureId,
+        transformMatrix, handler, yuvConverter, this ::returnTextureFrame);
   }
 }