Add back AndroidVideoBuffer::CropAndScale

Now compatible with the recently added interface method
VideoFramebuffer::CropAndScale.

Bug: webrtc:11976
Change-Id: I461cf2de1d73ca953fda0ecad84d216b8b7ac879
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/187493
Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32391}
diff --git a/sdk/android/api/org/webrtc/VideoFrame.java b/sdk/android/api/org/webrtc/VideoFrame.java
index 49c75fa..a0a0d4e 100644
--- a/sdk/android/api/org/webrtc/VideoFrame.java
+++ b/sdk/android/api/org/webrtc/VideoFrame.java
@@ -54,6 +54,7 @@
      * Crops a region defined by |cropx|, |cropY|, |cropWidth| and |cropHeight|. Scales it to size
      * |scaleWidth| x |scaleHeight|.
      */
+    @CalledByNative("Buffer")
     Buffer cropAndScale(
         int cropX, int cropY, int cropWidth, int cropHeight, int scaleWidth, int scaleHeight);
   }
diff --git a/sdk/android/src/jni/video_frame.cc b/sdk/android/src/jni/video_frame.cc
index ca33c5c..860eebe 100644
--- a/sdk/android/src/jni/video_frame.cc
+++ b/sdk/android/src/jni/video_frame.cc
@@ -152,6 +152,19 @@
   return j_video_frame_buffer_;
 }
 
+rtc::scoped_refptr<VideoFrameBuffer> AndroidVideoBuffer::CropAndScale(
+    int crop_x,
+    int crop_y,
+    int crop_width,
+    int crop_height,
+    int scale_width,
+    int scale_height) {
+  JNIEnv* jni = AttachCurrentThreadIfNeeded();
+  return Adopt(jni, Java_Buffer_cropAndScale(jni, j_video_frame_buffer_, crop_x,
+                                             crop_y, crop_width, crop_height,
+                                             scale_width, scale_height));
+}
+
 VideoFrameBuffer::Type AndroidVideoBuffer::type() const {
   return Type::kNative;
 }
diff --git a/sdk/android/src/jni/video_frame.h b/sdk/android/src/jni/video_frame.h
index cb0ff0e..5e39b8a 100644
--- a/sdk/android/src/jni/video_frame.h
+++ b/sdk/android/src/jni/video_frame.h
@@ -40,6 +40,15 @@
 
   const ScopedJavaGlobalRef<jobject>& video_frame_buffer() const;
 
+  // Crops a region defined by |crop_x|, |crop_y|, |crop_width| and
+  // |crop_height|. Scales it to size |scale_width| x |scale_height|.
+  rtc::scoped_refptr<VideoFrameBuffer> CropAndScale(int crop_x,
+                                                    int crop_y,
+                                                    int crop_width,
+                                                    int crop_height,
+                                                    int scale_width,
+                                                    int scale_height) override;
+
  protected:
   // Should not be called directly. Adopts the Java VideoFrame.Buffer. Use
   // Create() or Adopt() instead for clarity.