Delete AndroidVideoCapturer::FrameFactory.
Splits VideoCapturer::OnFrameCaptured into helper methods, which enables use of the VideoAdaptation logic without using a frame factory. Refactors AndroidVideoCapturer to make adaptation decision earlier, so we can crop and rotate using NV12ToI420Rotate. BUG=webrtc:5682 Review-Url: https://codereview.webrtc.org/1973873003 Cr-Commit-Position: refs/heads/master@{#12895}
This commit is contained in:
@ -18,14 +18,37 @@
|
||||
|
||||
namespace webrtc_jni {
|
||||
|
||||
// Open gl texture matrix, in column-major order. Operations are
|
||||
// in-place.
|
||||
class Matrix {
|
||||
public:
|
||||
Matrix(JNIEnv* jni, jfloatArray a);
|
||||
|
||||
jfloatArray ToJava(JNIEnv* jni);
|
||||
|
||||
// Crop arguments are relative to original size.
|
||||
void Crop(float cropped_width,
|
||||
float cropped_height,
|
||||
float crop_x,
|
||||
float crop_y);
|
||||
|
||||
void Rotate(webrtc::VideoRotation rotation);
|
||||
|
||||
private:
|
||||
static void Multiply(const float a[16], const float b[16], float result[16]);
|
||||
float elem_[16];
|
||||
};
|
||||
|
||||
// Wrapper for texture object.
|
||||
struct NativeHandleImpl {
|
||||
NativeHandleImpl(JNIEnv* jni,
|
||||
jint j_oes_texture_id,
|
||||
jfloatArray j_transform_matrix);
|
||||
|
||||
NativeHandleImpl(int id, const Matrix& matrix);
|
||||
|
||||
const int oes_texture_id;
|
||||
float sampling_matrix[16];
|
||||
Matrix sampling_matrix;
|
||||
};
|
||||
|
||||
class AndroidTextureBuffer : public webrtc::NativeHandleBuffer {
|
||||
@ -42,6 +65,8 @@ class AndroidTextureBuffer : public webrtc::NativeHandleBuffer {
|
||||
rtc::scoped_refptr<AndroidTextureBuffer> CropScaleAndRotate(
|
||||
int cropped_width,
|
||||
int cropped_height,
|
||||
int crop_x,
|
||||
int crop_y,
|
||||
int dst_width,
|
||||
int dst_height,
|
||||
webrtc::VideoRotation rotation);
|
||||
|
||||
Reference in New Issue
Block a user