Reland "Add scaling interface to VideoFrameBuffer"

(Reland with no changes after the fix to the downstream project)

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.

Originally Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/186303

(Landing with TBR as it's unchaged reland of already approved CL)
TBR=nisse@webrtc.org,sakal@webrtc.org

Bug: webrtc:11976, chromium:1132299
Change-Id: Ia23f7d3e474bd9cdc177104cc5c6d772f04b210f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/187345
Commit-Queue: Ilya Nikolaevskiy <ilnik@webrtc.org>
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Stefan Holmer <stefan@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32362}
This commit is contained in:
Ilya Nikolaevskiy
2020-10-08 14:36:33 +00:00
committed by Commit Bot
parent 44d0dff7a9
commit 38e9b06151
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.