Remove dead code from videoframe.cc.
Removes dead code that was left by a previous cleanup. Bug: webrtc:9181 Change-Id: Iad7a747b4b394bfe16767229b7840a49a044c516 Reviewed-on: https://webrtc-review.googlesource.com/90042 Reviewed-by: Paulina Hensman <phensman@webrtc.org> Commit-Queue: Sami Kalliomäki <sakal@webrtc.org> Cr-Commit-Position: refs/heads/master@{#24062}
This commit is contained in:

committed by
Commit Bot

parent
fdc0ef11ad
commit
08410e7162
@ -46,19 +46,6 @@ class AndroidVideoTrackSource : public rtc::AdaptedVideoTrackSource {
|
|||||||
|
|
||||||
bool remote() const override;
|
bool remote() const override;
|
||||||
|
|
||||||
void OnByteBufferFrameCaptured(const void* frame_data,
|
|
||||||
int length,
|
|
||||||
int width,
|
|
||||||
int height,
|
|
||||||
VideoRotation rotation,
|
|
||||||
int64_t timestamp_ns);
|
|
||||||
|
|
||||||
void OnTextureFrameCaptured(int width,
|
|
||||||
int height,
|
|
||||||
VideoRotation rotation,
|
|
||||||
int64_t timestamp_ns,
|
|
||||||
const NativeHandleImpl& handle);
|
|
||||||
|
|
||||||
void OnFrameCaptured(JNIEnv* jni,
|
void OnFrameCaptured(JNIEnv* jni,
|
||||||
int width,
|
int width,
|
||||||
int height,
|
int height,
|
||||||
|
@ -123,120 +123,6 @@ int64_t GetJavaVideoFrameTimestampNs(JNIEnv* jni,
|
|||||||
return Java_VideoFrame_getTimestampNs(jni, j_video_frame);
|
return Java_VideoFrame_getTimestampNs(jni, j_video_frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
Matrix::Matrix(JNIEnv* jni, const JavaRef<jfloatArray>& a) {
|
|
||||||
RTC_CHECK_EQ(16, jni->GetArrayLength(a.obj()));
|
|
||||||
jni->GetFloatArrayRegion(a.obj(), 0, 16, elem_);
|
|
||||||
}
|
|
||||||
|
|
||||||
ScopedJavaLocalRef<jfloatArray> Matrix::ToJava(JNIEnv* jni) const {
|
|
||||||
ScopedJavaLocalRef<jfloatArray> matrix(jni, jni->NewFloatArray(16));
|
|
||||||
jni->SetFloatArrayRegion(matrix.obj(), 0, 16, elem_);
|
|
||||||
return matrix;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Matrix::Rotate(VideoRotation rotation) {
|
|
||||||
// Texture coordinates are in the range 0 to 1. The transformation of the last
|
|
||||||
// row in each rotation matrix is needed for proper translation, e.g, to
|
|
||||||
// mirror x, we don't replace x by -x, but by 1-x.
|
|
||||||
switch (rotation) {
|
|
||||||
case kVideoRotation_0:
|
|
||||||
break;
|
|
||||||
case kVideoRotation_90: {
|
|
||||||
const float ROTATE_90[16] = {elem_[4],
|
|
||||||
elem_[5],
|
|
||||||
elem_[6],
|
|
||||||
elem_[7],
|
|
||||||
-elem_[0],
|
|
||||||
-elem_[1],
|
|
||||||
-elem_[2],
|
|
||||||
-elem_[3],
|
|
||||||
elem_[8],
|
|
||||||
elem_[9],
|
|
||||||
elem_[10],
|
|
||||||
elem_[11],
|
|
||||||
elem_[0] + elem_[12],
|
|
||||||
elem_[1] + elem_[13],
|
|
||||||
elem_[2] + elem_[14],
|
|
||||||
elem_[3] + elem_[15]};
|
|
||||||
memcpy(elem_, ROTATE_90, sizeof(elem_));
|
|
||||||
} break;
|
|
||||||
case kVideoRotation_180: {
|
|
||||||
const float ROTATE_180[16] = {-elem_[0],
|
|
||||||
-elem_[1],
|
|
||||||
-elem_[2],
|
|
||||||
-elem_[3],
|
|
||||||
-elem_[4],
|
|
||||||
-elem_[5],
|
|
||||||
-elem_[6],
|
|
||||||
-elem_[7],
|
|
||||||
elem_[8],
|
|
||||||
elem_[9],
|
|
||||||
elem_[10],
|
|
||||||
elem_[11],
|
|
||||||
elem_[0] + elem_[4] + elem_[12],
|
|
||||||
elem_[1] + elem_[5] + elem_[13],
|
|
||||||
elem_[2] + elem_[6] + elem_[14],
|
|
||||||
elem_[3] + elem_[11] + elem_[15]};
|
|
||||||
memcpy(elem_, ROTATE_180, sizeof(elem_));
|
|
||||||
} break;
|
|
||||||
case kVideoRotation_270: {
|
|
||||||
const float ROTATE_270[16] = {-elem_[4],
|
|
||||||
-elem_[5],
|
|
||||||
-elem_[6],
|
|
||||||
-elem_[7],
|
|
||||||
elem_[0],
|
|
||||||
elem_[1],
|
|
||||||
elem_[2],
|
|
||||||
elem_[3],
|
|
||||||
elem_[8],
|
|
||||||
elem_[9],
|
|
||||||
elem_[10],
|
|
||||||
elem_[11],
|
|
||||||
elem_[4] + elem_[12],
|
|
||||||
elem_[5] + elem_[13],
|
|
||||||
elem_[6] + elem_[14],
|
|
||||||
elem_[7] + elem_[15]};
|
|
||||||
memcpy(elem_, ROTATE_270, sizeof(elem_));
|
|
||||||
} break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Calculates result = a * b, in column-major order.
|
|
||||||
void Matrix::Multiply(const float a[16], const float b[16], float result[16]) {
|
|
||||||
for (int i = 0; i < 4; ++i) {
|
|
||||||
for (int j = 0; j < 4; ++j) {
|
|
||||||
float sum = 0;
|
|
||||||
for (int k = 0; k < 4; ++k) {
|
|
||||||
sum += a[k * 4 + j] * b[i * 4 + k];
|
|
||||||
}
|
|
||||||
result[i * 4 + j] = sum;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Center crop by keeping xFraction of the width and yFraction of the height,
|
|
||||||
// so e.g. cropping from 640x480 to 640x360 would use
|
|
||||||
// xFraction=1, yFraction=360/480.
|
|
||||||
void Matrix::Crop(float xFraction,
|
|
||||||
float yFraction,
|
|
||||||
float xOffset,
|
|
||||||
float yOffset) {
|
|
||||||
const float crop_matrix[16] = {xFraction, 0, 0, 0, 0, yFraction, 0, 0,
|
|
||||||
0, 0, 1, 0, xOffset, yOffset, 0, 1};
|
|
||||||
const Matrix old = *this;
|
|
||||||
Multiply(crop_matrix, old.elem_, this->elem_);
|
|
||||||
}
|
|
||||||
|
|
||||||
NativeHandleImpl::NativeHandleImpl(int id, const Matrix& matrix)
|
|
||||||
: oes_texture_id(id), sampling_matrix(matrix) {}
|
|
||||||
|
|
||||||
NativeHandleImpl::NativeHandleImpl(
|
|
||||||
JNIEnv* jni,
|
|
||||||
jint j_oes_texture_id,
|
|
||||||
const JavaRef<jfloatArray>& j_transform_matrix)
|
|
||||||
: oes_texture_id(j_oes_texture_id),
|
|
||||||
sampling_matrix(jni, j_transform_matrix) {}
|
|
||||||
|
|
||||||
rtc::scoped_refptr<AndroidVideoBuffer> AndroidVideoBuffer::Adopt(
|
rtc::scoped_refptr<AndroidVideoBuffer> AndroidVideoBuffer::Adopt(
|
||||||
JNIEnv* jni,
|
JNIEnv* jni,
|
||||||
const JavaRef<jobject>& j_video_frame_buffer) {
|
const JavaRef<jobject>& j_video_frame_buffer) {
|
||||||
|
@ -22,47 +22,6 @@
|
|||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
namespace jni {
|
namespace jni {
|
||||||
|
|
||||||
// TODO(sakal): Remove once clients have migrated.
|
|
||||||
using ::webrtc::JavaParamRef;
|
|
||||||
|
|
||||||
// Open gl texture matrix, in column-major order. Operations are
|
|
||||||
// in-place.
|
|
||||||
class Matrix {
|
|
||||||
public:
|
|
||||||
Matrix(JNIEnv* jni, const JavaRef<jfloatArray>& a);
|
|
||||||
|
|
||||||
static Matrix fromAndroidGraphicsMatrix(JNIEnv* jni,
|
|
||||||
const JavaRef<jobject>& j_matrix);
|
|
||||||
|
|
||||||
ScopedJavaLocalRef<jfloatArray> ToJava(JNIEnv* jni) const;
|
|
||||||
|
|
||||||
// Crop arguments are relative to original size.
|
|
||||||
void Crop(float cropped_width,
|
|
||||||
float cropped_height,
|
|
||||||
float crop_x,
|
|
||||||
float crop_y);
|
|
||||||
|
|
||||||
void Rotate(VideoRotation rotation);
|
|
||||||
|
|
||||||
private:
|
|
||||||
Matrix() {}
|
|
||||||
|
|
||||||
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,
|
|
||||||
const JavaRef<jfloatArray>& j_transform_matrix);
|
|
||||||
|
|
||||||
NativeHandleImpl(int id, const Matrix& matrix);
|
|
||||||
|
|
||||||
const int oes_texture_id;
|
|
||||||
Matrix sampling_matrix;
|
|
||||||
};
|
|
||||||
|
|
||||||
class AndroidVideoBuffer : public VideoFrameBuffer {
|
class AndroidVideoBuffer : public VideoFrameBuffer {
|
||||||
public:
|
public:
|
||||||
// Creates a native VideoFrameBuffer from a Java VideoFrame.Buffer.
|
// Creates a native VideoFrameBuffer from a Java VideoFrame.Buffer.
|
||||||
|
Reference in New Issue
Block a user