Add scaling interface to VideoFrameBuffer

This can be overriden for kNative frame types to perform scaling efficiently.

Default implementations for existing buffer types require actual
buffer implementation, thus this CL also merges "video_frame"
with "video_frame_I420" build targets.

Bug: webrtc:11976, chromium:1132299
Change-Id: I3bf5f6bf179db5e7ab165b1c2301980043a08765
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/186303
Commit-Queue: Ilya Nikolaevskiy <ilnik@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Stefan Holmer <stefan@webrtc.org>
Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Reviewed-by: Evan Shrubsole <eshr@google.com>
Cr-Commit-Position: refs/heads/master@{#32352}
This commit is contained in:
Ilya Nikolaevskiy
2020-10-08 14:34:14 +02:00
committed by Commit Bot
parent 2d05878689
commit c79f1d8cfb
26 changed files with 179 additions and 133 deletions

View File

@ -152,19 +152,6 @@ const ScopedJavaGlobalRef<jobject>& AndroidVideoBuffer::video_frame_buffer()
return j_video_frame_buffer_;
}
rtc::scoped_refptr<AndroidVideoBuffer> AndroidVideoBuffer::CropAndScale(
JNIEnv* jni,
int crop_x,
int crop_y,
int crop_width,
int crop_height,
int scale_width,
int scale_height) {
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;
}

View File

@ -40,16 +40,6 @@ 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<AndroidVideoBuffer> CropAndScale(JNIEnv* jni,
int crop_x,
int crop_y,
int crop_width,
int crop_height,
int scale_width,
int scale_height);
protected:
// Should not be called directly. Adopts the Java VideoFrame.Buffer. Use
// Create() or Adopt() instead for clarity.