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}
This commit is contained in:
@ -54,6 +54,7 @@ public class VideoFrame implements RefCounted {
|
||||
* 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);
|
||||
}
|
||||
|
||||
@ -152,6 +152,19 @@ const ScopedJavaGlobalRef<jobject>& AndroidVideoBuffer::video_frame_buffer()
|
||||
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;
|
||||
}
|
||||
|
||||
@ -40,6 +40,15 @@ class AndroidVideoBuffer : public VideoFrameBuffer {
|
||||
|
||||
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.
|
||||
|
||||
Reference in New Issue
Block a user